/* BTC Bot PWA. Dark trading-terminal theme, single-column tabbed layout. */
:root {
  color-scheme: dark;
  --surface-0: #0b1017; --surface-1: #111827; --surface-2: #172033; --surface-3: #1f2a40;
  --border: #243049; --border-strong: #324262;
  --text-primary: #eef2f7; --text-secondary: #a7b3c7; --text-muted: #6f7d95;
  --accent: #3987e5; --accent-soft: rgba(57,135,229,0.16);
  --up: #27a85a; --up-soft: rgba(39,168,90,0.18);
  --down: #e5484d; --down-soft: rgba(229,72,77,0.18);
  --warning: #fab219; --warning-soft: rgba(250,178,25,0.16); --critical: #d03b3b;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px; --radius-sm: 8px; --gap: 14px; --col: 720px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--surface-0); color: var(--text-primary); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--text-muted); font-size: 13px; }
.link { color: var(--accent); font-size: 13px; padding: 0; }

/* ---------------------------------------------------------------- top bar + tabs */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(var(--sat) + 8px) 16px 6px; background: rgba(11,16,23,0.92); backdrop-filter: blur(10px); max-width: var(--col); margin: 0 auto; }
.brand-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.coin.small { width: 26px; height: 26px; border-radius: 8px; font-size: 14px; }
.mode-chip { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; padding: 3px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-secondary); }
.mode-chip.live { color: #ffd37a; background: var(--warning-soft); box-shadow: inset 0 0 0 1px rgba(250,178,25,0.5); }
.avatar-btn { padding: 0; }
.health-ring { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--border-strong); color: var(--text-secondary); }
.health-ring svg { width: 18px; height: 18px; }
.health-ring.ok { border-color: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.health-ring.warn { border-color: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.health-ring.bad { border-color: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.round { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-secondary); }
.round svg { width: 18px; height: 18px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }
.countdown-pill { font-size: 15px; }
.ring { width: 18px; height: 18px; }
.ring circle { fill: none; stroke-width: 3; }
.ring .track { stroke: var(--surface-3); }
.ring .fill { stroke: var(--text-primary); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 1s linear; }
.top-right { display: flex; align-items: center; gap: 8px; }
.mode-pill { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; padding: 6px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); }
.mode-pill.live { color: #ffd37a; border-color: rgba(250,178,25,0.5); background: var(--warning-soft); }
.health { display: inline-grid; place-items: center; width: 24px; height: 24px; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); }
.health.ok .health-dot { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.health.warn .health-dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.health.bad .health-dot { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.health-text { font-size: 13px; color: var(--text-secondary); }
.tabs { position: sticky; top: calc(var(--sat) + 54px); z-index: 19; display: flex; gap: 4px; padding: 4px 16px 10px; background: rgba(11,16,23,0.92); backdrop-filter: blur(10px); max-width: var(--col); margin: 0 auto; }
.tabs button { flex: 1; padding: 9px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-secondary); background: var(--surface-1); border: 1px solid var(--border); }
.tabs button[aria-selected="true"] { background: var(--text-primary); color: var(--surface-0); border-color: var(--text-primary); }

/* ---------------------------------------------------------------- page / cards */
.page { max-width: var(--col); margin: 0 auto; padding: 8px 16px calc(24px + var(--sab)); display: grid; gap: var(--gap); }
section[data-panel] { display: grid; gap: var(--gap); }
section[data-panel][hidden] { display: none; }
[hidden] { display: none !important; }
.banner { display: none; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warning-soft); border: 1px solid rgba(250,178,25,0.4); font-size: 13px; }
.banner.show { display: flex; } .banner.critical { background: var(--down-soft); border-color: rgba(229,72,77,0.45); }
.banner .spacer { flex: 1; } .banner button { padding: 4px 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.04em; text-transform: uppercase; }
.card-note { font-size: 12px; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.btn { padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border-strong); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn.big { width: 100%; padding: 13px 16px; font-size: 15px; margin-top: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.tag.trade { background: var(--accent-soft); color: #8dbdf5; } .tag.skip { background: var(--surface-3); color: var(--text-secondary); }
.tag.pending { background: var(--warning-soft); color: #ffd37a; } .tag.correct { background: var(--up-soft); color: var(--up); }
.tag.wrong { background: var(--down-soft); color: var(--down); } .tag.sim { background: var(--surface-3); color: var(--text-muted); }

/* ---------------------------------------------------------------- live tab */
.market-title { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; padding-top: 4px; }
.coin { width: 30px; height: 30px; border-radius: 9px; background: #f7931a; color: #fff; display: inline-grid; place-items: center; font-weight: 800; font-size: 16px; }
.price-pair { display: grid; grid-template-columns: 1fr 1fr; }
.price-pair > div { padding: 2px 0; }
.price-beat { border-left: 1px solid var(--border); padding-left: 16px !important; }
.big { font-size: 27px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.price-now .big.up { color: var(--up); } .price-now .big.down { color: var(--down); }
.sub { margin-top: 4px; color: var(--text-secondary); font-size: 14px; }
#priceDelta.up { color: var(--up); } #priceDelta.down { color: var(--down); }
.live-chart { position: relative; height: 300px; }
.live-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.live-chart .grid line { stroke: var(--border); stroke-width: 1; }
.live-chart .axis text { fill: var(--text-muted); font-size: 12px; }
.live-chart .axis text.near { fill: var(--text-secondary); }
.live-chart .beat { stroke: var(--text-secondary); stroke-width: 1; stroke-dasharray: 4 4; }
.live-chart path.line { fill: none; stroke-width: 2.75; stroke-linejoin: round; stroke-linecap: round; }
.live-chart path.line.up { stroke: var(--up); } .live-chart path.line.down { stroke: var(--down); }
.live-chart .dot { stroke: var(--surface-0); stroke-width: 2; }
.live-chart .dot.up { fill: var(--up); } .live-chart .dot.down { fill: var(--down); }
.live-chart .dot-halo { opacity: 0.22; }
.live-chart .dot-halo.up { fill: var(--up); } .live-chart .dot-halo.down { fill: var(--down); }

.live-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font-size: 13px; }
.live-empty[hidden] { display: none; }
.beat-tag { position: absolute; right: 0; transform: translateY(-50%); background: var(--text-primary); color: var(--surface-0); font-weight: 700; font-size: 13px; padding: 5px 10px; border-radius: 999px; pointer-events: none; }
/* signal banner */
.signal { border-radius: var(--radius); padding: 12px 14px; background: var(--surface-1); border: 1px solid var(--border); display: grid; gap: 4px; animation: signal-in .35s ease; transition: background .3s, border-color .3s; }
.signal-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.signal-verdict { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; padding: 5px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-secondary); }
.signal-text { font-size: 15px; font-weight: 600; }
.signal-sub { font-size: 12px; color: var(--text-muted); }
.signal[data-verdict="hold"] { border-color: rgba(39,168,90,0.5); background: linear-gradient(90deg, var(--up-soft), var(--surface-1) 70%); }
.signal[data-verdict="hold"] .signal-verdict { background: var(--up); color: #fff; }
.signal[data-verdict="edge"] { border-color: rgba(250,178,25,0.5); background: linear-gradient(90deg, var(--warning-soft), var(--surface-1) 70%); }
.signal[data-verdict="edge"] .signal-verdict { background: var(--warning); color: #1a1200; }
.signal[data-verdict="sell"] { border-color: var(--down); background: linear-gradient(90deg, var(--down-soft), var(--surface-1) 70%); animation: signal-in .35s ease, sell-pulse 1.2s ease-in-out infinite; }
.signal[data-verdict="sell"] .signal-verdict { background: var(--down); color: #fff; }
.signal.flash { animation: signal-in .35s ease; }
@keyframes signal-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sell-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } 50% { box-shadow: 0 0 0 6px rgba(229,72,77,0.25); } }
/* results grid */
.results-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.results-grid span { position: relative; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--text-muted); }
.results-grid span.up { background: var(--up-soft); color: var(--up); } .results-grid span.down { background: var(--down-soft); color: var(--down); }
.results-grid span.pending { border: 1px dashed var(--border-strong); }
.results-grid i { position: absolute; right: -2px; top: -2px; width: 13px; height: 13px; border-radius: 50%; font-style: normal; font-size: 8px; font-weight: 800; display: grid; place-items: center; background: #fff; border: 1px solid var(--surface-1); }
.results-grid i.correct { color: var(--up); } .results-grid i.wrong { color: var(--down); }
.results-grid b { position: absolute; left: -2px; bottom: -2px; width: 8px; height: 8px; transform: rotate(45deg); background: var(--accent); border-radius: 1px; }
.results-foot { display: flex; justify-content: space-between; align-items: center; }
.wallet-line { font-size: 13px; padding: 0 2px; }
/* wallet (sheet) */
.wallet { display: grid; gap: 10px; }
.wallet-bal { display: flex; align-items: baseline; gap: 14px; }
.wallet-bal .big { font-size: 28px; }
.wallet-addr { display: flex; gap: 8px; align-items: center; }
.wallet-addr code { flex: 1; font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-qr { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 10px; width: 180px; margin: 0 auto; }
.wallet-qr svg { width: 160px; height: 160px; }
.wallet-steps { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 13px; display: grid; gap: 4px; }
.warn-box { background: var(--down-soft); border: 1px solid rgba(229,72,77,0.4); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.results-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.results { display: flex; gap: 6px; }
.results span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 700; }
.results span.up { background: var(--up-soft); color: var(--up); } .results span.down { background: var(--down-soft); color: var(--down); }
.results span.pending { background: var(--surface-2); color: var(--text-muted); border: 1px dashed var(--border-strong); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { padding: 6px 14px; border-radius: 9px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-strong); }
.seg button[data-mode="live"][aria-pressed="true"] { color: #ffd37a; background: rgba(250,178,25,0.18); box-shadow: inset 0 0 0 1px rgba(250,178,25,0.5); }
.seg[aria-busy="true"] { opacity: 0.6; pointer-events: none; }
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.seg.big { width: 100%; padding: 4px; border-radius: 16px; }
.seg.big button { flex: 1; padding: 14px 10px; font-size: 15px; border-radius: 12px; }
.call-line { font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 2px; }
.call-line .dir { font-weight: 700; } .call-line .dir.up { color: var(--up); } .call-line .dir.down { color: var(--down); }
.guide-strip { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-1); border: 1px solid var(--border); font-size: 13px; color: var(--text-primary); }
.guide-strip .chev { margin-left: auto; color: var(--text-muted); font-size: 18px; }
.tag.verdict-pause { background: var(--down-soft); color: var(--down); }
.tag.verdict-insufficient_data { background: var(--surface-3); color: var(--text-secondary); }
.tag.verdict-stay_paper { background: var(--accent-soft); color: #8dbdf5; }
.tag.verdict-promising { background: var(--up-soft); color: var(--up); }
.tag.verdict-go_live_candidate { background: var(--warning-soft); color: #ffd37a; }

/* ---------------------------------------------------------------- calls tab */
.filters { display: inline-flex; gap: 4px; }
.filters button { padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.filters button[aria-pressed="true"] { background: var(--surface-3); color: var(--text-primary); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 8px 2px 12px; scroll-behavior: smooth; }
.strip::-webkit-scrollbar { height: 6px; } .strip::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
.cell { flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.circle { position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; font-weight: 700; line-height: 1; background: var(--surface-3); color: var(--text-muted); border: 2px solid var(--border-strong); }
.circle.up { background: var(--up); border-color: var(--up); color: #fff; box-shadow: 0 0 14px rgba(39,168,90,0.4); }
.circle.down { background: var(--down); border-color: var(--down); color: #fff; box-shadow: 0 0 14px rgba(229,72,77,0.4); }
.circle.pending { border-style: dashed; animation: pulse 1.6s ease-in-out infinite; }
.badge { position: absolute; right: -5px; top: -5px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; border: 2px solid var(--surface-1); }
.badge.correct { background: #fff; color: var(--up); } .badge.wrong { background: #fff; color: var(--down); } .badge.pending { background: var(--surface-3); color: var(--text-secondary); }
.diamond { position: absolute; left: -4px; bottom: -4px; width: 16px; height: 16px; transform: rotate(45deg); background: var(--accent); border: 2px solid var(--surface-1); border-radius: 3px; }
.cell-time { font-size: 12px; color: var(--text-secondary); }
.cell-delta { font-size: 11px; color: var(--text-muted); } .cell-delta.up { color: var(--up); } .cell-delta.down { color: var(--down); }
.strip-empty { width: 100%; text-align: center; color: var(--text-muted); padding: 28px 0; font-size: 13px; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } 50% { box-shadow: 0 0 0 6px rgba(255,255,255,0.06); } }
.call { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.call-dir { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 700; background: var(--surface-2); border: 2px solid var(--border-strong); color: var(--text-muted); }
.call-dir.up { color: var(--up); border-color: var(--up); background: var(--up-soft); } .call-dir.down { color: var(--down); border-color: var(--down); background: var(--down-soft); }
.call-main { font-size: 18px; font-weight: 600; }
.call-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin-top: 8px; font-size: 13px; color: var(--text-secondary); }
.call-grid b { color: var(--text-primary); font-weight: 600; }
.table-wrap { overflow-x: auto; } .table-wrap.collapsed { display: none; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
td.r, th.r { text-align: right; } tr:last-child td { border-bottom: 0; }
.dir { font-weight: 600; } .dir.up { color: var(--up); } .dir.down { color: var(--down); }
.pnl.up { color: var(--up); } .pnl.down { color: var(--down); }
.table-empty { color: var(--text-muted); text-align: center; padding: 24px; font-size: 13px; }

/* ---------------------------------------------------------------- stats tab */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { padding: 14px 16px; }
.kpi-value { font-size: 26px; font-weight: 600; margin-top: 4px; line-height: 1.1; }
.kpi-value.up { color: var(--up); } .kpi-value.down { color: var(--down); }
.kpi-detail { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.tabs-inline { display: inline-flex; gap: 4px; }
.tabs-inline button { padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.tabs-inline button[aria-pressed="true"] { background: var(--surface-3); color: var(--text-primary); }
.chart-wrap { position: relative; height: 240px; }
.chart-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-wrap .grid line { stroke: var(--border); stroke-width: 1; }
.chart-wrap .axis text { fill: var(--text-muted); font-size: 11px; }
.chart-wrap .zero { stroke: var(--border-strong); }
.chart-wrap path.line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart-wrap path.area { fill: var(--accent-soft); }
.chart-wrap .pt { fill: var(--accent); stroke: var(--surface-1); stroke-width: 2; }
.chart-wrap .crosshair { stroke: var(--border-strong); stroke-width: 1; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font-size: 13px; text-align: center; padding: 20px; }

/* ---------------------------------------------------------------- bot tab */
.control { display: grid; gap: 14px; }
.control-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.control-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ctl-value { font-size: 20px; font-weight: 600; margin-top: 2px; }
.ctl-value.up { color: var(--up); } .ctl-value.down { color: var(--down); }
.advisor { border-left: 3px solid var(--accent); }
.advisor.pause { border-left-color: var(--down); } .advisor.insufficient_data { border-left-color: var(--text-muted); }
.advisor.promising { border-left-color: var(--up); } .advisor.go_live_candidate { border-left-color: var(--warning); }
.adv-head { font-size: 17px; font-weight: 600; line-height: 1.3; }
.adv-reasons { margin: 10px 0 0; padding-left: 18px; color: var(--text-secondary); font-size: 13px; display: grid; gap: 4px; }
.adv-action { margin-top: 10px; font-size: 13px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.adv-action:empty { display: none; }

/* ---------------------------------------------------------------- tooltip, modal, auth */
.tooltip { position: fixed; z-index: 50; pointer-events: none; display: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--text-secondary); box-shadow: 0 8px 24px rgba(0,0,0,0.35); min-width: 150px; }
.tooltip b { color: var(--text-primary); font-weight: 600; } .tooltip .row { display: flex; justify-content: space-between; gap: 14px; } .tooltip.show { display: block; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; place-items: end center; z-index: 100; padding: 0; }
.modal-backdrop.show { display: grid; }
.modal { width: 100%; max-width: var(--col); background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 18px 18px 0 0; padding: 20px 20px calc(20px + var(--sab)); }
.modal h2 { margin: 0 0 8px; font-size: 17px; } .modal p { margin: 0 0 12px; color: var(--text-secondary); font-size: 13px; }
.modal input, .auth-card input, #inviteOut input { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-primary); font: inherit; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal .err { color: var(--down); font-size: 12px; margin-top: 8px; min-height: 16px; }
.sheet { max-height: 88vh; overflow: auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.sheet h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); margin: 18px 0 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.list li .link { flex: none; }
#inviteOut input { margin-top: 10px; font-size: 12px; }
.auth-gate { position: fixed; inset: 0; z-index: 200; background: var(--surface-0); display: none; place-items: center; padding: 20px; overflow: auto; }
.auth-gate.show { display: grid; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 26px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 18px; font-size: 16px; }
.auth-card h1 { font-size: 20px; margin: 0 0 6px; }
.auth-card label { display: block; font-size: 12px; color: var(--text-secondary); margin: 12px 0 6px; }
.auth-card label input { margin-top: 6px; }
.auth-links { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.auth-msg { display: none; margin-bottom: 12px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.auth-msg.show { display: block; }
.auth-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.recovery-code { font-family: var(--mono); font-size: 20px; letter-spacing: 0.06em; padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); text-align: center; margin: 14px 0; user-select: all; }
.skeleton { position: relative; color: transparent !important; }
.skeleton::after { content: ""; position: absolute; inset: 0; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@media (min-width: 761px) {
  .big { font-size: 36px; }
  .live-chart { height: 340px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .control-stats { grid-template-columns: repeat(4, 1fr); }
  .modal-backdrop { place-items: center; padding: 20px; }
  .modal { border-radius: 16px; max-width: 520px; padding-bottom: 20px; }
}

/* funding */
.fund-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.fund-step { padding: 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--text-muted); text-align: center; }
.fund-step.done { border-color: var(--up); color: var(--up); }
.fund-step.active { border-color: var(--warning); color: #ffd37a; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong); font-size: 13px; font-weight: 600; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.fund-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fund-row > * { min-width: 0; }
.fund-row input { flex: 1 1 140px; width: auto; }
.fund-row .btn { flex: 0 0 auto; }
.wallet-addr { min-width: 0; }
.wallet-addr code { min-width: 0; }
.sheet { max-width: 100%; }
.fund-row select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-primary); font: inherit; }
.tx-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.tx-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); align-items: center; }
.tx-list .st { padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-secondary); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.tx-list .st.applied { background: var(--up-soft); color: var(--up); } .tx-list .st.failed, .tx-list .st.returned { background: var(--down-soft); color: var(--down); }
.tx-list .st.pending, .tx-list .st.confirmed { background: var(--warning-soft); color: #ffd37a; }
.wallet-line.pending { color: #ffd37a; }
