/* TradeBot Mini App — reusable components: grouped lists, chips, buttons, figures, charts. */

/* ---- sections & rows (Telegram-style grouped lists) --------------------------- */
.section-title {
  margin: 20px 6px 7px; font-size: 12.5px; font-weight: 700; color: var(--section-header);
  text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  opacity: .9;
}
.section-title .aside { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--hint); }
.card { background: var(--section); border-radius: var(--radius); overflow: hidden; container-type: inline-size;
  box-shadow: var(--shadow-1); }
.card + .card { margin-top: 10px; }
.card.pad { padding: 14px 16px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 48px; width: 100%;
  background: none; border: 0; text-align: left; position: relative; transition: background .12s ease;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
button.row { cursor: pointer; }
button.row:active { background: color-mix(in srgb, var(--hint) 12%, transparent); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-sub { font-size: 13px; color: var(--subtle); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }
.row-sub.wrap { white-space: normal; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.more { width: 100%; border: 0; background: none; color: var(--link); font-weight: 600; padding: 12px 16px; cursor: pointer; border-top: 1px solid var(--separator); }
.row-end { text-align: right; flex-shrink: 0; }
.row-end .big { font-weight: 700; }
.chev { color: var(--hint); flex-shrink: 0; width: 16px; height: 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 16px; font-size: 14px; }
.kv + .kv { border-top: 1px solid var(--separator); }
.kv dt { color: var(--subtle); }
.kv dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; }

/* ---- small components -------------------------------------------------------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.right { justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: color-mix(in srgb, var(--hint) 18%, transparent); color: var(--subtle); white-space: nowrap; letter-spacing: .01em; }
.chip.up { background: var(--up-soft); color: var(--up); }
.chip.down { background: var(--down-soft); color: var(--down); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--hint); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px;
  border-radius: 11px; border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 650; cursor: pointer;
  transition: transform .1s ease, filter .15s ease, background .15s ease;
}
.btn.primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 1px 2px rgb(0 0 0 / 16%); }
.btn.danger { background: var(--down-soft); color: var(--down); }
.btn.good { background: var(--up-soft); color: var(--up); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:not(:disabled):active { transform: scale(.98); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 16px 14px; }
.btn-row.one { grid-template-columns: 1fr; }
.small-btn { min-height: 34px; padding: 0 14px; flex-shrink: 0; }
.row-icon { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }

.seg { display: flex; background: color-mix(in srgb, var(--hint) 16%, transparent); border-radius: 10px; padding: 2px; gap: 2px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hint) 8%, transparent); }
.seg button { flex: 1; min-width: 0; border: 0; background: none; padding: 6px 8px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--subtle);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button[aria-pressed="true"] { background: var(--section); color: var(--text); box-shadow: 0 1px 3px #0003, inset 0 0 0 1px color-mix(in srgb, var(--hint) 10%, transparent); }
.seg-wrap { margin: 10px 0 4px; }
.seg.in-card { margin: 12px 16px; }
.seg button:disabled { opacity: .45; cursor: default; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--separator); }
.kpi { background: var(--section); padding: 12px 16px; }
.kpi-label { font-size: 12px; color: var(--hint); }
.kpi-value { font-size: 19px; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--subtle); }

.meter { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--hint) 20%, transparent); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--up); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--down); }

/* position progress: stop ←— entry —→ final target */
.track { position: relative; height: 22px; margin: 8px 0 2px; }
.track-line { position: absolute; top: 10px; left: 0; right: 0; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--down) 0 var(--entry-pos, 33%), var(--up) var(--entry-pos, 33%) 100%); opacity: .35; }
.track-mark { position: absolute; top: 5px; width: 2px; height: 13px; background: var(--hint); border-radius: 1px; }
.track-now { position: absolute; top: 4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--text);
  border: 3px solid var(--section); box-shadow: 0 0 0 1px var(--hint); }
.track-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--hint); }

.bias { position: relative; height: 4px; border-radius: 2px; margin: 9px 0 4px; max-width: 220px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--down) 55%, transparent),
    color-mix(in srgb, var(--hint) 25%, transparent) 50%, color-mix(in srgb, var(--up) 55%, transparent)); }
.bias::after { content: ""; position: absolute; left: 50%; top: -2px; width: 1px; height: 8px; background: var(--hint); opacity: .5; }
.bias > i { position: absolute; top: -4px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--text);
  border: 2px solid var(--section); box-sizing: border-box; }

