/* ============================================================
   TradingAgents — Institutional Terminal Design System
   Dark-first, data-dense, professional. Color communicates state.
   ============================================================ */

:root, [data-theme="dark"] {
  --bg: #020617;              /* OLED deep black, midnight tint */
  --bg-soft: #060b18;
  --panel: #0d1223;
  --panel-2: #121a2e;
  --border: #1e2a40;
  --border-soft: #17203366;
  --text: #dbe4f2;
  --text-strong: #f8fafc;
  --muted: #94a3b8;
  --muted-2: #74839c;

  --accent: #4d8dff;          /* electric blue — primary UI */
  --accent-dim: rgba(77, 141, 255, .13);
  --accent-glow: 0 0 12px rgba(77, 141, 255, .22);
  --cyan: #38bdf8;            /* AI / intelligence */
  --cyan-dim: rgba(56, 189, 248, .12);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, .12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, .12);
  --amber: #f0b429;
  --amber-dim: rgba(240, 180, 41, .13);

  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.015);
  --shadow-pop: 0 12px 40px rgba(0,0,0,.55);
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --sb-w: 236px;
  --tb-h: 46px;
}

[data-theme="light"] {
  --bg: #f2f4f8;
  --bg-soft: #e9edf3;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --border: #d9dfe9;
  --border-soft: #e4e9f1;
  --text: #1a2130;
  --text-strong: #0c1220;
  --muted: #64708a;
  --muted-2: #8b96ac;
  --accent: #2e6be6;
  --accent-dim: rgba(46, 107, 230, .09);
  --accent-glow: 0 0 0 1px rgba(46, 107, 230, .12);
  --cyan: #0891b2;
  --cyan-dim: rgba(8, 145, 178, .09);
  --green: #0e9f6e;
  --green-dim: rgba(14, 159, 110, .1);
  --red: #dc2f3e;
  --red-dim: rgba(220, 47, 62, .09);
  --amber: #b97a12;
  --amber-dim: rgba(185, 122, 18, .11);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-pop: 0 12px 40px rgba(16, 24, 40, .14);
}

/* Reduced motion: kill non-essential animation */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
[hidden] { display: none !important; }

body {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  background: var(--bg);
}
[data-theme="dark"] body,
[data-theme="dark"] .sidebar,
[data-theme="dark"] .topbar {
  background-image: radial-gradient(1100px 500px at 85% -10%, rgba(77, 141, 255, .045), transparent 60%),
                     radial-gradient(900px 420px at -10% 110%, rgba(56, 189, 248, .035), transparent 60%);
}
[data-theme="light"] body,
[data-theme="light"] .sidebar,
[data-theme="light"] .topbar { background-image: none; }

::selection { background: var(--accent-dim); color: var(--text-strong); }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 28%, transparent); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 45%, transparent); }
::-webkit-scrollbar-track { background: transparent; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--green); } .down { color: var(--red); }
.full-w { width: 100%; }

/* ============ App shell ============ */

.app { display: flex; height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sb-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  z-index: 60;
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
  box-shadow: var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.18);
}
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: -.01em; color: var(--text-strong); white-space: nowrap; }
.brand-sub { font-size: 9.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted-2); margin-top: 1px; white-space: nowrap; }

.sb-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.sb-group-label {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .15em;
  color: var(--muted-2); padding: 14px 16px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: calc(100% - 12px); margin: 1px 6px;
  padding: 7px 10px; border: none; border-radius: var(--radius);
  background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; text-align: left; white-space: nowrap;
  transition: background .12s, color .12s;
  position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: .85; }
.nav-item:hover { color: var(--text); background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
.nav-item.active {
  color: var(--text-strong); background: var(--accent-dim); font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -6px; top: 6px; bottom: 6px;
  width: 2.5px; border-radius: 2px; background: var(--accent);
}
.nav-item.active svg { color: var(--accent); opacity: 1; }
.nav-item .nav-kbd {
  margin-left: auto; font-size: 9.5px; font-family: var(--font-mono);
  color: var(--muted-2); border: 1px solid var(--border); border-radius: 3px; padding: 1px 4px;
}

.sb-footer {
  border-top: 1px solid var(--border-soft);
  padding: 10px 12px;
}
.sys-status {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border-soft);
}
.sys-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--green-dim);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { box-shadow: 0 0 0 5px transparent; } }
.sys-status.off .sys-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-dim); animation: none; }
.sys-txt { line-height: 1.25; min-width: 0; }
.sys-txt b { display: block; font-size: 11.5px; font-weight: 600; color: var(--text); }
.sys-txt span { display: block; font-size: 10px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-settings {
  display: flex; align-items: center; gap: 8px;
  width: 100%; margin-top: 8px; padding: 6px 8px;
  background: none; border: none; border-radius: var(--radius);
  color: var(--muted); font-size: 12px; font-family: inherit; cursor: pointer;
  transition: color .12s, background .12s;
}
.sb-settings:hover { color: var(--text); background: var(--panel); }

/* ---- Main column ---- */
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---- Top bar ---- */
.topbar {
  height: var(--tb-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.tb-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.tb-title { font-size: 13.5px; font-weight: 650; color: var(--text-strong); letter-spacing: -.01em; white-space: nowrap; }
.tb-crumb { font-size: 11px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search {
  flex: 1; max-width: 420px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 10px;
  transition: border-color .15s;
  color: var(--muted);
}
.tb-search:focus-within { border-color: var(--accent); }
.tb-search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 12.5px; font-family: inherit; padding: 0;
}
.tb-search input::placeholder { color: var(--muted-2); }
.tb-search kbd {
  font-size: 9.5px; font-family: var(--font-mono); color: var(--muted-2);
  border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; white-space: nowrap;
}
.tb-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.tb-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--muted); padding: 4px 9px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  white-space: nowrap;
}
.tb-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.tb-pill.off .dot { background: var(--red); }
#tb-clock { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.icon-btn {
  width: 28px; height: 28px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--panel);
  color: var(--muted); cursor: pointer; font-size: 13px;
  display: grid; place-items: center; transition: color .12s, border-color .12s;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---- Workspace ---- */
.workspace { flex: 1; overflow-y: auto; padding: 16px 18px 40px; }
.view { max-width: 1720px; margin: 0 auto; animation: viewIn .22s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } }

/* ============ Cards & panels ============ */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  min-width: 0;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 18%, var(--border)); }
.card:focus-within { border-color: color-mix(in srgb, var(--accent) 32%, var(--border)); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted);
}
.card-title.accent-c { color: var(--cyan); }

