/* ==========================================================================
   Kurswetter design system
   ========================================================================== */

:root {
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, monospace;

  --bg: #080b12;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(79, 124, 255, 0.10), transparent 60%), radial-gradient(900px 500px at 110% 0%, rgba(139, 92, 246, 0.08), transparent 55%);
  --surface: #0f1420;
  --surface-2: #141a29;
  --surface-3: #1a2133;
  --hover: #1c2438;
  --border: #20283b;
  --border-strong: #2c3650;
  --text: #e8edf6;
  --text-2: #c3ccdb;
  --muted: #8592a8;
  --faint: #5b6780;

  --accent: #4f7cff;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(79, 124, 255, 0.14);
  --grad: linear-gradient(135deg, #4f7cff 0%, #8b5cf6 100%);

  --up: #22c55e;
  --down: #ef4444;
  --up-soft: rgba(34, 197, 94, 0.13);
  --down-soft: rgba(239, 68, 68, 0.13);
  --bull: #22c55e;
  --base: #f5b74a;
  --bear: #f43f5e;
  --warn: #f5b74a;
  --warn-soft: rgba(245, 183, 74, 0.13);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, 0.7);
  --ring: 0 0 0 3px rgba(79, 124, 255, 0.35);

  --chart-bg: #0f1420;
  --chart-grid: #182033;
  --chart-text: #8592a8;
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(79, 124, 255, 0.10), transparent 60%), radial-gradient(900px 500px at 110% 0%, rgba(139, 92, 246, 0.07), transparent 55%);
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef1f8;
  --hover: #eef2fb;
  --border: #e3e7f0;
  --border-strong: #d2d8e6;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --accent-soft: rgba(79, 124, 255, 0.10);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 24px 60px -18px rgba(15, 23, 42, 0.25);
  --chart-bg: #ffffff;
  --chart-grid: #eef1f7;
  --chart-text: #64748b;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 13.5px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: #7ea2ff; text-decoration: none; }