.chart { display: block; width: 100%; height: 140px; --c: var(--up); }
.chart.down { --c: var(--down); }
.chart.flat { --c: var(--accent); }
.chart .line { fill: none; stroke: var(--c); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .g0 { stop-color: var(--c); stop-opacity: .28; }
.chart .g1 { stop-color: var(--c); stop-opacity: 0; }
.equity-head { padding: 14px 16px 10px; }
.equity-delta { font-size: 24px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.equity-sub { font-size: 13px; color: var(--hint); margin-top: 2px; }
.chart .base { stroke: var(--hint); stroke-width: 1; stroke-dasharray: 3 4; opacity: .5; vector-effect: non-scaling-stroke; }
.chart-meta { display: flex; justify-content: space-between; padding: 0 16px 12px; font-size: 12px; color: var(--hint); }

.funnel { padding: 6px 16px 12px; }
.funnel-row { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; }
.funnel-bar { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--hint) 18%, transparent); overflow: hidden; }
.funnel-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.funnel-row.good .funnel-bar > i { background: var(--up); }
.funnel-row.bad .funnel-bar > i { background: var(--down); }

.field { display: flex; flex-direction: column; gap: 4px; padding: 10px 16px; }
.field label { font-size: 12px; color: var(--hint); }
.field select { min-height: 42px; border-radius: 11px; border: 1px solid var(--separator); background: var(--section); padding: 0 12px;
  font-weight: 600; }

.empty { padding: 24px 20px; text-align: center; color: var(--hint); font-size: 14px; line-height: 1.5; }
.empty-icon { width: 48px; height: 48px; margin: 0 auto 8px; border-radius: 14px; display: grid; place-items: center;
  font-size: 24px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); }
.notice { margin: 10px 0 0; padding: 10px 14px; border-radius: 12px; border-left: 3px solid var(--warn); font-size: 13px;
  background: var(--warn-soft); color: var(--text); }