.section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .13em;
  color: var(--muted-2); margin: 18px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }

/* ============ Buttons / inputs / chips ============ */

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border: none; border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff 8%), var(--accent));
  color: #fff;
  font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.12);
  transition: filter .12s, opacity .12s, transform .08s, box-shadow .18s;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); box-shadow: var(--accent-glow), 0 1px 2px rgba(0,0,0,.35); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); filter: brightness(.95); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border: 1px solid rgba(240,68,82,.25); background: rgba(240,68,82,.1); color: #f04452; border-radius: var(--radius); cursor: pointer; transition: background .15s; }
.btn-xs:hover:not(:disabled) { background: rgba(240,68,82,.3); }
.btn-xs:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  padding: 6px 11px; border-radius: var(--radius);
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); cursor: pointer;
  font-size: 12px; font-family: inherit; transition: color .12s, border-color .12s;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  width: 100%; padding: 7px 10px;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 12.5px; outline: none; transition: border-color .13s;
  color-scheme: dark; font-family: inherit;
}
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea { color-scheme: light; background: var(--panel-2); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
.mini-select { width: auto; padding: 4px 8px; font-size: 11.5px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.field > span, .field-label {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .11em; color: var(--muted-2);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--border);
  font-size: 11.5px; font-weight: 500; font-family: inherit; cursor: pointer;
  transition: all .12s ease; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.chip.active {
  background: var(--accent-dim); border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  color: var(--accent); font-weight: 600;
}

.advanced summary { cursor: pointer; font-size: 12px; color: var(--muted); padding: 4px 0; user-select: none; }
.advanced summary:hover { color: var(--text); }
.advanced[open] summary { margin-bottom: 10px; }

/* segmented control (timeframes) */
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; gap: 2px; }
.seg button {
  padding: 4px 10px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  font-size: 11.5px; font-weight: 600; font-family: var(--font-mono);
  cursor: pointer; transition: all .12s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent-dim); color: var(--accent); }

/* ============ Badges / status ============ */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--border);
}
.badge.running { background: var(--accent-dim); color: var(--accent); border-color: transparent; animation: blink 1.4s infinite; }
.badge.completed { background: var(--green-dim); color: var(--green); border-color: transparent; }
.badge.failed { background: var(--red-dim); color: var(--red); border-color: transparent; }
@keyframes blink { 50% { opacity: .55; } }

.live-ind { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--green); }
.live-ind::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: blink 1.6s infinite; }

.updated-stamp { font-size: 10px; color: var(--muted-2); font-family: var(--font-mono); white-space: nowrap; }

/* signal boxes */
.signal-box {
  display: inline-grid; place-items: center;
  min-width: 84px; padding: 12px 16px; border-radius: var(--radius);
  font-size: 19px; font-weight: 800; letter-spacing: .06em;
  font-family: var(--font-mono);
}
.signal-box.mini { min-width: auto; padding: 2px 8px; font-size: 11px; border-radius: var(--radius-sm); }
.signal-BUY  { background: var(--green-dim); color: var(--green); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 55%, transparent); }
.signal-SELL { background: var(--red-dim);   color: var(--red);   box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 55%, transparent); }
.signal-HOLD { background: var(--amber-dim); color: var(--amber); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 55%, transparent); }

/* ============ Market overview strip ============ */

.ov-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr);
  gap: 8px; overflow-x: auto; padding-bottom: 2px;
}
.ov-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 11px; cursor: pointer; min-width: 0;
  transition: border-color .13s;
  user-select: none;
}
.ov-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.ov-card.selected { border-color: var(--accent); }
.ov-sym { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.ov-price { font-family: var(--font-mono); font-size: 14.5px; font-weight: 600; color: var(--text-strong); margin-top: 3px; white-space: nowrap; }
.ov-chg { font-family: var(--font-mono); font-size: 11px; font-weight: 600; margin-top: 1px; }
.ov-chg.up { color: var(--green); } .ov-chg.down { color: var(--red); }
.flash-up { animation: flashUp .6s ease; }
.flash-down { animation: flashDown .6s ease; }
@keyframes flashUp   { 0% { background: var(--green-dim); } }
@keyframes flashDown { 0% { background: var(--red-dim); } }

/* stat cells */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.stat-cell {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 12px;
}
.stat-v { font-family: var(--font-mono); font-size: 17px; font-weight: 650; color: var(--text-strong); }
.stat-k { font-size: 9.5px; text-transform: uppercase; letter-spacing: .11em; color: var(--muted-2); margin-top: 2px; }

/* ============ Dashboard layout ============ */

.dash-top { display: grid; grid-template-columns: 1fr 340px; gap: 10px; align-items: start; margin-bottom: 10px; }
.dash-main { display: grid; grid-template-columns: minmax(340px, 400px) 1fr; gap: 10px; align-items: start; }
.dash-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 1280px) {
  .dash-top, .dash-main, .dash-bottom { grid-template-columns: 1fr; }
}
.stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* pipeline */
.pipeline { list-style: none; position: relative; margin: 6px 0; }
.pipeline::before {
  content: ""; position: absolute; left: 13px; top: 10px; bottom: 10px;
  width: 1.5px; background: var(--border);
}
.pipe-step { display: flex; gap: 12px; position: relative; padding: 7px 0; }
.pipe-dot {
  width: 27px; height: 27px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-soft); border: 1.5px solid var(--border);
  display: grid; place-items: center; z-index: 1;
  transition: all .2s ease;
  font-size: 11px; color: var(--muted-2); font-family: var(--font-mono);
}
.pipe-body { min-width: 0; flex: 1; padding-top: 3px; }
.pipe-name { font-size: 12.5px; font-weight: 600; color: var(--muted); transition: color .15s; }
.pipe-sub { font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.pipe-step.done .pipe-dot { border-color: var(--green); background: var(--green-dim); color: var(--green); }
.pipe-step.done .pipe-name { color: var(--text); }
.pipe-step.active .pipe-dot { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); animation: pulseDot 1.3s ease-in-out infinite; }
.pipe-step.active .pipe-name { color: var(--accent); }
@keyframes pulseDot { 50% { box-shadow: 0 0 0 4px var(--accent-dim); } }

.live-meta { font-size: 11px; color: var(--muted); font-family: var(--font-mono); margin-top: 6px; min-height: 15px; }