[data-theme="light"] a { color: #2f5fe8; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: rgba(79, 124, 255, 0.35); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.up { color: var(--up); }
.down { color: var(--down); }
.warn { color: var(--warn); }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ico.sm { width: 14px; height: 14px; }
.ico.lg { width: 20px; height: 20px; }
.ico.xl { width: 28px; height: 28px; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------- buttons & inputs ---------- */
button, .btn {
  font: inherit; font-weight: 550; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
button:hover, .btn:hover { background: var(--hover); border-color: var(--border-strong); text-decoration: none; }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--ring); }
button:disabled { opacity: .55; cursor: default; transform: none; }
button.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px -8px rgba(79, 124, 255, .8); }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--hover); border-color: var(--border); }
button.outline { background: transparent; }
button.danger { color: #ff8a8a; }
button.danger:hover { background: var(--down-soft); border-color: rgba(239, 68, 68, .35); }
button.sm { padding: 4px 9px; font-size: 12px; border-radius: 8px; }
button.icon { padding: 6px; }
button.icon.sm { padding: 4px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 500; }
label.check { display: flex; align-items: center; gap: 9px; color: var(--text); cursor: pointer; padding: 3px 0; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 4px 10px; font-size: 12px; color: var(--muted); border-radius: 7px; font-weight: 550; }
.seg button:hover { color: var(--text); background: var(--hover); }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
[data-theme="light"] .seg button.on { background: #fff; }

/* ---------- top bar ---------- */
.topbar {
  height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 16px; position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 750; font-size: 15.5px; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--grad); box-shadow: 0 6px 16px -6px rgba(79,124,255,.9); }
.brand-logo svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 2.4; fill: none; }
.brand small { font-weight: 600; font-size: 10px; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; letter-spacing: .04em; }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a { color: var(--muted); padding: 7px 11px; border-radius: 9px; font-weight: 560; display: flex; align-items: center; gap: 7px; }
.nav a:hover { color: var(--text); background: var(--hover); text-decoration: none; }
.nav a.on { color: var(--text); background: var(--surface-3); }
.nav a.on .ico { stroke: var(--accent); }
.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 34px; background: var(--surface-2); border-radius: 11px; }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
kbd { font: 11px var(--mono); color: var(--faint); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); }
.dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 440px; overflow: auto; padding: 5px; z-index: 40; }
.dropdown .item { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; align-items: center; }
.dropdown .item:hover, .dropdown .item.active { background: var(--hover); }
.dropdown .sym { font-weight: 650; }
.dropdown .ex { color: var(--muted); font-size: 11.5px; text-align: right; }
.dropdown .empty { padding: 12px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 4px; }
.status-pill { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; padding: 5px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #555; flex: none; }
.status-pill.ok .dot { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.status-pill.busy .dot { background: var(--warn); animation: pulse 1s infinite; }
.status-pill.err .dot { background: var(--down); }
@keyframes pulse { 50% { opacity: .35; } }
.badge-count { position: absolute; top: 1px; right: 1px; background: var(--down); color: #fff; border-radius: 9px; padding: 0 5px; font-size: 10px; font-weight: 700; line-height: 16px; min-width: 16px; text-align: center; border: 2px solid var(--surface); }
.icon-wrap { position: relative; }

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: 284px 1fr; min-height: 0; }
.layout.no-side { grid-template-columns: 1fr; }
.layout.no-side > .sidebar { display: none; }
.sidebar { border-right: 1px solid var(--border); overflow: auto; background: color-mix(in srgb, var(--surface) 60%, transparent); display: flex; flex-direction: column; }
.side-section { padding: 12px 12px 4px; }
.side-title { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; padding: 4px 4px 8px; }
.wl-row { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; padding: 9px 10px; border-radius: 11px; cursor: pointer; position: relative; border: 1px solid transparent; margin-bottom: 2px; }
.wl-row:hover { background: var(--hover); }
.wl-row.active { background: var(--surface-3); border-color: var(--border); }
.wl-row.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--grad); }
.wl-sym { font-weight: 650; display: flex; align-items: center; gap: 6px; }
.wl-price { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.wl-name { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-chg { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 550; }
.wl-meta { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.wl-row .x { position: absolute; right: 6px; top: 6px; opacity: 0; transition: opacity .15s; }
.wl-row:hover .x { opacity: 1; }
.ndot { width: 7px; height: 7px; border-radius: 50%; background: var(--down); display: inline-block; box-shadow: 0 0 0 3px var(--down-soft); }
.side-empty { padding: 14px 12px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.spark { display: block; }

main { overflow: auto; padding: 20px 24px 40px; min-width: 0; }
.page { max-width: 1440px; margin: 0 auto; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.glow { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)) 0%, var(--surface) 60%); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head h3 .ico { color: var(--accent); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
@media (max-width: 1350px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .layout { grid-template-columns: 1fr; } .sidebar { display: none; } .nav span.label { display: none; } main { padding: 14px; } }

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .label { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; font-family: var(--font-display); }
.kpi .value.md { font-size: 19px; }
.kpi .delta { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* chips & badges */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 550; border: 1px solid var(--border); border-radius: 20px; padding: 2px 9px; color: var(--text-2); background: var(--surface-2); white-space: nowrap; }
.chip.high { border-color: rgba(239,68,68,.35); background: var(--down-soft); color: #ff9b9b; }
.chip.medium { border-color: rgba(245,183,74,.35); background: var(--warn-soft); color: #f7c873; }
[data-theme="light"] .chip.high { color: #c42b2b; } [data-theme="light"] .chip.medium { color: #a86b00; }
.chip.accent { border-color: rgba(79,124,255,.35); background: var(--accent-soft); color: #9db6ff; }
[data-theme="light"] .chip.accent { color: #2f5fe8; }
.stance { font-weight: 650; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.stance.strong_bullish, .stance.bullish, .stance.up { background: var(--up-soft); color: var(--bull); }
.stance.neutral, .stance.sideways { background: var(--warn-soft); color: var(--base); }
.stance.strong_bearish, .stance.bearish, .stance.down { background: rgba(244,63,94,.13); color: var(--bear); }
.stance.sm { padding: 0 7px; font-size: 10.5px; }
.pill { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill.up { background: var(--up-soft); color: var(--up); }
.pill.down { background: var(--down-soft); color: var(--down); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.sev { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.sev.high { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.sev.medium { background: var(--warn); }

/* tables */
table.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--hover); }
.tbl tr.sel td { background: var(--accent-soft); }
.tbl .sym { font-weight: 650; }
.table-wrap { overflow: auto; max-height: 560px; }

/* lists */
.list .li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list .li:last-child { border-bottom: 0; }
.list .meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.list .empty, .empty { color: var(--muted); padding: 8px 0; }
.scroll { max-height: 360px; overflow: auto; padding-right: 4px; }
.li pre { white-space: pre-wrap; font: inherit; color: var(--text-2); margin: 4px 0 0; font-size: 12.5px; }
.li-title { display: flex; gap: 8px; align-items: baseline; }

/* empty state */
.empty-state { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty-state .art { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--accent-soft); color: var(--accent); }
.empty-state h3 { color: var(--text); font-size: 15px; margin-bottom: 6px; }
.empty-state p { max-width: 520px; margin: 0 auto 14px; line-height: 1.6; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-2) 0%, var(--hover) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; border: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- stock page ---------- */
.stock-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.logo-badge { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; background: var(--grad); flex: none; letter-spacing: -0.02em; box-shadow: 0 8px 20px -10px rgba(79,124,255,.9); }
.stock-head .title h1 { display: flex; align-items: center; gap: 10px; }
.stock-head .price { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; font-family: var(--font-display); }
.stock-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 6px 0 16px; overflow-x: auto; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 12px; color: var(--muted); font-weight: 600; }
.tabs button:hover { color: var(--text); background: transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

.chart-card { padding: 0; overflow: hidden; position: relative; }
.chart-toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: center; }
.toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550; color: var(--muted); border: 1px solid var(--border); padding: 4px 9px; border-radius: 20px; cursor: pointer; user-select: none; background: var(--surface-2); }
.toggle input { display: none; }
.toggle .sw { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.toggle.on { color: var(--text); border-color: var(--border-strong); }
.toggle.on .sw { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#chart { height: 480px; }
.legend { position: absolute; left: 14px; top: 58px; z-index: 3; font-size: 12px; pointer-events: none; color: var(--muted); font-variant-numeric: tabular-nums; display: flex; gap: 10px; flex-wrap: wrap; }
.legend b { color: var(--text); font-weight: 600; }
.chart-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.chart-foot .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-foot .sw { width: 14px; height: 3px; border-radius: 2px; }

/* near-term hero */
.outlook { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.outlook-dial { width: 92px; height: 92px; position: relative; }
.outlook-dial svg { width: 92px; height: 92px; transform: rotate(-90deg); }
.outlook-dial .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 750; font-size: 20px; line-height: 1.1; }
.outlook-dial .val small { display: block; font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.outlook .big-dir { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
@media (max-width: 700px) { .outlook { grid-template-columns: 1fr; } }

/* price path table */
.path { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.path .h { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 10px; text-align: center; }
.path .h .code { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.path .h .likely { font-size: 16px; font-weight: 700; margin: 3px 0 1px; font-variant-numeric: tabular-nums; }
.path .h .range { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.path .h .bar { height: 4px; border-radius: 3px; background: var(--surface-3); margin-top: 7px; position: relative; overflow: hidden; }
.path .h .bar i { position: absolute; top: 0; bottom: 0; background: var(--grad); border-radius: 3px; }
.path .h.done { border-color: rgba(34,197,94,.3); }
.path .h.miss { border-color: rgba(239,68,68,.3); }
@media (max-width: 700px) { .path { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--accent-2), transparent); border-radius: 2px; }
.tl-item { position: relative; padding: 4px 0 12px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.tl-when { font-size: 11.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.tl-what { color: var(--text); margin-top: 1px; }
.tl-prob { font-size: 11.5px; color: var(--muted); }

/* scenarios */
.scenarios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .scenarios { grid-template-columns: 1fr; } }
.scn { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface-2); position: relative; overflow: hidden; }
.scn::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; }
.scn.bear::before { background: var(--bear); } .scn.base::before { background: var(--base); } .scn.bull::before { background: var(--bull); }
.scn .lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.scn.bear .lbl { color: var(--bear); } .scn.base .lbl { color: var(--base); } .scn.bull .lbl { color: var(--bull); }
.scn .tgt { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; margin: 2px 0; letter-spacing: -0.02em; }
.scn .prob { height: 6px; border-radius: 4px; background: var(--surface-3); margin: 8px 0 4px; overflow: hidden; }
.scn .prob i { display: block; height: 100%; border-radius: 4px; }
.scn.bear .prob i { background: var(--bear); } .scn.base .prob i { background: var(--base); } .scn.bull .prob i { background: var(--bull); }
.scn p { margin: 8px 0; color: var(--text-2); }
.scn ul { margin: 4px 0 8px; padding-left: 17px; color: var(--text-2); }
.scn li { margin-bottom: 3px; }
.scn h4 { margin: 10px 0 3px; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.scn .timing { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); padding: 6px 8px; border-radius: 8px; margin-top: 8px; }

.changed { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 11px 13px; }
.changed p { color: var(--text-2); margin-top: 3px; }
.ev-box { text-align: right; }
.ev-box .big { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.metrics td:first-child { color: var(--muted); }
.metrics td:nth-child(2) { font-weight: 650; white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 18px; }
.stats div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 7px 0; gap: 10px; }
.stats span { color: var(--muted); white-space: nowrap; }
.stats b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 1300px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 520px; position: sticky; top: 0; }
.chat-head { padding: 13px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.chat-head .av { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; }
.chat-head .av svg { stroke: #fff; }
.chat-body { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 14px; line-height: 1.55; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.assistant.err { border-color: rgba(239,68,68,.4); color: #ff9b9b; }
.msg .md p + p, .msg .md ul, .msg .md ol, .msg .md table { margin-top: 6px; }
.msg .typing { display: inline-flex; gap: 4px; }
.msg .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.msg .typing i:nth-child(2) { animation-delay: .2s; } .msg .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.chat-suggest button { font-size: 12px; padding: 5px 10px; border-radius: 20px; font-weight: 500; color: var(--text-2); }
.chat-input { border-top: 1px solid var(--border); padding: 10px; display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { min-height: 40px; max-height: 140px; resize: none; border-radius: 12px; }

/* markdown */
.md { line-height: 1.6; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; color: var(--text); }
.md h2 { font-size: 15px; } .md h3 { font-size: 13.5px; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.md code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.md table { border-collapse: collapse; margin: 8px 0; width: 100%; font-variant-numeric: tabular-nums; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 600; }
.md hr { border: 0; height: 1px; background: var(--border); margin: 12px 0; }
.md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent); color: var(--text-2); background: var(--surface-2); border-radius: 0 8px 8px 0; }

/* bars (allocation, calibration) */
.hbar { display: grid; grid-template-columns: 110px 1fr 54px; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; }
.hbar .track { height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 5px; background: var(--grad); }
.gauge { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; position: relative; }
.gauge i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 6px; background: var(--grad); }
.gauge .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .6; }

/* score ring */
.ring { position: relative; width: 120px; height: 120px; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }
.ring .val small { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

/* forms in cards */
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; }
@media (max-width: 1100px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- drawer, modal, toasts ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4, 6, 12, .55); backdrop-filter: blur(3px); z-index: 50; animation: fadein .15s; }
@keyframes fadein { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--border); z-index: 51; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slidein .2s ease-out; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; gap: 8px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.drawer-body { overflow: auto; padding: 4px 16px 16px; flex: 1; }
.drawer .li { cursor: pointer; border-radius: 10px; padding: 10px; margin: 0 -10px; border-bottom: 0; }
.drawer .li:hover { background: var(--hover); }
.drawer .li.unread { background: var(--accent-soft); }
.modal { position: fixed; inset: 0; z-index: 51; display: flex; align-items: flex-start; justify-content: center; overflow: auto; padding: 40px 14px; }
.modal-box { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; width: 920px; max-width: 100%; box-shadow: var(--shadow-lg); display: grid; grid-template-columns: 210px 1fr; overflow: hidden; animation: pop .18s ease-out; min-height: 560px; }
@keyframes pop { from { transform: scale(.98); opacity: 0; } }
.modal-nav { background: var(--surface-2); border-right: 1px solid var(--border); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.modal-nav .title { font-weight: 750; font-size: 16px; padding: 4px 10px 14px; }
.modal-nav button { justify-content: flex-start; background: transparent; border: 0; color: var(--muted); font-weight: 560; padding: 8px 10px; }
.modal-nav button.on { background: var(--surface-3); color: var(--text); }
.modal-nav button.on .ico { stroke: var(--accent); }
.modal-main { padding: 20px 24px; overflow: auto; max-height: calc(100vh - 80px); display: flex; flex-direction: column; }
.modal-main section { display: flex; flex-direction: column; gap: 12px; }
.modal-main .foot { margin-top: auto; padding-top: 16px; display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.55; }
.box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.codebox { font: 12px/1.5 var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; position: relative; }
@media (max-width: 760px) { .modal-box { grid-template-columns: 1fr; } .modal-nav { flex-direction: row; overflow-x: auto; } .modal-nav .title { display: none; } }

#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 13px; padding: 11px 13px 11px 14px; width: 370px; max-width: calc(100vw - 36px); box-shadow: var(--shadow-lg); cursor: pointer; animation: toastin .25s cubic-bezier(.2,.9,.3,1.2); display: flex; gap: 10px; }
.toast .bar { width: 3px; border-radius: 3px; background: var(--accent); flex: none; }
.toast.high .bar, .toast.err .bar { background: var(--down); }
.toast.medium .bar { background: var(--warn); }
.toast.ok .bar { background: var(--up); }
.toast .tt { font-weight: 650; }
.toast .td { color: var(--muted); font-size: 12px; margin-top: 2px; }
@keyframes toastin { from { transform: translateY(12px) scale(.98); opacity: 0; } }

/* login */
.login { flex: 1; display: grid; place-items: center; padding: 20px; }
.login .card { width: 380px; padding: 28px; text-align: center; }
.login .brand-logo { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 14px; }
.login .brand-logo svg { width: 30px; height: 30px; }

.disclaimer { text-align: center; font-size: 11px; color: var(--faint); padding: 6px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent); }

/* dashboard */
.hero { position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(139,92,246,.25), transparent 70%); pointer-events: none; }
.mover { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 9px; cursor: pointer; }
.mover:hover { background: var(--hover); }
.macro { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.macro .m { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 9px 11px; }
.macro .m .l { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.macro .m .v { font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 1300px) { .macro { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .macro { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.steps { counter-reset: s; display: grid; gap: 10px; }
.steps .st { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.steps .st::before { counter-increment: s; content: counter(s); width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; flex: none; }
.steps .st.done::before { content: "\2713"; background: var(--up-soft); color: var(--up); }

/* ---------- simple (buyer) view ---------- */
.label-row { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.help { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 10.5px; font-weight: 800; color: var(--muted); border: 1px solid var(--border-strong); cursor: help; flex: none; }
.help:hover, .help:focus { color: var(--accent); border-color: var(--accent); outline: none; }
.rangebar { position: relative; height: 28px; }
.rangebar .track { position: absolute; left: 0; right: 0; top: 11px; height: 6px; border-radius: 4px; background: var(--surface-3); }
.rangebar .fill { position: absolute; top: 11px; height: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--bear), var(--base) 50%, var(--bull)); opacity: .85; }
.rangebar .mark { position: absolute; top: 5px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; }
.rangebar .mark.base { background: var(--surface); border: 4px solid var(--base); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.rangebar .mark.now { top: 0; width: 3px; height: 28px; margin-left: -1.5px; border-radius: 2px; background: var(--text); }
.rangebar .mark.now::after { content: attr(title); position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 700; color: var(--text); white-space: nowrap; }
.rangelabels { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; font-size: 12.5px; }
.rangelabels .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot.bear { background: var(--bear); } .dot.base { background: var(--base); } .dot.bull { background: var(--bull); }
.fact { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.fact .v { font-size: 18px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stock-card { cursor: pointer; transition: transform .12s, border-color .12s; }
.stock-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.steps .stepnum { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.steps .st:has(.stepnum)::before { display: none; }
.viewswitch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 2px; }
.viewswitch button { border: 0; background: transparent; border-radius: 18px; padding: 3px 10px; font-size: 11.5px; color: var(--muted); }
.viewswitch button.on { background: var(--grad); color: #fff; }

/* ---------- plans & AI budget ---------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 8px 18px; font-size: 13px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); }
.banner[hidden] { display: none; }
.banner.flash { animation: bannerFlash 1.2s ease 2; }
@keyframes bannerFlash { 50% { background: color-mix(in srgb, var(--warn) 25%, var(--surface)); } }
.planpill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 700; }
.planpill.premium { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.planpill .meter { width: 34px; }
.meter { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--grad); transition: width .3s; }
.meter.warn > i { background: var(--warn); }
.meter.full > i { background: var(--down); }
.meter.wide { width: 100%; height: 7px; margin-top: 6px; }
.plan-row { font-size: 13px; }
.plan-row.locked { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.warn-box { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 10%, var(--surface-2)); font-size: 13px; }
.limit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.limit-grid .field span { font-size: 11.5px; }
.plan-card.premium { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "\25B8"; display: inline-block; margin-right: 6px; transition: transform .15s; color: var(--muted); }
details[open] > summary::before { transform: rotate(90deg); }