.notice.info { border-left-color: var(--accent); background: var(--accent-soft); }
.notice.bad { border-left-color: var(--down); background: var(--down-soft); }
.card + .notice, .notice + .card { margin-top: 10px; }
.text { padding: 12px 16px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.list-plain { margin: 0; padding: 4px 16px 12px 32px; font-size: 13.5px; }
.list-plain li + li { margin-top: 4px; }

.skeleton { height: 64px; margin: 10px 0; border-radius: var(--radius); background: linear-gradient(90deg, var(--section) 25%,
  color-mix(in srgb, var(--hint) 14%, var(--section)) 50%, var(--section) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* horizontally scrolling strips: coin tiles (Home), filter pills (News) */
.strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 4px; scroll-snap-type: x proximity;
  scrollbar-width: none; overscroll-behavior-x: contain; }
.strip::-webkit-scrollbar { display: none; }
.tile { flex: 0 0 auto; min-width: 92px; scroll-snap-align: start; border: 0; border-radius: 12px; background: var(--section);
  padding: 10px 12px; text-align: left; cursor: pointer; box-shadow: var(--shadow-1);
  transition: transform .12s ease, background .15s ease; }
.tile:active { transform: scale(.97); }
.tile-sym { font-weight: 700; font-size: 13px; color: var(--subtle); display: flex; align-items: center; gap: 6px; }
.tile-px { font-weight: 700; margin-top: 2px; }
.strip.pills { margin-top: 12px; }
.pill { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 5px 12px 5px 6px; font-size: 13px; font-weight: 650; cursor: pointer;
  background: color-mix(in srgb, var(--hint) 16%, transparent); color: var(--subtle); }
.pill.no-icon { padding-left: 12px; }
.pill[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

/* coin view: header, candlestick chart, readout, legend */
.coin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 2px 6px 0; }
.coin-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.coin-meta { min-width: 0; }
.coin-name { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 750; color: var(--subtle); letter-spacing: .01em; }
.coin-kind { font-size: 9.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--hint);
  padding: 2px 6px; border-radius: 5px; background: color-mix(in srgb, var(--hint) 13%, transparent); }
.coin-price { font-size: 28px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; margin-top: 1px; }
.candles { display: block; width: 100%; height: 220px; touch-action: pan-y; cursor: crosshair; }
.candles .c-up { fill: var(--up); stroke: var(--up); }
.candles .c-down { fill: var(--down); stroke: var(--down); }
.candles .wick { stroke-width: 1; vector-effect: non-scaling-stroke; }
.candles rect { stroke-width: 0; }
.candles .ema { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.candles .ema21 { stroke: var(--accent); }
.candles .ema50 { stroke: var(--warn); opacity: .8; }
.candles .lv { stroke-width: 1; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.candles .lv-entry { stroke: var(--text); opacity: .7; }
.candles .lv-stop { stroke: var(--down); }
.candles .lv-tp { stroke: var(--up); }
.candles .lv-limit { stroke: var(--warn); }
.candles .lv-last { stroke: var(--hint); stroke-dasharray: 2 3; }
.candles .cross { stroke: var(--hint); stroke-width: 1; vector-effect: non-scaling-stroke; }
.readout { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 10px 14px 4px; font-size: 12px; font-weight: 600; min-height: 34px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 14px 12px; font-size: 11.5px; color: var(--subtle); }
.lg::before { content: ""; display: inline-block; width: 12px; height: 0; margin-right: 5px; vertical-align: middle; border-top: 2px solid currentColor; }
.lg.ema21::before { border-color: var(--accent); }
.lg.ema50::before { border-color: var(--warn); }
.lg.lv-entry::before { border-top-style: dashed; border-color: var(--text); }
.lg.lv-stop::before { border-top-style: dashed; border-color: var(--down); }
.lg.lv-tp::before { border-top-style: dashed; border-color: var(--up); }
.lg.lv-limit::before { border-top-style: dashed; border-color: var(--warn); }
.lg.lv-last::before { border-top-style: dotted; border-color: var(--hint); }


/* ---- coin marks, stat grids, reasons, callouts -------------------------------- */
/* A coin is a brand-coloured squircle with the mark centred: recognisable at 23 px in a row or 48 px in a sheet. */
.coin-icon {
  position: relative; flex-shrink: 0; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  overflow: hidden; background: var(--coin, var(--hint)); isolation: isolate;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 14%), 0 1px 2px rgb(0 0 0 / 18%);
  transition: transform .12s ease;
}
.coin-icon::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(145deg, rgb(255 255 255 / 18%), transparent 46%); }
.coin-icon svg { position: relative; z-index: 1; display: block; width: 100%; height: 100%; }
.coin-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.coin-icon.has-img::after, .coin-icon.mono::after { display: none; }
.coin-icon.big { width: 48px; height: 48px; border-radius: 15px; }
.coin-icon.sm { width: 30px; height: 30px; border-radius: 9px; }
.coin-icon.xs { width: 23px; height: 23px; border-radius: 7px; }
.coin-icon.mono { background: hsl(var(--hue) 75% 55% / 16%); color: hsl(var(--hue) 70% 42%);
  font-size: 10.5px; font-weight: 800; letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px hsl(var(--hue) 60% 50% / 14%); }
html[data-scheme="dark"] .coin-icon.mono { color: hsl(var(--hue) 80% 72%); background: hsl(var(--hue) 70% 55% / 18%); }
.coin-icon.mono.big { font-size: 13px; }
.coin-icon.mono.sm { font-size: 9.5px; }
.coin-icon.mono.xs { font-size: 8px; }
button.row:active .coin-icon { transform: scale(.96); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--separator); border-top: 1px solid var(--separator); }
.stat { background: var(--section); padding: 10px 16px; min-width: 0; }
.stat-label { font-size: 11.5px; color: var(--hint); font-weight: 600; }
.stat-value { font-size: 16px; font-weight: 700; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-sub { font-size: 12px; color: var(--subtle); }
.stat-value.up, .stat-value.down { color: var(--text); }
.stat-value.up + .stat-sub { color: var(--up); }
.stat-value.down + .stat-sub { color: var(--down); }
.card > .stats:first-child { border-top: 0; }
.reasons { margin: 0; padding: 10px 16px 4px 34px; font-size: 13.5px; }
.reasons li + li { margin-top: 3px; }
.reasons li::marker { color: var(--accent); }
.reasons.in-card { padding-bottom: 12px; }
.callout { margin: 8px 16px 0; padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45;
  background: var(--accent-soft); color: var(--text); }
.card.approval { border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.delta { display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 7px; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--hint) 16%, transparent); color: var(--subtle); }
.delta.up { background: var(--up-soft); color: var(--up); }
.delta.down { background: var(--down-soft); color: var(--down); }
.sheet-hero { display: flex; align-items: center; gap: 14px; padding: 4px 6px 14px; }
.sheet-hero-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.sheet-body > .card + .section-title, .sheet-body > .card { margin-bottom: 0; }

.rank { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: var(--accent-soft); color: var(--accent); }
.stats.wrap .stat-value { white-space: normal; font-size: 14.5px; line-height: 1.35; }
.row-text { font-size: 14px; line-height: 1.45; margin-top: 2px; }
.pbar { height: 4px; border-radius: 2px; margin-top: 6px; background: color-mix(in srgb, var(--hint) 14%, transparent); max-width: 240px; }
.pbar > i { display: block; height: 100%; border-radius: 2px; background: var(--hint); }
.pbar.up > i { background: var(--up); }
.pbar.down > i { background: var(--down); }
.lock-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--separator); }
.lock-form select { min-height: 36px; border-radius: 10px; border: 1px solid var(--separator); background: var(--bg); padding: 0 8px; }