/* feed */
.feed { list-style: none; max-height: 300px; overflow-y: auto; font-size: 12px; }
.feed li {
  display: flex; gap: 10px; padding: 6px 2px;
  border-bottom: 1px solid var(--border-soft);
  animation: slideIn .22s ease; line-height: 1.45;
}
.feed li:last-child { border-bottom: none; }
.feed .t { color: var(--muted-2); font-family: var(--font-mono); font-size: 10.5px; flex-shrink: 0; width: 44px; padding-top: 1px; }
.feed .n { font-weight: 600; color: var(--text); flex-shrink: 0; }
.feed .p { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-sm li { padding: 5px 0; }
.feed-sm .p { white-space: normal; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-3px); } }

/* decision panel */
.decision-panel { display: flex; flex-direction: column; gap: 12px; }
.dp-head { display: flex; align-items: center; gap: 14px; }
.dp-ticker { font-size: 21px; font-weight: 750; letter-spacing: -.01em; font-family: var(--font-mono); color: var(--text-strong); }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 16px; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; border-bottom: 1px dashed var(--border-soft); padding: 4px 0; }
.kv .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); flex-shrink: 0; }
.kv .v { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--text); text-align: right; }
.kv .v.pos { color: var(--green); } .kv .v.neg { color: var(--red); } .kv .v.warn { color: var(--amber); } .kv .v.info { color: var(--accent); }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.tab {
  padding: 5px 11px; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  border: 1px solid transparent;
  font-size: 11.5px; font-weight: 550; font-family: inherit; cursor: pointer; transition: all .12s;
}
.tab:hover { color: var(--text); background: var(--bg-soft); }
.tab.active { background: var(--accent-dim); color: var(--accent); border-color: transparent; font-weight: 600; }

.report-body { max-height: 480px; overflow-y: auto; line-height: 1.6; font-size: 12.5px; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 1em 0 .4em; letter-spacing: -.01em; color: var(--text-strong); font-size: 14px; }
.markdown-body h1:first-child, .markdown-body h2:first-child, .markdown-body h3:first-child { margin-top: 0; }
.markdown-body p { margin: .55em 0; color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.markdown-body ul, .markdown-body ol { margin: .55em 0 .55em 1.4em; color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.markdown-body strong { color: var(--text-strong); }
.markdown-body code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 11.5px; }
.markdown-body table { border-collapse: collapse; margin: .7em 0; width: 100%; font-size: 12px; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; }
.markdown-body th { background: var(--bg-soft); }
.markdown-body blockquote { border-left: 2.5px solid var(--accent); padding-left: 12px; color: var(--muted); margin: .6em 0; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: .9em 0; }

/* ============ Markets view ============ */

.mk-grid { display: grid; grid-template-columns: 300px 1fr; gap: 10px; align-items: start; }
@media (max-width: 1100px) { .mk-grid { grid-template-columns: 1fr; } }

.wl-add { display: flex; gap: 6px; margin-bottom: 10px; }
.wl-cat {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .13em;
  color: var(--muted-2); padding: 10px 6px 4px; border-bottom: 1px solid var(--border-soft);
}
.wl-list { list-style: none; max-height: 560px; overflow-y: auto; }
.wl-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 6px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .1s; border-left: 2px solid transparent;
}
.wl-item:hover { background: var(--bg-soft); }
.wl-item.selected { background: var(--accent-dim); border-left-color: var(--accent); }
.wl-name { font-weight: 600; font-size: 12px; font-family: var(--font-mono); letter-spacing: .02em; }
.wl-price { text-align: right; display: flex; gap: 10px; align-items: baseline; }
.wl-price .p { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text); min-width: 64px; text-align: right; }
.wl-price .c { font-size: 11px; font-family: var(--font-mono); min-width: 54px; text-align: right; }
.wl-x { background: none; border: none; color: var(--muted-2); cursor: pointer; padding: 2px 5px; border-radius: 4px; visibility: hidden; font-size: 10px; }
.wl-item:hover .wl-x { visibility: visible; }
.wl-x:hover { color: var(--red); }

