:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --text: #16191d;
  --muted: #69717d;
  --accent: #2962ff;
  --accent-text: #ffffff;
  --up: #089981;
  --down: #e23c4b;
  --up-soft: rgba(8, 153, 129, 0.12);
  --down-soft: rgba(226, 60, 75, 0.12);
  --warn: #b7791f;
  --warn-soft: rgba(183, 121, 31, 0.12);
  --grid: #eceff2;
  --ema-fast: #f59f00;
  --ema-mid: #7048e8;
  --ema-slow: #1c7ed6;
  --bb: rgba(105, 113, 125, 0.55);
  --vwap: #d6336c;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #151a22;
    --surface-2: #1c222c;
    --border: #2a313c;
    --text: #e6e9ee;
    --muted: #8b94a3;
    --accent: #3d7bff;
    --up: #26a69a;
    --down: #ef5350;
    --up-soft: rgba(38, 166, 154, 0.16);
    --down-soft: rgba(239, 83, 80, 0.16);
    --warn: #e0a83a;
    --warn-soft: rgba(224, 168, 58, 0.14);
    --grid: #1b212a;
    --bb: rgba(139, 148, 163, 0.5);
    --vwap: #f06595;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #151a22;
  --surface-2: #1c222c;
  --border: #2a313c;
  --text: #e6e9ee;
  --muted: #8b94a3;
  --accent: #3d7bff;
  --up: #26a69a;
  --down: #ef5350;
  --up-soft: rgba(38, 166, 154, 0.16);
  --down-soft: rgba(239, 83, 80, 0.16);
  --warn: #e0a83a;
  --warn-soft: rgba(224, 168, 58, 0.14);
  --grid: #1b212a;
  --bb: rgba(139, 148, 163, 0.5);
  --vwap: #f06595;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--up); }
.down { color: var(--down); }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--accent); }
.brand span { color: var(--text); }
.controls { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; flex: 1; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 500; }
.field input, .field select {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 9px; min-width: 0;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#symbol { width: 170px; text-transform: uppercase; }
.btn {
  font: inherit; font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 7px; cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.block { width: 100%; margin-top: 8px; }
.btn.sm { padding: 3px 9px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
#liveBtn[aria-pressed="true"] { background: var(--up-soft); color: var(--up); border-color: var(--up); }
.icon-btn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 7px; padding: 6px; cursor: pointer; display: grid; place-items: center; }
.status { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.live { color: var(--up); } .pill.live .dot { background: var(--up); animation: pulse 1.6s infinite; }
.pill.warn { color: var(--warn); } .pill.warn .dot { background: var(--warn); animation: pulse .8s infinite; }
.pill.error { color: var(--down); } .pill.error .dot { background: var(--down); }
@keyframes pulse { 50% { opacity: .35; } }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; align-content: start; gap: 12px; padding: 12px; flex: 1; min-height: 0; }
.charts { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 10px 6px; position: relative; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow); }
.chart-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding: 0 4px 8px; }
.legend { font-size: 11.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.legend b { color: var(--text); font-weight: 500; }
.chart { width: 100%; }
/* Fixed, viewport-relative height: a flex-grown chart would chase the sidebar's height and loop the resize observer. */
.main-chart { height: clamp(340px, 52vh, 640px); flex: none; }
.charts { align-self: start; }
.sub-chart { height: 110px; }
.pane-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text); font-weight: 600; padding: 6px 4px 2px; border-top: 1px solid var(--border); margin-top: 4px; }
.pane-label .muted { font-weight: 500; }
.overlay { position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 82%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 5; border-radius: var(--radius); font-weight: 500; }
.overlay[hidden] { display: none; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Sidebar */
.sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; box-shadow: var(--shadow); max-height: calc(100vh - 110px); position: sticky; top: 70px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 4px; overflow-x: auto; scrollbar-width: none; }
.tab { flex: 1 0 auto; background: none; border: 0; padding: 11px 7px; font: inherit; font-weight: 600; font-size: 12.5px; white-space: nowrap; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel { display: none; padding: 14px; overflow-y: auto; }
.panel.active { display: block; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); margin-bottom: 12px; }
.card-title { margin: 0 0 4px; font-size: 14px; }
.callout { font-size: 12.5px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); margin-top: 10px; line-height: 1.5; }
.callout.good { background: var(--up-soft); }
.callout.bad { background: var(--down-soft); }
.callout.warn { background: var(--warn-soft); }

