/* QuantBot UI. Colors are role tokens; light and dark are each chosen explicitly. */
:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-text: #ffffff;
  --up: #2a78d6;
  --down: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-text: #006300;
  --bad-text: #c42e2e;
  --warn-bg: #fff6e0;
  --crit-bg: #fdecec;
  --info-bg: #eaf2fc;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --up: #3987e5;
    --down: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --good-text: #0ca30c;
    --bad-text: #e66767;
    --warn-bg: #2e2612;
    --crit-bg: #331818;
    --info-bg: #15243a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --up: #3987e5;
  --down: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --good-text: #0ca30c;
  --bad-text: #e66767;
  --warn-bg: #2e2612;
  --crit-bg: #331818;
  --info-bg: #15243a;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 8px; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.secondary { color: var(--text-2); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--good-text); }
.neg { color: var(--bad-text); }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.shell > * { min-width: 0; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 0 10px 18px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--surface-2); color: var(--text); }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 10px; }
.main { padding: 28px 32px 64px; min-width: 0; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.topbar { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
  }
  .main { padding: 20px 16px 48px; }
}

/* ---------- cards & tiles ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
.card.tight { padding: 14px 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.tile .label { color: var(--text-2); font-size: 12px; }
.tile .value { font-size: 22px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .delta { font-size: 12px; margin-top: 2px; }
.hero { display: flex; gap: 32px; align-items: flex-end; flex-wrap: wrap; }
.hero .value { font-size: 44px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.hero .label { color: var(--text-2); }

/* ---------- banners ---------- */
.banner { border-radius: 10px; padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); }
.banner svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.banner.warn { background: var(--warn-bg); }
.banner.warn svg { color: var(--warning); }
.banner.crit { background: var(--crit-bg); }
.banner.crit svg { color: var(--critical); }
.banner.info { background: var(--info-bg); }
.banner.info svg { color: var(--accent); }
.banner .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; line-height: 20px;
  padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.good .dot { background: var(--good); }