.chart-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.preset { padding: 4px 10px; font-size: 11px; }
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sym-input { width: 100px; }
.fx-position-tools { justify-content: flex-start; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.chart-level-field { display: inline-flex; align-items: center; gap: 5px; color: var(--muted-2); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.chart-level-field input { width: 92px; padding: 5px 7px; font-family: var(--font-mono); font-size: 11px; }
.fx-position-tools .sym-input { width: 150px; }
.fx-position-tools .muted { margin-left: auto; }
.levels-toggle { display: flex; gap: 5px; align-items: center; font-size: 11.5px; color: var(--muted); user-select: none; cursor: pointer; white-space: nowrap; }
.levels-toggle input { width: auto; }

.chart-head-info { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.chart-sym { font-size: 17px; font-weight: 750; font-family: var(--font-mono); letter-spacing: .01em; margin-right: 12px; color: var(--text-strong); }
.chart-price { font-size: 17px; font-family: var(--font-mono); font-weight: 650; margin-right: 8px; color: var(--text-strong); }
.chart-chg { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.chart-wrap { height: 480px; }
#tvchart { height: 100%; width: 100%; }
#fx-chart { height: 100%; width: 100%; }
#im-chart { height: 100%; width: 100%; }

/* trade structure */
.ts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.ts-cell {
  background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 8px 10px;
}
.ts-cell .k { font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); }
.ts-cell .v { font-family: var(--font-mono); font-size: 14px; font-weight: 650; margin-top: 2px; color: var(--text-strong); }
.ts-cell.entry { border-left: 2.5px solid var(--accent); }
.ts-cell.stop  { border-left: 2.5px solid var(--red); }  .ts-cell.stop .v { color: var(--red); }
.ts-cell.target{ border-left: 2.5px solid var(--green); }.ts-cell.target .v { color: var(--green); }
.level-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.level-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600;
  background: var(--bg-soft); border: 1px solid var(--border);
}
.level-pill .lp-price { font-family: var(--font-mono); color: var(--text-strong); }
.level-pill.lp-entry   { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.level-pill.lp-stop    { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.level-pill.lp-stop .lp-price { color: var(--red); }
.level-pill.lp-target  { border-color: color-mix(in srgb, var(--green) 45%, var(--border)); }
.level-pill.lp-target .lp-price { color: var(--green); }
.level-pill.lp-support, .level-pill.lp-resistance { border-color: color-mix(in srgb, var(--amber) 40%, var(--border)); }
.level-pill.lp-support .lp-price, .level-pill.lp-resistance .lp-price { color: var(--amber); }

/* ============ India desk ============ */

.in-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.in-idx-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.oc-card { overflow: visible; }
.oc-head-left { display: flex; align-items: center; gap: 12px; }
.oc-head-left select { width: 150px; }
.oc-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spot-badge {
  font-family: var(--font-mono); font-weight: 700; font-size: 14px;
  padding: 5px 12px; border-radius: var(--radius);
  background: var(--accent-dim); color: var(--accent);
}
.table-scroll { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius); }
.oc-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.oc-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px; font-size: 11.5px; color: var(--muted);
}
.oc-chip b { color: var(--text-strong); font-family: var(--font-mono); font-size: 12px; }
.oc-chip.bull b { color: var(--green); }
.oc-chip.bear b { color: var(--red); }
.oc-chip.neutral b { color: var(--amber); }

/* ============ Tables ============ */

.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th {
  text-align: left; padding: 7px 10px; color: var(--muted-2);
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; background: var(--panel); z-index: 2;
}
.table td { padding: 7px 10px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.ticker-cell { font-weight: 650; font-family: var(--font-mono); color: var(--text-strong); }
.num { font-family: var(--font-mono); text-align: right; }
th.num { text-align: right; }
.view-link { color: var(--accent); cursor: pointer; background: none; border: none; font-size: 12px; font-family: inherit; }
.empty-row td { text-align: center; color: var(--muted-2); padding: 24px; }
.status-completed { color: var(--green); font-weight: 600; }
.status-failed { color: var(--red); font-weight: 600; }
.status-running { color: var(--accent); font-weight: 600; }
.pos-pl { font-family: var(--font-mono); font-weight: 700; }
.close-btn { padding: 3px 9px; font-size: 11px; }

/* option chain table */
.oc-table th, .oc-table td { padding: 4.5px 8px !important; font-size: 11.5px !important; text-align: right; font-family: var(--font-mono); }
.oc-table thead tr:first-child th { font-size: 10px; letter-spacing: .09em; }
.ce-head { color: var(--red) !important; border-right: 1.5px solid var(--border) !important; }
.pe-head { color: var(--green) !important; border-left: 1.5px solid var(--border) !important; }
.strike-head { border-left: 1.5px solid var(--border) !important; border-right: 1.5px solid var(--border) !important; }
.oc-table td.strike-cell {
  font-weight: 700; color: var(--text-strong); background: var(--bg-soft);
  border-left: 1.5px solid var(--border); border-right: 1.5px solid var(--border);
  cursor: pointer;
}
.oc-table tr.atm td.strike-cell { outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.oc-table td.pos { color: var(--green); }
.oc-table td.neg { color: var(--red); }
.oc-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: ocSpin .6s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes ocSpin { to { transform: rotate(360deg); } }

/* chart loading glow */
.im-loading { position: relative; }
.im-loading::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); background: linear-gradient(135deg, transparent 40%, var(--accent-dim) 50%, transparent 60%); background-size: 300% 300%; animation: imGlow 1.4s ease-in-out infinite; pointer-events: none; z-index: 5; }
.im-loaded { animation: imFlash .35s ease-out; }
@keyframes imGlow { 0% { background-position: 100% 0; } 100% { background-position: 0 100%; } }
@keyframes imFlash { 0% { box-shadow: 0 0 0 0 var(--accent-dim); } 100% { box-shadow: none; } }

/* ============ IN Markets — compact option chain sidebar ============ */

.im-oc-sidebar { display: flex; flex-direction: column; height: 100%; border-left: 1px solid var(--border); background: var(--bg-card); overflow: hidden; }
.oc-side-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.oc-side-title { font-weight: 700; font-size: 12px; color: var(--text); }
.oc-side-expiry { font-size: 10px; color: var(--muted); background: var(--bg-secondary); padding: 2px 6px; border-radius: 4px; }
.oc-side-cols { display: grid; grid-template-columns: 1fr 1.2fr 1fr; text-align: center; padding: 4px 6px; border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.oc-col-h.ce { color: var(--red); }
.oc-col-h.pe { color: var(--green); }
.oc-side-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.oc-side-body::-webkit-scrollbar { width: 6px; }
.oc-side-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.oc-side-empty { padding: 20px 10px; text-align: center; color: var(--muted); font-size: 11px; }
.oc-side-row { display: grid; grid-template-columns: 1fr 1.2fr 1fr; text-align: center; padding: 5px 6px; border-bottom: 1px solid var(--border-dim); cursor: pointer; transition: background .15s, transform .1s; font-size: 11.5px; }
.oc-side-row:hover { background: var(--bg-hover); }
.oc-side-row:active { transform: scale(.98); }
.oc-side-row.atm { background: var(--accent-dim); font-weight: 700; }
.oc-side-row .ce-ltp { color: var(--red); font-weight: 600; }
.oc-side-row .pe-ltp { color: var(--green); font-weight: 600; }
.oc-side-row .strike { color: var(--text); font-weight: 700; font-size: 11px; }
.oc-side-row .ltp-flash { animation: ocLtpFlash .4s ease-out; }
.oc-spot-line { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: var(--accent-dim); border-top: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; position: sticky; top: 0; z-index: 1; }
.oc-spot-label { font-size: 9px; opacity: .7; }
.oc-spot-price { font-size: 12px; font-weight: 800; }
@keyframes ocLtpFlash { 0% { background: var(--accent-dim); } 100% { background: transparent; } }

/* ============ IN Markets — floating option order window ============ */

.im-float-order { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.im-float-order[hidden] { display: none; }
.im-float-panel { position: absolute; width: 320px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.4); animation: imSlideUp .3s ease-out; overflow: hidden; pointer-events: auto; }
.im-float-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: grab; }
.im-float-head:active { cursor: grabbing; }
.im-float-title { font-weight: 700; font-size: 13px; flex: 1; }
.im-float-ltp { font-weight: 700; font-size: 14px; }
.im-float-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; }
.im-float-close:hover { color: var(--text); }
.im-float-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.im-float-submit { width: 100%; padding: 10px; border: none; border-radius: var(--radius); font-weight: 700; font-size: 14px; cursor: pointer; transition: background .15s, transform .1s; color: #fff; background: var(--green); }
.im-float-submit.buy { background: var(--green); }
.im-float-submit.buy:hover { background: #2ecc71; }
.im-float-submit.sell { background: var(--red); }
.im-float-submit.sell:hover { background: #e74c3c; }
.im-float-submit:active { transform: scale(.97); }
.im-float-submit.sent { background: var(--muted); pointer-events: none; }
@keyframes imSlideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes imFadeIn { from { opacity: 0; } to { opacity: 1; } }
.im-float-order.buy-mode .im-float-head { border-bottom-color: var(--green); }
.im-float-order.sell-mode .im-float-head { border-bottom-color: var(--red); }
.im-float-limit-row { display: flex; gap: 6px; align-items: flex-end; }
.im-float-quote-btn { height: 34px; padding: 0 12px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-size: 11px; font-weight: 700; border-radius: var(--radius); cursor: pointer; transition: background .15s; white-space: nowrap; }
.im-float-quote-btn:hover { background: var(--accent-dim); }
.im-float-quote-btn:active { transform: scale(.96); }
.im-qty-ctrl { display: flex; align-items: center; gap: 0; }
.im-qty-ctrl input { width: 54px; text-align: center; border-radius: 0; -moz-appearance: textfield; }
.im-qty-ctrl input::-webkit-inner-spin-button,
.im-qty-ctrl input::-webkit-outer-spin-button { -webkit-appearance: none; }
.im-qty-btn { width: 32px; height: 32px; border: 1px solid var(--border); background: var(--bg-main); color: var(--text); font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .12s; }
.im-qty-btn:hover { background: var(--bg-hover); }
.im-qty-btn:active { background: var(--accent); color: #fff; }

/* ============ Trading desk ============ */

.trade-grid { display: grid; grid-template-columns: 320px 280px 1fr; gap: 10px; align-items: start; }
@media (max-width: 1200px) { .trade-grid { grid-template-columns: 1fr 1fr; } .positions-card { grid-column: 1 / -1; } }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 7px; }
.acct-item { background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 7px 10px; }
.acct-item .k { font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); margin-bottom: 2px; }
.acct-item .v { font-family: var(--font-mono); font-size: 13.5px; font-weight: 650; color: var(--text-strong); }

.risk-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 14px;
}
.risk-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.risk-state .sys-dot { animation: none; }
.risk-state.ok { color: var(--green); }
.risk-state.warn { color: var(--amber); }

.side-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.side-btn {
  padding: 10px; border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 800; letter-spacing: .06em; cursor: pointer; font-family: inherit;
  color: #fff; transition: filter .12s, transform .08s, box-shadow .18s;
}
.side-btn:hover { filter: brightness(1.12); }
.side-btn:active { transform: translateY(1px); filter: brightness(.92); }
.side-btn.buy { background: linear-gradient(180deg, #2edd70, var(--green)); box-shadow: 0 1px 2px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.14); }
.side-btn.sell { background: linear-gradient(180deg, #f66a75, var(--red)); box-shadow: 0 1px 2px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.14); }

.guide-card { border-style: dashed; }
.guide-steps { margin: 10px 0 8px 16px; font-size: 12.5px; line-height: 1.85; color: var(--muted); }
.guide-steps strong { color: var(--text); }

/* ============ Chat ============ */

.chat-layout { display: grid; grid-template-columns: 1fr 330px; gap: 10px; align-items: stretch; }
@media (max-width: 1100px) { .chat-layout { grid-template-columns: 1fr; } }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - var(--tb-h) - 74px); min-height: 380px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 4px 2px; }
.msg { max-width: 86%; margin-bottom: 12px; padding: 9px 13px; border-radius: var(--radius); font-size: 12.5px; line-height: 1.55; animation: slideIn .2s ease; }
.msg.user {
  margin-left: auto; background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-bottom-right-radius: 3px; white-space: pre-wrap; color: var(--text-strong);
}
.msg.bot {
  background: var(--bg-soft); border: 1px solid var(--border-soft);
  border-bottom-left-radius: 3px;
}
.msg.agent-tag {
  display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
  color: var(--cyan); margin-bottom: 5px;
}
.msg.bot .markdown-body p { margin: .35em 0; }
.chat-input-row { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
#chat-input { resize: none; max-height: 110px; }
.send-btn { align-self: flex-end; height: 34px; padding: 6px 13px; }
.typing { color: var(--muted-2); font-size: 11.5px; padding: 4px 13px 8px; font-family: var(--font-mono); }
.chat-side { overflow-y: auto; max-height: calc(100vh - var(--tb-h) - 74px); }
.chat-context { max-height: 250px; overflow-y: auto; font-size: 12px; }
.agent-picker { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }

/* ============ Indian Market (Flattrade desk) ============ */

.im-top { display: grid; grid-template-columns: 1fr 320px; gap: 10px; align-items: start; }
.im-mid { display: grid; grid-template-columns: 1fr 300px; gap: 10px; align-items: start; }
.im-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 1200px) { .im-top, .im-mid, .im-bottom { grid-template-columns: 1fr; } }

.im-live-confirm {
  margin-top: 12px; padding: 12px;
  background: var(--red-dim); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 4px; font-size: 12px;
}
.im-live-confirm b { color: var(--red); letter-spacing: .06em; }

.mode-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.mode-pill.disabled { background: var(--bg-soft); color: var(--muted); border: 1px solid var(--border); }
.mode-pill.paper { background: var(--amber-dim); color: var(--amber); border: 1px solid transparent; }
.mode-pill.live { background: var(--red-dim); color: var(--red); border: 1px solid transparent; animation: blink 2s infinite; }

/* ============ Forex desk (Exness MT5) ============ */

.fx-topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.fx-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.fx-settings { margin-bottom: 12px; border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
.fx-settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; padding-top: 4px; }
.fx-settings-col { min-width: 0; padding-right: 8px; border-right: 1px solid var(--border-soft); }
.fx-settings-col:last-child { border-right: none; padding-right: 0; }

.fx-chart-grid { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: 0; align-items: stretch; }
.fx-chart-grid-with-sd { display: grid; grid-template-columns: 210px minmax(0, 1fr) 264px; gap: 0; align-items: stretch; }
.fx-chart-grid-with-sd .chart-wrap { height: 460px; }
.fx-chart-grid .chart-wrap { height: 460px; }
.fx-sd-settings {
  display: flex; flex-direction: column; gap: 10px;
  border-right: 1px solid var(--border);
  padding: 8px 12px 8px 8px;
  overflow-y: auto;
  font-size: 11px;
}
.fx-sd-settings .sd-setting { display: flex; flex-direction: column; gap: 4px; }
.fx-sd-settings .sd-setting label { color: var(--muted); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; }
.fx-sd-settings .sd-setting input,
.fx-sd-settings .sd-setting select { background: var(--panel); border: 1px solid var(--border); border-radius: 5px; color: var(--text); padding: 5px 6px; font-size: 11px; }
.fx-sd-settings .sd-setting input:focus,
.fx-sd-settings .sd-setting select:focus { outline: none; border-color: var(--accent); }
.fx-sd-settings .sd-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.fx-sd-settings .sd-row label { margin: 0; }
.fx-sd-settings .sd-actions { margin-top: auto; display: flex; gap: 6px; }
.fx-sd-settings .sd-actions button { flex: 1; }
.fx-ticket {
  display: flex; flex-direction: column; gap: 9px;
  border-left: 1px solid var(--border);
  padding: 2px 2px 2px 14px;
}
.fx-ticket .field span { font-size: 9.5px; letter-spacing: .1em; }
.seg.full-w { display: flex; width: 100%; }
.seg.full-w button { flex: 1; }

@media (max-width: 1100px) {
  .fx-chart-grid, .fx-chart-grid-with-sd { grid-template-columns: 1fr; }
  .fx-sd-settings { border-right: none; border-bottom: 1px solid var(--border); padding: 10px 2px 10px 2px; max-height: 260px; }
  .fx-ticket { border-left: none; border-top: 1px solid var(--border); padding: 12px 2px 2px; margin-top: 8px; }
  .fx-settings-col { border-right: none; padding-right: 0; }
}

/* ---- chart drawing tools ---- */

.fx-chart-area { position: relative; }
#fx-draw-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

.fx-draw-tools {
  position: absolute; top: 8px; left: 8px; z-index: 6;
  display: flex; align-items: center; gap: 2px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  backdrop-filter: blur(5px);
}
.dt-btn {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border: none; background: transparent;
  color: var(--muted); border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s, color .12s;
}
.dt-btn:hover { background: var(--bg-soft); color: var(--text); }
.dt-btn.active { background: var(--accent-dim); color: var(--accent); }
.dt-btn.long.active { background: var(--green-dim); color: var(--green); }
.dt-btn.short.active { background: var(--red-dim); color: var(--red); }
.dt-btn.off { opacity: .4; }
.dt-btn.danger:hover { background: var(--red-dim); color: var(--red); }
.dt-sep { width: 1px; height: 15px; background: var(--border); margin: 0 2px; }

.dt-show {
  position: absolute; top: 8px; left: 8px; z-index: 6;
  display: grid; place-items: center;
  width: 28px; height: 28px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--muted); cursor: pointer;
}
.dt-show:hover { color: var(--text); }

/* ============ Agentic Work ============ */

.agentic-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.agentic-heading .section-label { margin-bottom: 4px; }
.agentic-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 10px; }
.agentic-tabs { display: flex; gap: 6px; margin-bottom: 10px; padding: 4px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.agentic-tab { flex: 1; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.agentic-tab:hover { color: var(--text); background: var(--panel-2); }
.agentic-tab.active { background: var(--accent-dim); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent); }
.agentic-symbol-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
.agentic-symbol { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); cursor: pointer; font-family: var(--font-mono); font-size: 10.5px; }
.agentic-symbol:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-dim); color: var(--accent); }
.agentic-symbol input { accent-color: var(--accent); }
.agentic-add-row { display: flex; gap: 6px; margin: 8px 0 12px; }
.agentic-add-row input { min-width: 0; flex: 1; }
.agentic-suggestions { display: grid; gap: 3px; max-height: 150px; overflow: auto; margin: -7px 0 10px; padding: 4px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.agentic-suggestions button { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.agentic-suggestions button:hover { background: var(--accent-dim); color: var(--accent); }
.agentic-suggestions small { color: var(--muted); font: 10px var(--font-mono); }
.agentic-symbol { position: relative; }
.agentic-symbol i { display: none; color: var(--green); font: 9px var(--font-mono); font-style: normal; }
.agentic-symbol-added { animation: agenticAdded .85s ease-out; }
.agentic-symbol-added i { display: inline; animation: agenticAddedText .85s ease-out; }
@keyframes agenticAdded { 0% { transform: scale(.94); border-color: var(--green); box-shadow: 0 0 0 0 var(--green-dim); } 45% { transform: scale(1.03); box-shadow: 0 0 0 5px transparent; } 100% { transform: scale(1); } }
@keyframes agenticAddedText { 0% { opacity: 0; transform: translateX(-4px); } 50% { opacity: 1; transform: translateX(0); } 100% { opacity: 1; } }
.agentic-pipeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.agentic-agent { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); }
.agentic-agent b, .agentic-agent small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agentic-agent b { color: var(--text); font-size: 10.5px; }
.agentic-agent small { margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.agentic-agent-dot { display: grid; place-items: center; flex: 0 0 auto; width: 25px; height: 25px; border-radius: 50%; background: var(--bg-soft); color: var(--muted); font: 700 8px var(--font-mono); }
.agentic-agent.active { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.agentic-agent.active .agentic-agent-dot { background: var(--accent-dim); color: var(--accent); }
.agentic-agent.done .agentic-agent-dot { background: var(--green-dim); color: var(--green); }
.agentic-call-card { border-color: color-mix(in srgb, var(--accent) 28%, var(--border)); }
.agentic-call-grid { display: grid; grid-template-columns: repeat(4, minmax(90px, 1fr)); gap: 8px; }
.agentic-call-grid > div { padding: 10px; background: var(--bg-soft); border-radius: var(--radius-sm); }
.agentic-call-label { color: var(--muted-2); font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.agentic-call-value { margin-top: 5px; color: var(--text-strong); font: 700 17px var(--font-mono); }
.agentic-reason { margin-top: 10px; max-height: 220px; overflow: auto; padding: 12px; background: var(--bg-soft); border-left: 2px solid var(--accent); color: var(--text); white-space: pre-wrap; font: 11px/1.55 var(--font-mono); }
.agentic-call-value.up { color: var(--green); }
.agentic-call-value.down { color: var(--red); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px; margin-bottom: 12px; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius); cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; gap: 3px; }
.switch-row b { color: var(--text-strong); font-size: 12px; }
.switch-row small { color: var(--muted); font-size: 10.5px; }
.switch-row input { appearance: none; flex: 0 0 auto; width: 38px; height: 21px; border-radius: 999px; background: var(--muted-2); position: relative; cursor: pointer; transition: background .15s; }
.switch-row input::after { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch-row input:checked { background: var(--green); }
.switch-row input:checked::after { transform: translateX(17px); }
.switch-row.compact { margin-top: 2px; }
.agentic-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 5px; }
.agentic-safety { margin-top: 12px; padding: 9px 10px; border: 1px solid var(--amber-dim); border-radius: var(--radius); color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.agentic-safety b { color: var(--amber); }
.agentic-status-list { display: grid; gap: 1px; }
.agentic-status-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.agentic-status-list .k { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.agentic-status-list .v { color: var(--text-strong); font-family: var(--font-mono); font-size: 11px; text-align: right; }
.agentic-error { color: var(--red); min-height: 16px; margin-top: 10px; }
.agentic-empty { padding: 18px 4px; color: var(--muted); font-size: 12px; }
.agentic-progress { margin-top: 14px; }
.agentic-progress-track { height: 7px; overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; }
.agentic-progress-track span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: inherit; transition: width .35s ease; }
.agentic-progress-track span.working { animation: agenticProgressPulse 1.2s ease-in-out infinite; }
.agentic-progress-track span.complete { background: var(--green); }
.agentic-progress-track span.failed { background: var(--red); }
.agentic-progress > span { display: block; margin-top: 5px; color: var(--muted); font: 10px var(--font-mono); text-align: right; }
.agentic-agent.active .agentic-agent-dot { animation: agenticAgentPulse 1s ease-in-out infinite; }
.agentic-actions .is-busy { position: relative; color: transparent; pointer-events: none; }
.agentic-actions .is-busy::after { content: "Working..."; position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-strong); }
@keyframes agenticProgressPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes agenticAgentPulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-dim); } 50% { box-shadow: 0 0 0 5px transparent; } }