/* Tone colors: green = bullish, red = bearish, amber = caution, grey = neutral */
.t-bull { color: var(--up); }
.t-bear { color: var(--down); }
.t-warn { color: var(--warn); }
.t-neutral { color: var(--muted); }

/* Summary card */
.hero {
  grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow); border-left: 5px solid var(--muted);
}
.hero.bull { border-left-color: var(--up); }
.hero.bear { border-left-color: var(--down); }
.hero.warn { border-left-color: var(--warn); }
.hero-verdict { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ring { position: relative; width: 76px; height: 76px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.2; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--muted); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .5s, stroke .3s; }
.ring-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.ring-num b { font-size: 22px; font-weight: 700; font-family: "JetBrains Mono", monospace; }
.ring-num span { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.verdict { font-size: 30px; font-weight: 800; letter-spacing: .02em; line-height: 1.05; color: var(--muted); white-space: nowrap; }
.verdict-action { font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 260px; }
.hero-body { min-width: 0; }
.ticker { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ticker strong { font-size: 15px; }
#tickerPrice { font-size: 15px; font-weight: 500; }
.chg { font-size: 13px; }
.hero-summary { font-size: 17px; font-weight: 600; line-height: 1.4; margin: 6px 0 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: flex; flex-direction: column; gap: 1px; padding: 6px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); min-width: 110px; }
.chip .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.chip .v { font-size: 13.5px; font-weight: 700; }

/* Grouped sections inside the sidebar */
.group { margin-bottom: 20px; }
.group:last-child { margin-bottom: 4px; }
.group-title { display: flex; align-items: center; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.group-title .small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.box { background: var(--surface-2); border-radius: 10px; padding: 12px; }
.lead { font-size: 13px; line-height: 1.5; margin: 0 0 10px; }

/* Trade plan */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px; letter-spacing: .03em; background: var(--surface-2); color: var(--muted); }
.tag.bull { background: var(--up-soft); color: var(--up); }
.tag.bear { background: var(--down-soft); color: var(--down); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.levels { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.level { display: grid; grid-template-columns: 74px 1fr auto; gap: 4px 10px; align-items: baseline; padding: 8px 12px; border-top: 1px solid var(--border); }
.level:first-child { border-top: 0; }
.level .name { font-size: 12px; font-weight: 700; }
.level .price { font-family: "JetBrains Mono", monospace; font-size: 13.5px; font-weight: 500; text-align: right; grid-column: 3; }
.level .note { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
.level.entry { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.level.stop .name, .level.stop .price { color: var(--down); }
.level.target .name, .level.target .price { color: var(--up); }
.plan-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.mini-stat { background: var(--surface-2); border-radius: 8px; padding: 7px 9px; }
.mini-stat .k { font-size: 10.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.mini-stat .v { font-family: "JetBrains Mono", monospace; font-size: 13.5px; font-weight: 500; }

/* Confidence */
.meter { position: relative; height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 2px 0 6px; }
.meter-fill { height: 100%; width: 0; background: var(--muted); border-radius: 99px; }
.meter-threshold { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: .55; }
.meter-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.factors { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 2px; }
.factors li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: start; font-size: 12.5px; padding: 5px 0; border-top: 1px dashed var(--border); }
.factors li:first-child { border-top: 0; }
.factors .ic { font-weight: 700; text-align: center; }
.factors .w { font-family: "JetBrains Mono", monospace; font-size: 11.5px; white-space: nowrap; }
.factors .d { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.factors li.pass .ic, .factors li.pass .w { color: var(--up); }
.factors li.fail { color: var(--muted); }
.factors li.fail .lbl { color: var(--text); opacity: .7; }
.factors li.pen .ic, .factors li.pen .w { color: var(--down); }
.gate { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); margin-top: 10px; }
.gate.ok { background: var(--up-soft); }

/* Warnings */
.warn-list { display: flex; flex-direction: column; gap: 8px; }
.warn-item { border-radius: 8px; padding: 9px 12px; font-size: 12.5px; line-height: 1.45; border-left: 3px solid var(--muted); background: var(--surface-2); }
.warn-item b { display: block; font-size: 13px; margin-bottom: 1px; }
.warn-item.lvl-high { border-left-color: var(--down); background: var(--down-soft); }
.warn-item.lvl-medium { border-left-color: var(--warn); background: var(--warn-soft); }
.warn-item.lvl-info { border-left-color: var(--accent); }
.all-clear { font-size: 12.5px; padding: 9px 12px; border-radius: 8px; background: var(--up-soft); }

/* Market state rows */
.mrow { padding: 10px 12px; border-top: 1px solid var(--border); }
.mrow:first-child { border-top: 0; }
.mrow-top { display: flex; align-items: center; gap: 6px; }
.mrow-top .name { font-weight: 600; font-size: 13px; }
.mrow-top .val { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: 13px; }
.mrow-sub { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.mcard { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.mcard-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 12px; background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; }

/* Market bias: diverging gauge (red ← 0 → green) and per-family bars */
.gauge { position: relative; height: 12px; border-radius: 99px; margin: 6px 0 4px;
  background: linear-gradient(90deg, var(--down) 0%, var(--down-soft) 40%, var(--surface-2) 50%, var(--up-soft) 60%, var(--up) 100%); }
.gauge-mark { position: absolute; top: -4px; width: 4px; height: 20px; border-radius: 2px; background: var(--text); transform: translateX(-50%); box-shadow: 0 0 0 2px var(--surface); }
.gauge-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }
.bias-head { display: flex; align-items: baseline; gap: 8px; }
.bias-head .big { font-size: 22px; font-weight: 800; font-family: "JetBrains Mono", monospace; }
.fam { display: grid; grid-template-columns: 1fr 90px 38px; gap: 4px 10px; align-items: center; padding: 7px 0; border-top: 1px dashed var(--border); }
.fam:first-of-type { border-top: 0; }
.fam .fname { font-size: 12.5px; font-weight: 600; }
.fam .fname span { font-weight: 400; color: var(--muted); font-size: 11px; }
.fam .fbar { position: relative; height: 8px; background: var(--surface-2); border-radius: 99px; }
.fam .fbar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); opacity: .6; }
.fam .ffill { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.fam .fval { font-family: "JetBrains Mono", monospace; font-size: 12px; text-align: right; }
.fam .ftext { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
.stat-note { font-size: 12px; line-height: 1.5; padding: 9px 11px; border-radius: 8px; background: var(--surface-2); margin-top: 10px; }
.stat-note.sig { background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Structure & levels */
.swing-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.swing { font: 700 11px/1 "JetBrains Mono", monospace; padding: 4px 6px; border-radius: 4px; background: var(--surface-2); }
.swing.HH, .swing.HL { color: var(--up); background: var(--up-soft); }
.swing.LH, .swing.LL { color: var(--down); background: var(--down-soft); }
.swing-arrow { color: var(--muted); font-size: 11px; align-self: center; }
.ladder { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.rung { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 6px 12px; font-size: 12px; border-top: 1px solid var(--border); }
.rung:first-child { border-top: 0; }
.rung .rp { font-family: "JetBrains Mono", monospace; }
.rung.golden { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.rung.now { background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12.5px; margin-top: 8px; }
.kv .k { color: var(--muted); display: flex; align-items: center; gap: 4px; }
.kv .v { font-family: "JetBrains Mono", monospace; text-align: right; }
.sub-title { font-size: 12px; font-weight: 700; margin: 14px 0 4px; display: flex; align-items: center; gap: 6px; }
.confl { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.confl span { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.inval { font-size: 12px; line-height: 1.5; margin-top: 10px; padding: 9px 11px; border-radius: 8px; border-left: 3px solid var(--down); background: var(--down-soft); }

/* Term explanations */
.info {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; padding: 0; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: italic 700 10px/1 Georgia, serif; cursor: help;
}
.info:hover, .info:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.tooltip {
  position: fixed; z-index: 100; max-width: 280px; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.45;
  background: var(--text); color: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: none;
}
.tooltip b { display: block; margin-bottom: 2px; }

/* Theme toggle */
.theme-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px 5px 10px; cursor: pointer; }
.theme-btn:hover { border-color: var(--accent); }
.theme-btn[data-mode="dark"] .i-sun, .theme-btn[data-mode="light"] .i-moon { display: none; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.stat .k { font-size: 11px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.stat .v { font-size: 16px; font-weight: 500; font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .sub { font-size: 11px; color: var(--muted); }

.equity-chart { height: 160px; }
.table-wrap { overflow: auto; max-height: 240px; border: 1px solid var(--border); border-radius: 8px; }
.table-wrap.tall { max-height: 360px; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; color: var(--muted); padding: 6px 8px; font-size: 11px; }
.table td { padding: 5px 8px; border-top: 1px solid var(--border); font-family: "JetBrains Mono", monospace; white-space: nowrap; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table .empty td { text-align: center; color: var(--muted); font-family: inherit; cursor: default; padding: 14px; }

/* Coins watchlist */
.watch-add { display: flex; gap: 8px; }
.watch-add input {
  flex: 1; min-width: 0; font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; text-transform: uppercase;
}
.watch-add input::placeholder { text-transform: none; color: var(--muted); }
.watch-add input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.watch-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 0 8px; }
.watch-table td { vertical-align: middle; }
.watch-table tr.active { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.watch-table .coin { font-family: Inter, system-ui, sans-serif; }
.watch-table .coin b { font-weight: 600; }
.watch-table .quote { color: var(--muted); font-size: 11px; }
.watch-table .sub { font-size: 10.5px; font-family: Inter, system-ui, sans-serif; }
.mini { display: inline-block; font-family: Inter, system-ui, sans-serif; font-weight: 700; font-size: 10.5px; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.mini.long { background: var(--up-soft); color: var(--up); }
.mini.short { background: var(--down-soft); color: var(--down); }
.mini.watch { background: var(--warn-soft); color: var(--warn); }
.mini.live { outline: 1px solid currentColor; }
.remove-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.remove-btn:hover { color: var(--down); background: var(--down-soft); }

/* Token search */
.search { position: relative; }
.search-ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 28px !important; }
.search input::placeholder { text-transform: none; }
.search-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.25); overflow: hidden;
}
.quote-chips { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border); }
.quote-chips button { font: 600 11.5px/1 Inter, sans-serif; padding: 5px 9px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; }
.quote-chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
#symbolList { list-style: none; margin: 0; padding: 4px; max-height: 340px; overflow-y: auto; }
#symbolList li { display: grid; grid-template-columns: 1fr auto auto 22px; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--text); }
#symbolList li[aria-selected="true"], #symbolList li:hover { background: var(--surface-2); }
#symbolList .base { font-weight: 700; }
#symbolList .q { color: var(--muted); font-size: 11px; margin-left: 2px; }
#symbolList .vol { display: block; color: var(--muted); font-size: 10.5px; font-weight: 500; }
#symbolList .px { font-family: "JetBrains Mono", monospace; text-align: right; }
#symbolList .ch { font-family: "JetBrains Mono", monospace; font-size: 11.5px; text-align: right; min-width: 58px; }
#symbolList .star { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 14px; padding: 0; }
#symbolList .star.on { color: var(--warn); }
#symbolList .empty { display: block; color: var(--muted); cursor: default; text-align: center; }
.search-foot { padding: 6px 10px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }

/* Claude AI analyst */
.ai-actions { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ai-effort { margin-left: auto; }
.ai-key { display: flex; gap: 6px; margin-top: 6px; }
.ai-key input { flex: 1; min-width: 0; font: inherit; font-size: 12.5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; font-family: "JetBrains Mono", monospace; }
.ai-thinking { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 9px 11px; margin: 4px 0 12px; max-height: 120px; overflow-y: auto; white-space: pre-wrap; line-height: 1.45; }
.ai-thinking::before { content: "Claude is thinking… "; font-weight: 700; color: var(--accent); }
.ai-out { font-size: 13px; line-height: 1.55; }
.ai-out h4 { font-size: 13.5px; margin: 16px 0 4px; color: var(--accent); }
.ai-out h4:first-child { margin-top: 4px; }
.ai-out p { margin: 4px 0; }
.ai-out ul, .ai-out ol { margin: 4px 0; padding-left: 18px; }
.ai-out li { margin: 2px 0; }
.ai-out code { font-family: "JetBrains Mono", monospace; font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.ai-out.streaming::after { content: "▍"; color: var(--accent); animation: pulse 1s infinite; }
.ai-plan { border: 1px solid var(--accent); border-radius: 10px; padding: 12px; margin: 14px 0 10px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ai-plan-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ai-plan .kv { margin-top: 4px; }

/* Win rate vs profit */
.wr-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.wr-table th, .wr-table td { padding: 5px 6px; text-align: right; border-top: 1px solid var(--border); font-family: "JetBrains Mono", monospace; }
.wr-table th { font-family: Inter, sans-serif; font-size: 11px; color: var(--muted); font-weight: 600; }
.wr-table th:first-child, .wr-table td:first-child { text-align: left; }
.wr-table tr.cur td { background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 700; }

/* Multi-timeframe table */
.mtf-table { font-size: 11.5px; }
.mtf-table th, .mtf-table td { padding: 5px 5px; }
.mtf-table td { vertical-align: middle; white-space: nowrap; }
.mtf-table tr.active { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.mtf-table .tf { font-weight: 700; font-family: Inter, system-ui, sans-serif; }
.mtf-table .sub { display: block; font-size: 10.5px; color: var(--muted); font-family: Inter, system-ui, sans-serif; }
.mtf-table .star { color: var(--warn); }
.align-bar { display: flex; height: 26px; border-radius: 6px; overflow: hidden; gap: 2px; margin: 8px 0 6px; }
.align-bar > span { flex: 1; display: grid; place-items: center; font: 700 10.5px/1 "JetBrains Mono", monospace; color: #fff; }
.prob-big { font-size: 26px; font-weight: 800; font-family: "JetBrains Mono", monospace; white-space: nowrap; }
.calib { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 6px; }
.calib th, .calib td { padding: 4px 6px; text-align: right; border-top: 1px solid var(--border); }
.calib th:first-child, .calib td:first-child { text-align: left; }

/* Settings */
.settings .range { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; }
.settings .range span { display: flex; justify-content: space-between; }
.settings output { font-family: "JetBrains Mono", monospace; color: var(--accent); font-weight: 500; }
.settings input[type="range"] { width: 100%; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.check-row { display: flex; gap: 18px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.two-col input, .three-col input { width: 100%; }

.disclaimer { font-size: 11.5px; color: var(--muted); text-align: center; padding: 4px 16px 14px; }

.toast-stack { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: calc(100vw - 32px); }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.18); font-size: 13px; width: 320px; max-width: 100%; animation: slide .25s ease-out; }
.toast.long { border-left-color: var(--up); }
.toast.short { border-left-color: var(--down); }
.toast.error { border-left-color: var(--down); }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; }
}
@media (max-width: 820px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px 16px; }
  .hero-summary { font-size: 15.5px; }
  .chip { min-width: 0; flex: 1 1 40%; }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .verdict { font-size: 26px; }
  .ring { width: 64px; height: 64px; }
  .plan-stats { grid-template-columns: repeat(2, 1fr); }
  .layout { padding: 10px 16px; }
  .controls { gap: 8px; order: 3; flex-basis: 100%; }
  .controls .field { flex: 1 1 40%; }
  .controls .btn { flex: 1 1 40%; }
  #symbol { width: 100%; }
  .status { margin-left: 0; }
  .main-chart { min-height: 300px; }
  .tab { font-size: 12px; }
}