.badge.warning .dot { background: var(--warning); }
.badge.critical .dot { background: var(--critical); }
.badge.live { background: var(--crit-bg); color: var(--bad-text); font-weight: 600; }
.badge.testnet { background: var(--info-bg); color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 14px var(--font); padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--critical); border-color: transparent; color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wrap { white-space: normal; text-align: left; line-height: 1.35; }
.btn svg { width: 16px; height: 16px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .flabel { font-size: 13px; font-weight: 500; color: var(--text); }
.field .help { font-size: 12px; color: var(--muted); }
input, select, textarea {
  font: 14px var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 2px; flex: none; }
.check .help { font-size: 12px; color: var(--muted); margin-top: 2px; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px 16px; margin: 0; min-width: 0; }
legend { font-weight: 600; padding: 0 6px; }
details.adv > summary { cursor: pointer; color: var(--text-2); font-weight: 500; padding: 4px 0; }
details.adv[open] > summary { margin-bottom: 12px; }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 10px; }
.choice {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer;
  background: var(--surface); text-align: left; font: inherit; color: inherit;
}
.choice:hover { border-color: var(--axis); }
.choice.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice .t { font-weight: 600; margin-bottom: 4px; }
.choice .d { color: var(--text-2); font-size: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.current td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.empty { text-align: center; padding: 32px 16px; color: var(--text-2); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); margin-bottom: 14px; overflow-x: auto; }
.tabs button {
  font: 500 13px var(--font); background: none; border: 0; color: var(--text-2);
  padding: 8px 12px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- events ---------- */
.events { list-style: none; padding: 0; margin: 0; }
.events li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.events li:last-child { border-bottom: 0; }
.events .when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 92px; }
.events .lvl { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--muted); }
.events .lvl.trade { background: var(--accent); }
.events .lvl.warning { background: var(--warning); }
.events .lvl.error { background: var(--critical); }
.events .msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; user-select: none; }
.chart svg { display: block; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; pointer-events: none; shape-rendering: crispEdges; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.chart-legend .key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; vertical-align: middle; margin-right: 6px; }
.chart-legend .key.box { width: 10px; height: 10px; border-radius: 2px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12); padding: 8px 10px; font-size: 12px; min-width: 140px;
}
.tooltip .tt-head { color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tooltip .tt-row b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.tooltip .tt-row span { color: var(--text-2); }
.tooltip .tt-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.chart-empty { display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--grid); border-radius: 10px; }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; border: 1px solid var(--border); max-width: 480px; width: 100%; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal h2 { margin-bottom: 8px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.error { background: var(--critical); color: #fff; }

/* ---------- misc ---------- */
.spinner { width: 18px; height: 18px; border: 2px solid var(--grid); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }
.kv { display: grid; grid-template-columns: fit-content(70%) 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.signal { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.signal .arrow { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before {
  content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-2); display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.verdict { font-size: 15px; line-height: 1.6; }
.verdict li { margin-bottom: 4px; }
@media (max-width: 600px) {
  .hero .value { font-size: 34px; }
  .card { padding: 16px; }
}

/* ---------- insights: meters, scales, compact lists ---------- */
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; min-width: 60px; }
.meter > span { position: absolute; top: 0; bottom: 0; left: 0; background: var(--accent); border-radius: 4px; }
.meter.down > span { background: var(--down); }
.meter.muted > span { background: var(--muted); }
.scale { position: relative; height: 26px; margin: 6px 0 2px; }
.scale .track { position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 2px; background: var(--surface-2); }
.scale .zone { position: absolute; top: 9px; height: 8px; border-radius: 2px; background: var(--info-bg); border: 1px solid var(--border); }
.scale .tick { position: absolute; top: 5px; width: 1px; height: 16px; background: var(--axis); }
.scale .marker { position: absolute; top: 4px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.scale-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wlist { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(70px, 1fr) auto auto; gap: 8px 12px; align-items: center; font-size: 13px; }
.wlist .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wlist .val { text-align: right; font-variant-numeric: tabular-nums; }
.notes { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.notes li { color: var(--text-2); }
.section-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 0 0 8px; text-transform: none; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.stat .label { font-size: 11px; color: var(--text-2); }
.stat .value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.choice:disabled { cursor: not-allowed; }

/* ---------- strategy help & evidence ---------- */
.choice-wrap { position: relative; min-width: 0; display: grid; }
.choice-wrap > .choice { padding-right: 40px; }
.help-btn {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  font: 600 13px/1 var(--font); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.help-btn:hover { color: var(--text); border-color: var(--axis); }
.help-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.help-btn.inline { position: static; display: inline-grid; width: 22px; height: 22px; font-size: 12px; vertical-align: middle; margin-left: 6px; }
.choice .ev { font-size: 12px; margin-top: 8px; color: var(--text-2); display: flex; gap: 6px; align-items: baseline; }
.choice .ev::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 2px; background: var(--muted); transform: translateY(-1px); }
.choice .ev.good::before { background: var(--good); }
.choice .ev.mixed::before { background: var(--warning); }
.choice .ev.bad { color: var(--bad-text); }
.choice .ev.bad::before { background: var(--critical); }
.modal.wide { max-width: 680px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-body { max-height: min(70vh, 720px); overflow-y: auto; padding-right: 4px; }
.help-body h3 { font-size: 13px; margin: 0 0 4px; }
.help-body p { margin: 0; }
.help-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.plist { margin: 0; display: grid; gap: 2px 0; font-size: 13px; }
.plist dt { font-weight: 600; margin-top: 6px; }
.plist dd { margin: 0; color: var(--text-2); }

/* ---------- estimate panel ---------- */
.est-range { position: relative; padding: 14px 0 44px; margin: 4px 8px 0; }
.est-track { position: relative; height: 10px; border-radius: 5px; background: var(--surface-2); }
.est-zone { position: absolute; top: 0; bottom: 0; }
.est-zone.pos { background: var(--accent); opacity: .55; }
.est-zone.neg { background: var(--critical); opacity: .45; }
.est-zero { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--text-2); }
.est-mid { position: absolute; top: -5px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.est-labels { position: absolute; left: 0; right: 0; top: 34px; height: 36px; }
.est-labels span { position: absolute; transform: translateX(-50%); display: grid; justify-items: center; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.est-labels span.l { transform: translateX(-20%); }
.est-labels span.r { transform: translateX(-80%); }
.est-labels b { font-size: 14px; }
.est-labels small { font-size: 11px; color: var(--muted); }
.est-stale { opacity: .45; pointer-events: none; }
.est-labels.flat { position: static; height: auto; margin-top: 12px; font-variant-numeric: tabular-nums; }
.est-labels.flat small { font-size: 12px; }
.est-range:has(.est-labels.flat) { padding-bottom: 4px; }
.badge.wrap { white-space: normal; line-height: 1.35; padding: 2px 8px; }
.badge.wrap .dot { flex: none; }

/* ---------- scan heatmap ---------- */
table.heatmap { border-collapse: separate; border-spacing: 3px; width: auto; }
table.heatmap th, table.heatmap td { border: 0; padding: 0; }
table.heatmap thead th { font-size: 12px; color: var(--text-2); font-weight: 600; text-align: center; padding: 0 4px 6px; white-space: nowrap; }
table.heatmap tbody th { font-size: 13px; font-weight: 600; text-align: left; padding-right: 12px; white-space: nowrap; }
.hm-cell { width: 76px; height: 42px; border: 0; border-radius: 6px; font: 600 13px/1.1 var(--font); font-variant-numeric: tabular-nums; color: var(--text); background: var(--surface-2); cursor: pointer; display: grid; place-content: center; gap: 2px; }
.hm-cell small { font-size: 10.5px; font-weight: 500; opacity: .8; }
.hm-cell.strong { color: #fff; }
.hm-cell.dim { opacity: .6; }
.hm-cell.empty { cursor: default; color: var(--muted); background: transparent; }
.hm-cell:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.hm-cell:not(.empty):hover { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--text-2); }

/* ---------- news & calendar ---------- */
.news-list { list-style: none; margin: 0; padding: 0; display: grid; }
.news-item { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.news-item:last-child { border-bottom: 0; }
.news-item.hot { border-left: 3px solid var(--critical); padding-left: 10px; }
.news-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.news-meta .src { font-weight: 600; color: var(--text-2); }
.news-title { color: var(--text); font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; }
.news-title:hover { color: var(--accent); }
.btn.ghost.active-ghost { background: var(--surface-2); color: var(--text); }
.feed-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 3fr) auto; gap: 8px; align-items: center; }
@media (max-width: 600px) { .feed-row { grid-template-columns: 1fr auto; } .feed-row > input:nth-child(2) { grid-column: 1 / -1; grid-row: 2; } }
.ai-text p { margin: 0 0 6px; line-height: 1.55; }
.grow { flex: 1; }
code.uri { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 6px 8px; border-radius: 6px; overflow-wrap: anywhere; flex: 1; min-width: 0; }
.ct-acc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 260px); gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
@media (max-width: 600px) { .ct-acc { grid-template-columns: 1fr; } }

/* ---------- funded account ---------- */
.prop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 14px 18px; }
.prop-row { display: grid; gap: 6px; }
.prop-row .meter { height: 10px; }
.prop-presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.prop-presets .preset { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; align-content: start; }
.prop-presets .preset p { margin: 0; }

/* ---------- language & mode switches ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button {
  font: 500 12px var(--font); padding: 4px 10px; border: 0; background: transparent; color: var(--text-2); cursor: pointer;
  border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent); color: var(--accent-text); }
.seg button:hover:not(.active) { background: var(--surface-2); color: var(--text); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- glossary terms ---------- */
.term { border-bottom: 1px dotted var(--muted); cursor: help; text-decoration: none; }
.term:hover, .term:focus-visible { border-bottom-color: var(--accent); color: var(--accent); outline: none; }
.term-pop {
  position: absolute; z-index: 150; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); padding: 10px 12px; font-size: 13px; line-height: 1.45;
}

/* ---------- first steps checklist ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; }
.checklist .tick {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--text-2);
}
.checklist li.done .tick { background: var(--good); color: #fff; }
.checklist li.done .grow { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--axis); }

/* ---------- plain-language verdict (backtest, simple mode) ---------- */
.verdict-box { border-radius: 10px; padding: 14px 16px; border: 1px solid var(--border); background: var(--surface-2); font-size: 15px; line-height: 1.5; }
.verdict-box svg { width: 18px; height: 18px; }
.verdict-box.good { background: color-mix(in srgb, var(--good) 12%, var(--surface)); }
.verdict-box.good svg { color: var(--good-text); }
.verdict-box.warning { background: var(--warn-bg); }
.verdict-box.warning svg { color: var(--warning); }
.verdict-box.critical { background: var(--crit-bg); }
.verdict-box.critical svg { color: var(--critical); }
.empty .btn, .empty .row { margin-top: 12px; }

/* tactical bots (Liquidity magnet) */
.factors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.factor { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.factor.on { color: var(--good-text); background: color-mix(in srgb, var(--good) 14%, transparent); }
.factor.off { opacity: .6; text-decoration: line-through; }
.factors .score { margin-left: 4px; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.chip.good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); }
.chip.bad { background: color-mix(in srgb, var(--critical) 12%, transparent); color: var(--bad-text); }
ul.reviews { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
ul.reviews li { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.field.small { display: grid; gap: 4px; font-size: 12px; min-width: 90px; }
.field.small input { width: 100%; }

/* ---------- rule builder ("Strategie din text") ---------- */
.stack.tight > * + * { margin-top: 8px; }
.rule-group { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.rule-group > .row.between { margin-bottom: 10px; }
.rule-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.rule-row > select { width: auto; flex: none; }
.rule-opd { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rule-opd > select, .rule-opd > input { width: auto; flex: none; }
.rule-opd > input[type="number"] { width: 84px; }
.rule-opd .rule-opd { padding: 0 4px; border-left: 2px solid var(--axis); }
.rule-opd-wrap { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rule-row .btn.ghost { margin-left: auto; }
.rule-desc li { color: var(--text); }
.rule-cond { display: flex; gap: 8px; align-items: flex-start; }
.rule-cond svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.rule-cond.ok svg { color: var(--good-text); }
.rule-cond.no svg { color: var(--muted); }
@media (max-width: 600px) { .rule-opd > input[type="number"] { width: 72px; } .rule-opd > select { max-width: calc(100vw - 120px); } }
.rule-session > input[type="time"] { width: auto; flex: none; }

/* research protocol / registry / audit */
tr.dim td { opacity: .55; }
.checklist .tick svg { width: 14px; height: 14px; }
.checklist li.ok .tick { background: var(--good); color: #fff; }
.checklist li.no .tick { background: var(--crit-bg); color: var(--bad-text); }

/* strategy library */
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.lib-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lib-card h2 { font-size: 16px; line-height: 1.3; }
.lib-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.lib-doc { border-top: 1px solid var(--grid); padding-top: 8px; }
.lib-doc.none { color: var(--text-2); }
.lib-filters { gap: 12px; align-items: flex-end; }
.lib-filters .field { margin: 0; min-width: 140px; flex: 1; }
.lib-filters input[type="search"] { width: 100%; }

/* context menu (right-click on a row) */
.ctx-menu { position: fixed; z-index: 150; min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25); padding: 6px; display: flex; flex-direction: column; }
.ctx-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; }
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--surface-2); outline: none; }
.ctx-menu button.danger { color: var(--bad-text); }
.ctx-menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* TradingView-style chart */
.tv-box { width: 100%; }
.tv-legend { position: absolute; left: 8px; top: 6px; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px;
  pointer-events: none; font-variant-numeric: tabular-nums; max-width: calc(100% - 90px); }
.tv-credit { margin-top: 4px; font-size: 11px; color: var(--text-2); }
.tv-credit a { color: inherit; }

/* group tabs above a page (menu groups with several pages) */
.page-tabs { margin: -4px 0 18px; }
.page-tabs a { padding: 8px 12px; border-bottom: 2px solid transparent; color: var(--text-2); white-space: nowrap; font-weight: 500; }
.page-tabs a:hover { color: var(--text); text-decoration: none; }
.page-tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

/* indicator / strategy recommendations from the real-data test */
.warn-text { color: var(--serious); }
.ind-guide { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface-2, transparent); }
.ind-guide .chip { font-size: 11px; }
.ind-guides:empty { display: none; }
.ind-guides { display: flex; flex-direction: column; gap: 6px; }
.rec-block { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.rec-block .small { line-height: 1.45; }

/* ---------- research agent (#/cercetare) ---------- */
.agent-screen {
  margin: 0; height: 460px; overflow: auto; padding: 12px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
.agent-input { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.agent-input textarea { width: 100%; resize: vertical; font: inherit; }
.reports { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 16px; align-items: start; }
.report-list { display: flex; flex-direction: column; gap: 4px; }
.report-list button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; cursor: pointer;
  padding: 8px 10px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text); font: inherit;
}
.report-list button .name { font-weight: 500; overflow-wrap: anywhere; }
.report-list button:hover { background: var(--surface-2); }
.report-list button.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.report-view { min-width: 0; }
@media (max-width: 760px) { .reports { grid-template-columns: 1fr; } .agent-screen { height: 340px; } }
.md { line-height: 1.6; max-width: 900px; }
.md h2 { font-size: 20px; margin: 4px 0 12px; }
.md h3 { font-size: 16px; margin: 24px 0 8px; }
.md h4 { font-size: 14px; margin: 18px 0 6px; }
.md p, .md ul, .md ol, .md blockquote, .md .table-wrap, .md .md-pre { margin: 0 0 12px; }
.md ul, .md ol { padding-left: 22px; }
.md li + li { margin-top: 3px; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--grid); margin: 18px 0; }
.md .md-pre { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