@media (max-width: 900px) {
  .agentic-grid { grid-template-columns: 1fr; }
  .agentic-symbol-list, .agentic-pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agentic-call-grid { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
}

/* ============ Toast ============ */

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); color: var(--text-strong);
  border: 1px solid var(--border);
  padding: 10px 18px; border-radius: var(--radius); font-size: 12.5px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35); z-index: 200;
  animation: slideUp .22s ease; max-width: 90vw;
}
.toast.error { border-color: color-mix(in srgb, var(--red) 55%, transparent); color: var(--red); }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ============ Responsive shell ============ */

.sidebar-toggle { display: none; }
.mobile-backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 8px 0 32px rgba(0,0,0,.4);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .mobile-backdrop.show { opacity: 1; pointer-events: auto; }
  .sidebar-toggle { display: grid; }
  .tb-crumb { display: none; }
  .workspace { padding: 12px; }
  #tb-clock { display: none; }
}

/* focus visibility */
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, .nav-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px;
}

/* ============ Market Stories ============ */

.stories-tabs { display: flex; gap: 6px; margin: 12px 0 4px; }
.stories-tab {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 999px; font-size: 12px; cursor: pointer;
  font-weight: 600; transition: all .15s ease;
}
.stories-tab:hover { color: var(--text-strong); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.stories-tab.active { background: var(--accent-dim); color: var(--accent); border-color: transparent; }

.stories-panel { margin-top: 10px; }

.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cal-filters { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 10px; }
.cal-flabel { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cal-filters.desk-filters { margin-top: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); gap: 4px 10px; }
.cal-filters .chip { padding: 3px 9px; font-size: 10.5px; }

.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 10px; }
.story-card {
  display: flex; flex-direction: column; gap: 10px; background: var(--panel-2);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
}
.story-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); }
.story-img { height: 130px; background-size: cover; background-position: center; background-color: var(--bg-soft); }
.story-img-ph { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, var(--bg-soft)), var(--bg-soft)); }
.story-body { padding: 0 12px 12px; }
.story-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted-2); font-size: 10.5px; font-family: var(--font-mono); margin-bottom: 6px; }
.story-title { font-size: 13.5px; line-height: 1.35; margin: 0 0 6px; font-weight: 600; color: var(--text-strong); }
.story-summary { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 0; }

.impact { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.impact-high { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.impact-med { background: color-mix(in srgb, var(--amber, #f59e0b) 18%, transparent); color: var(--amber, #f59e0b); }
.impact-low { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.flag { display: inline-block; padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 10px; font-family: var(--font-mono); color: var(--muted); }

.desk-stories { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.desk-news { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.desk-news-item { }
.desk-news-link { display: flex; flex-direction: column; gap: 2px; text-decoration: none; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: var(--radius); transition: border-color .15s; }
.desk-news-link:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.desk-news-head { font-size: 12px; line-height: 1.35; color: var(--text-strong); font-weight: 500; }
.desk-news-meta { font-size: 10.5px; color: var(--muted-2); font-family: var(--font-mono); }
.desk-cal .num { font-family: var(--font-mono); font-size: 11px; }

.cal-table tr.passed td { color: var(--muted-2); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 70%, transparent); }
.cal-table tr.passed td:not(:nth-child(1)):not(:nth-child(2)) { text-decoration: none; }
.cal-table tr.passed .passed-tag { display: inline-block; margin-left: 4px; padding: 0 4px; border: 1px solid color-mix(in srgb, var(--muted) 60%, transparent); border-radius: 4px; font-size: 9px; letter-spacing: .03em; font-family: var(--font-mono); color: var(--muted); text-decoration: none; }
.cal-table tr.passed .impact-badge { opacity: .45; }

@media (max-width: 900px) {
  .desk-stories { grid-template-columns: 1fr; }
}
.muted-badge { background: var(--muted-2, var(--muted)); color: var(--bg-soft); border-color: transparent; }

/* ============================================================
   ADVANCED TERMINAL LAYER — command palette, toast stack,
   skeletons, session pill, shortcuts help  (ui-ux-pro-max)
   ============================================================ */

/* ---- Market session pill ---- */
.session-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  white-space: nowrap;
}
.session-pill .s-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.session-pill.open { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-dim); }
.session-pill.open .s-dot { background: var(--green); box-shadow: 0 0 6px color-mix(in srgb, var(--green) 70%, transparent); animation: blink 2s infinite; }
.session-pill.pre { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); background: var(--amber-dim); }
.session-pill.pre .s-dot { background: var(--amber); }
.session-pill.closed { color: var(--muted); }
.session-pill.closed .s-dot { background: var(--red); opacity: .7; }

/* ---- Command palette (Ctrl+K) ---- */
.cmdk-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(2, 6, 23, .6);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
  animation: cmdkFade .16s ease;
}
@keyframes cmdkFade { from { opacity: 0; } }
.cmdk {
  width: 640px; max-width: 100%; max-height: 62vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 10px;
  box-shadow: var(--shadow-pop), var(--accent-glow);
  animation: cmdkIn .18s cubic-bezier(.2, .9, .3, 1.02);
}
@keyframes cmdkIn { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
.cmdk-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--border-soft);
}
.cmdk-input-row svg { color: var(--muted-2); flex-shrink: 0; }
.cmdk-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-strong); font-size: 14.5px; font-family: inherit; padding: 0;
}
.cmdk-input::placeholder { color: var(--muted-2); }
.cmdk-esc { font-size: 9.5px; font-family: var(--font-mono); color: var(--muted-2); border: 1px solid var(--border); border-radius: 3px; padding: 2px 6px; }
.cmdk-list { flex: 1; overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.cmdk-group {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .13em;
  color: var(--muted-2); padding: 10px 10px 5px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 10px; border: none; border-radius: var(--radius);
  background: transparent; color: var(--text); text-align: left;
  font-size: 12.5px; font-family: inherit; cursor: pointer;
  transition: background .1s;
}
.cmdk-item svg { color: var(--muted); flex-shrink: 0; }
.cmdk-item .cmdk-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .cmdk-label b { color: var(--accent); font-weight: 700; }
.cmdk-item .cmdk-hint { font-size: 10px; color: var(--muted-2); font-family: var(--font-mono); flex-shrink: 0; }
.cmdk-item.selected { background: var(--accent-dim); color: var(--text-strong); }
.cmdk-item.selected svg { color: var(--accent); }
.cmdk-empty { padding: 26px 10px; text-align: center; color: var(--muted-2); font-size: 12px; }
.cmdk-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 14px; border-top: 1px solid var(--border-soft);
  font-size: 10px; color: var(--muted-2); font-family: var(--font-mono);
}
.cmdk-foot .cmdk-k { display: inline-flex; align-items: center; gap: 4px; }
kbd.kbd-key {
  font-family: var(--font-mono); font-size: 9.5px; color: var(--muted);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; background: var(--bg-soft);
}

/* ---- Stacked toasts ---- */
.toast-stack {
  position: fixed; top: 14px; right: 16px; z-index: 320;
  display: flex; flex-direction: column; gap: 8px;
  width: 340px; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  font-size: 12.5px; line-height: 1.45; color: var(--text);
  pointer-events: auto;
  animation: toastIn .22s cubic-bezier(.2, .9, .3, 1.02);
}
.toast-item.leaving { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(18px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(18px) scale(.97); } }
.toast-item .t-ic { flex-shrink: 0; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; margin-top: 1px; }
.toast-item .t-ic svg { width: 11px; height: 11px; }
.toast-item.info .t-ic { background: var(--accent-dim); color: var(--accent); }
.toast-item.success .t-ic { background: var(--green-dim); color: var(--green); }
.toast-item.error { border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.toast-item.error .t-ic { background: var(--red-dim); color: var(--red); }
.toast-item .t-bar {
  position: absolute; left: 0; bottom: 0; height: 2px; border-radius: 2px;
  background: var(--accent); opacity: .6;
  animation: tbar linear forwards;
}
.toast-item.error .t-bar { background: var(--red); }
.toast-item.success .t-bar { background: var(--green); }
@keyframes tbar { from { width: 100%; } to { width: 0%; } }
.toast-item { position: relative; overflow: hidden; }

/* ---- Skeleton shimmer ---- */
.skel {
  position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
  border-radius: var(--radius-sm);
}
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--accent) 7%, transparent) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: skelWave 1.15s ease-in-out infinite;
}
@keyframes skelWave { from { background-position: 130% 0; } to { background-position: -90% 0; } }
.skel-line { height: 10px; }
.skel-stat { padding: 10px 12px; border: 1px solid var(--border-soft); }
.skel-stat .skel-line { margin-top: 6px; }
.skel-stat .skel-line:first-child { width: 40%; margin-top: 0; }
.skel-stat .skel-line:nth-child(2) { width: 70%; }

/* ---- Shortcuts help overlay ---- */
.kbd-help-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(2, 6, 23, .6); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: cmdkFade .16s ease;
}
.kbd-help {
  width: 560px; max-width: 100%; max-height: 82vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-pop);
  padding: 22px 24px; animation: cmdkIn .18s ease;
}
.kbd-help h3 { font-size: 13px; font-weight: 700; color: var(--text-strong); letter-spacing: -.01em; margin-bottom: 4px; }
.kbd-help .kbd-sub { font-size: 11px; color: var(--muted-2); margin-bottom: 16px; }
.kbd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }
.kbd-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--border-soft);
}
.kbd-row span { font-size: 12px; color: var(--muted); }
.kbd-row .keys { display: flex; gap: 4px; flex-shrink: 0; }
.kbd-close-hint { margin-top: 16px; text-align: center; font-size: 10.5px; color: var(--muted-2); font-family: var(--font-mono); }

/* view transition — staggered entrance */
.view { animation: viewIn .26s cubic-bezier(.2, .9, .3, 1); }
.view > * { animation: viewStagger .3s cubic-bezier(.2, .9, .3, 1) backwards; }
.view > *:nth-child(1) { animation-delay: .02s; }
.view > *:nth-child(2) { animation-delay: .05s; }
.view > *:nth-child(3) { animation-delay: .08s; }
.view > *:nth-child(4) { animation-delay: .11s; }
.view > *:nth-child(5) { animation-delay: .14s; }
.view > *:nth-child(n+6) { animation-delay: .17s; }
@keyframes viewStagger { from { opacity: 0; transform: translateY(5px); } }

/* topbar polish */
.topbar { backdrop-filter: blur(6px); }
.tb-search { backdrop-filter: blur(3px); }
.conn-pill-online { box-shadow: 0 0 0 1px color-mix(in srgb, var(--green) 25%, transparent); }

/* table row polish — crisper density rhythm */
.table tbody tr:active { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.table th { border-bottom: 1.5px solid var(--border); }

/* signal glow */
.signal-BUY  { text-shadow: 0 0 14px color-mix(in srgb, var(--green) 45%, transparent); }
.signal-SELL { text-shadow: 0 0 14px color-mix(in srgb, var(--red) 45%, transparent); }
.signal-HOLD { text-shadow: 0 0 14px color-mix(in srgb, var(--amber) 45%, transparent); }

@media (max-width: 640px) {
  .session-pill { display: none; }
  .cmdk-backdrop { padding-top: 6vh; }
}
