/* ============================================================
   GREEQS — Production design system
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── canvas / surfaces ─────────────────────────────────── */
  --canvas:        oklch(0.155 0.005 250);
  --surface-0:     oklch(0.185 0.005 250);   /* nav, topbar */
  --surface-1:     oklch(0.205 0.006 250);   /* cards */
  --surface-2:     oklch(0.235 0.007 250);   /* hover, table hdr */
  --surface-3:     oklch(0.275 0.008 250);   /* active inputs */

  /* ── borders ───────────────────────────────────────────── */
  --line:          oklch(0.27 0.006 250 / 0.7);
  --line-strong:   oklch(0.36 0.008 250 / 0.9);

  /* ── text ──────────────────────────────────────────────── */
  --fg:            oklch(0.965 0.003 250);
  --fg-2:          oklch(0.78 0.005 250);
  --fg-3:          oklch(0.58 0.006 250);
  --fg-4:          oklch(0.44 0.006 250);

  /* ── semantic ──────────────────────────────────────────── */
  --accent:        oklch(0.78 0.135 75);     /* refined amber */
  --accent-2:      oklch(0.68 0.13 75);
  --accent-soft:   oklch(0.78 0.135 75 / 0.12);
  --accent-line:   oklch(0.78 0.135 75 / 0.32);

  --up:            oklch(0.76 0.17 150);
  --up-soft:       oklch(0.76 0.17 150 / 0.13);
  --up-line:       oklch(0.76 0.17 150 / 0.28);

  --down:          oklch(0.68 0.20 25);
  --down-soft:     oklch(0.68 0.20 25 / 0.13);
  --down-line:     oklch(0.68 0.20 25 / 0.28);

  --info:          oklch(0.74 0.13 240);
  --info-soft:     oklch(0.74 0.13 240 / 0.13);
  --info-line:     oklch(0.74 0.13 240 / 0.28);

  /* ── type ──────────────────────────────────────────────── */
  --ff-ui:    'Inter', system-ui, sans-serif;
  --ff-mono:  'JetBrains Mono', ui-monospace, monospace;

  /* ── density ───────────────────────────────────────────── */
  --row-h: 32px;
  --nav-w: 208px;
  --top-h: 48px;
  --pad: 14px;
  --pad-sm: 10px;

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
}

/* compact density override */
[data-density="compact"] {
  --row-h: 28px;
  --pad: 10px;
  --pad-sm: 8px;
}

/* light theme */
[data-theme="light"] {
  --canvas:      oklch(0.97 0.003 250);
  --surface-0:   oklch(0.99 0.002 250);
  --surface-1:   oklch(0.95 0.004 250);
  --surface-2:   oklch(0.91 0.005 250);
  --surface-3:   oklch(0.86 0.006 250);

  --line:        oklch(0.80 0.008 250 / 0.7);
  --line-strong: oklch(0.70 0.010 250 / 0.8);

  --fg:          oklch(0.18 0.006 250);
  --fg-2:        oklch(0.35 0.006 250);
  --fg-3:        oklch(0.52 0.006 250);
  --fg-4:        oklch(0.65 0.005 250);

  --up:          oklch(0.50 0.17 150);
  --up-soft:     oklch(0.50 0.17 150 / 0.10);
  --up-line:     oklch(0.50 0.17 150 / 0.25);

  --down:        oklch(0.50 0.20 25);
  --down-soft:   oklch(0.50 0.20 25 / 0.10);
  --down-line:   oklch(0.50 0.20 25 / 0.25);

  --info:        oklch(0.48 0.13 240);
  --info-soft:   oklch(0.48 0.13 240 / 0.10);
  --info-line:   oklch(0.48 0.13 240 / 0.25);

  --accent:      oklch(0.60 0.14 75);
  --accent-2:    oklch(0.50 0.13 75);
  --accent-soft: oklch(0.60 0.14 75 / 0.12);
  --accent-line: oklch(0.60 0.14 75 / 0.30);
}

/* dim theme variant */
[data-theme="dim"] {
  --canvas:     oklch(0.22 0.008 250);
  --surface-0:  oklch(0.24 0.008 250);
  --surface-1:  oklch(0.26 0.008 250);
  --surface-2:  oklch(0.30 0.009 250);
  --surface-3:  oklch(0.34 0.010 250);
  --line:       oklch(0.36 0.008 250 / 0.7);
}
[data-theme="bloomberg"] {
  --canvas:     oklch(0.13 0.004 60);
  --surface-0:  oklch(0.16 0.004 60);
  --surface-1:  oklch(0.18 0.005 60);
  --surface-2:  oklch(0.22 0.006 60);
  --surface-3:  oklch(0.26 0.008 60);
  --accent:     oklch(0.82 0.16 75);
  --accent-2:   oklch(0.72 0.16 75);
  --accent-soft:oklch(0.82 0.16 75 / 0.14);
  --accent-line:oklch(0.82 0.16 75 / 0.35);
}

/* ── base ───────────────────────────────────────────────── */
html { font-size: 16px; }
body {
  font-family: var(--ff-ui);
  background: var(--canvas);
  color: var(--fg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv02','cv03','cv04','ss01';
  font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: oklch(0.32 0.006 250 / 0.6); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: oklch(0.40 0.008 250 / 0.8); }

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── layout shell ───────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
}

/* ── sidebar ────────────────────────────────────────────── */
.nav {
  background: var(--surface-0);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--canvas);
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  letter-spacing: -0.04em;
  font-family: var(--ff-mono);
}
.brand-name {
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-tier {
  font-size: 9px; color: var(--fg-4);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-top: 1px;
}

.nav-search {
  margin: 10px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color .15s;
}
.nav-search:focus-within { border-color: var(--accent-line); }
.nav-search input {
  background: none; border: none; outline: none;
  color: var(--fg); font-size: 12px; width: 100%;
  font-family: var(--ff-ui);
}
.nav-search input::placeholder { color: var(--fg-4); }
.kbd {
  font-family: var(--ff-mono);
  font-size: 10px; color: var(--fg-4);
  padding: 1px 5px; border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-left: auto;
}

.nav-section {
  font-size: 10px; font-weight: 500;
  color: var(--fg-4);
  text-transform: uppercase; letter-spacing: 0.10em;
  padding: 12px 14px 4px;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px; font-weight: 500;
  color: var(--fg-2);
  border-left: 2px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.nav-item:hover { background: var(--surface-1); color: var(--fg); }
.nav-item.is-active {
  background: var(--surface-1);
  color: var(--fg);
  border-left-color: var(--accent);
}
.nav-item-l { display: flex; align-items: center; gap: 10px; }
.nav-ico { color: var(--fg-3); flex-shrink: 0; transition: color .12s; }
.nav-item:hover .nav-ico, .nav-item.is-active .nav-ico { color: var(--fg-2); }
.nav-item.is-active .nav-ico { color: var(--accent); }
.nav-count {
  font-family: var(--ff-mono);
  font-size: 10px; font-weight: 600;
  background: var(--surface-2);
  color: var(--fg-3);
  padding: 1px 6px; border-radius: 4px;
}
.nav-count.is-alert { background: var(--down-soft); color: var(--down); }

.nav-sep { height: 1px; background: var(--line); margin: 10px 14px; }

.watch {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 14px;
  font-size: 11px;
  cursor: pointer;
  transition: background .12s;
}
.watch:hover { background: var(--surface-1); }
.watch-name { font-weight: 600; color: var(--fg-2); }
.watch-px { color: var(--fg-3); font-family: var(--ff-mono); }
.watch-chg { font-family: var(--ff-mono); font-size: 10px; }
.watch-r { text-align: right; line-height: 1.3; }

.nav-foot {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--line);
}
.nav-user {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; cursor: pointer;
  border-radius: var(--r-sm);
  transition: background .12s;
}
.nav-user:hover { background: var(--surface-1); }
.nav-avatar {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: oklch(0.18 0.005 250);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}
.nav-uname { font-size: 12px; font-weight: 600; color: var(--fg); line-height: 1.1; }
.nav-uemail { font-size: 10px; color: var(--fg-4); margin-top: 2px; }

/* ── topbar ─────────────────────────────────────────────── */
.main {
  display: flex; flex-direction: column;
  min-width: 0;
}
.top {
  display: flex; align-items: center; gap: 14px;
  height: var(--top-h);
  padding: 0 16px;
  background: var(--surface-0);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
}
.crumb-section { color: var(--fg-4); font-weight: 500; }
.crumb-sep { color: var(--fg-4); }
.crumb-page { color: var(--fg); font-weight: 600; }

.top-spacer { flex: 1; }

.session {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  background: var(--up-soft);
  border: 1px solid var(--up-line);
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  color: var(--up);
  letter-spacing: 0.02em;
}
.dot-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 0 var(--up);
  animation: ringPulse 1.8s ease-out infinite;
}
@keyframes ringPulse {
  0%   { box-shadow: 0 0 0 0 oklch(0.76 0.17 150 / 0.55); }
  70%  { box-shadow: 0 0 0 7px oklch(0.76 0.17 150 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.76 0.17 150 / 0); }
}

.clock-pill {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--ff-mono); font-size: 11px;
  color: var(--fg-3);
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
}
.clock-pill .clock-mkt { color: var(--fg-4); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; }

.pill-row { display: flex; gap: 6px; }
.kpi-pill {
  display: flex; flex-direction: column;
  padding: 3px 12px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  min-width: 76px;
}
.kpi-pill-l {
  font-size: 9px; color: var(--fg-4);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.kpi-pill-v {
  font-size: 12px; font-weight: 600;
  font-family: var(--ff-mono);
  color: var(--fg);
  letter-spacing: -0.01em;
}
.kpi-pill-v.up { color: var(--up); }
.kpi-pill-v.dn { color: var(--down); }
.kpi-pill-v.ac { color: var(--accent); }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg-3);
  transition: all .12s;
}
.icon-btn:hover { background: var(--surface-1); color: var(--fg); border-color: var(--line-strong); }

/* ── content ────────────────────────────────────────────── */
.content {
  flex: 1; overflow-y: auto;
  padding: 16px;
}
.view { display: none; }
.view.is-active { display: block; }

.view-hdr {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 14px;
  gap: 14px;
}
.view-title {
  font-size: 20px; font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.1;
}
.view-sub {
  font-size: 12px; color: var(--fg-3);
  margin-top: 4px;
}
.view-sub .sep { color: var(--fg-4); margin: 0 6px; }
.view-sub b { color: var(--fg-2); font-weight: 500; }

.view-actions { display: flex; gap: 6px; align-items: center; }

/* ── buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  font-size: 12px; font-weight: 500;
  border: 1px solid transparent;
  transition: all .12s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: oklch(0.18 0.005 250);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--fg-2);
}
.btn-ghost:hover { background: var(--surface-1); color: var(--fg); border-color: var(--line-strong); }
.btn-solid {
  background: var(--surface-2);
  color: var(--fg);
  border-color: var(--line);
}
.btn-solid:hover { background: var(--surface-3); }
.btn-danger {
  background: var(--down-soft);
  color: var(--down);
  border-color: var(--down-line);
}
.btn-danger:hover { background: oklch(0.68 0.20 25 / 0.2); }
.btn-sm { height: 24px; padding: 0 9px; font-size: 11px; gap: 5px; }
.btn-lg { height: 34px; padding: 0 16px; font-size: 13px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

/* ── panels & cards ─────────────────────────────────────── */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.panel + .panel { margin-top: 12px; }

.panel-hdr {
  display: flex; align-items: center; justify-content: space-between;
  height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}
.panel-hdr-l { display: flex; align-items: center; gap: 12px; }
.panel-title {
  font-size: 11px; font-weight: 600;
  color: var(--fg-2);
  text-transform: uppercase; letter-spacing: 0.09em;
}
.panel-meta {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--fg-4);
}
.panel-body { padding: 14px; }
.panel-body.flush { padding: 0; }

/* segmented control */
.seg {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.seg button {
  border: none; background: none;
  padding: 3px 10px;
  font-size: 11px; font-weight: 500;
  color: var(--fg-3);
  border-radius: 4px;
  transition: all .12s;
}
.seg button:hover { color: var(--fg-2); }
.seg button.on {
  background: var(--surface-0);
  color: var(--fg);
  box-shadow: 0 0 0 1px var(--line);
}

/* tag/badge */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  font-family: var(--ff-ui);
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag-up   { background: var(--up-soft);   color: var(--up);   border-color: var(--up-line); }
.tag-dn   { background: var(--down-soft); color: var(--down); border-color: var(--down-line); }
.tag-info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.tag-ac   { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.tag-mute { background: var(--surface-2); color: var(--fg-3); border-color: var(--line); }

/* ── ticker strip ───────────────────────────────────────── */
.ticker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 12px;
}
.tk {
  padding: 9px 14px;
  border-right: 1px solid var(--line);
}
.tk:last-child { border-right: none; }
.tk-name {
  font-size: 9.5px;
  color: var(--fg-4);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.tk-px {
  font-size: 15px; font-weight: 600;
  font-family: var(--ff-mono);
  letter-spacing: -0.01em;
  color: var(--fg);
}
.tk-chg {
  font-size: 10.5px; font-weight: 500;
  font-family: var(--ff-mono);
  margin-top: 2px;
}
.tk-chg.up { color: var(--up); }
.tk-chg.dn { color: var(--down); }
.tk-chg.mute { color: var(--fg-3); }

/* ── KPI grid (dashboard) ───────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.kpi {
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .12s;
}
.kpi:hover { border-color: var(--line-strong); }
.kpi-l {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 7px;
}
.kpi-lbl {
  font-size: 10px; font-weight: 500;
  color: var(--fg-4);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.kpi-v {
  font-size: 19px; font-weight: 600;
  font-family: var(--ff-mono);
  letter-spacing: -0.02em;
  line-height: 1;
}
.kpi-sub {
  font-size: 10.5px;
  color: var(--fg-3);
  margin-top: 5px;
  font-family: var(--ff-mono);
}
.kpi-sub.up { color: var(--up); }
.kpi-sub.dn { color: var(--down); }
.kpi-spark { width: 36px; height: 14px; }

/* ── tables ─────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead tr { background: var(--surface-2); }
.tbl th {
  padding: 7px 12px;
  text-align: left;
  font-size: 9.5px; font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--surface-2);
  z-index: 2;
}
.tbl th.r, .tbl td.r { text-align: right; }
.tbl th.c, .tbl td.c { text-align: center; }
.tbl td {
  padding: 0 12px;
  height: var(--row-h);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--fg-2);
  font-family: var(--ff-mono);
  white-space: nowrap;
}
.tbl td.name { color: var(--fg); font-weight: 500; font-family: var(--ff-ui); }
.tbl tbody tr { transition: background .08s; }
.tbl tbody tr:hover td { background: var(--surface-1); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl td.up { color: var(--up); }
.tbl td.dn { color: var(--down); }
.tbl td.ac { color: var(--accent); }
.tbl td.mute { color: var(--fg-4); }

/* ── equity chart ───────────────────────────────────────── */
.equity-hdr {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 14px;
  gap: 14px;
}
.equity-val {
  font-size: 26px; font-weight: 600;
  font-family: var(--ff-mono);
  letter-spacing: -0.02em;
  line-height: 1;
}
.equity-chg {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px; font-weight: 600;
  color: var(--up);
  font-family: var(--ff-mono);
}
.equity-sub {
  font-size: 11px; color: var(--fg-4);
  margin-top: 5px;
}
.equity-svg {
  display: block;
  width: 100%;
  height: 130px;
}

/* ── grids ──────────────────────────────────────────────── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g2-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.g5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }

/* ── option chain ───────────────────────────────────────── */

/* Chain view: hidden by default, flex column when active — only the table body scrolls */
#v-chain { display: none; }
#v-chain.is-active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px - 32px); /* viewport - topbar - content padding */
  overflow: hidden;
}
/* Propagate flex down through the panel so chain-table-wrap can fill remaining space */
#v-chain .view-hdr { flex-shrink: 0; }
#v-chain .panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: visible; /* chain-table-wrap handles its own overflow */
}
#v-chain .chain-toolbar { flex-shrink: 0; }
#v-chain .chain-head    { flex-shrink: 0; }
#v-chain .legs-foot     { flex-shrink: 0; }
.chain-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}

.chain-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
  flex-wrap: wrap;
}
.field {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--fg-3);
}
.field-input, .field-select {
  height: 26px;
  padding: 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg);
  font-size: 12px;
  outline: none;
  font-family: var(--ff-ui);
  transition: border-color .12s;
}
.field-select { padding-right: 22px; }
.field-input:focus, .field-select:focus { border-color: var(--accent-line); }
.field-input.mono { font-family: var(--ff-mono); }

.chip-row { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  font-size: 11px; font-weight: 500;
  padding: 4px 9px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--fg-3);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .12s;
  font-family: var(--ff-mono);
}
.chip:hover { color: var(--fg); border-color: var(--line-strong); }
.chip.on {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}

.chain-head {
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.chain-head > div {
  padding: 7px 10px;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  text-align: center;
}
.chain-head .ce { color: var(--up); text-align: right; padding-right: 16px; }
.chain-head .pe { color: var(--down); text-align: left;  padding-left: 16px; }
.chain-head .strike { color: var(--fg-3); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

table.chain {
  width: 100%; border-collapse: collapse;
  table-layout: fixed;
}
table.chain th {
  padding: 6px 10px;
  font-size: 9px; font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
  text-align: right;
  position: sticky;
  top: 0;
  z-index: 2;
}
table.chain th.l { text-align: left; }
table.chain th.c { text-align: center; }
table.chain td {
  padding: 0 10px;
  height: var(--row-h);
  font-size: 11.5px;
  font-family: var(--ff-mono);
  text-align: right;
  color: var(--fg-2);
  border-bottom: 1px solid var(--line);
}
table.chain td.ce-data { color: oklch(0.76 0.17 150 / 0.95); }
table.chain td.pe-data { color: oklch(0.68 0.20 25 / 0.95); }
table.chain td.dim { color: var(--fg-4); font-size: 10.5px; }
table.chain td.strike {
  text-align: center;
  color: var(--fg);
  font-weight: 600;
  background: var(--surface-2);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
table.chain tr.atm td.strike {
  color: var(--accent);
  background: var(--accent-soft);
}
table.chain tr.atm td { background: oklch(0.78 0.135 75 / 0.04); }
table.chain tr:hover td:not(.strike) { background: var(--surface-2); }

/* OI mini-bar inside chain cells */
.oi-bar {
  position: relative;
  display: inline-block;
  width: 100%;
  height: 100%;
  text-align: right;
  padding-right: 0;
}
.oi-bar::before {
  content: '';
  position: absolute;
  top: 50%; transform: translateY(-50%);
  right: 0;
  height: 14px;
  background: currentColor;
  opacity: 0.10;
  border-radius: 1px;
  pointer-events: none;
}

/* ── strategy builder ───────────────────────────────────── */
.ctx-bar {
  display: flex; align-items: stretch;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.ctx-cell {
  padding: 10px 16px;
  border-right: 1px solid var(--line);
  flex-shrink: 0;
  min-width: 86px;
}
.ctx-cell:last-child { border-right: none; }
.ctx-lbl {
  font-size: 9px; color: var(--fg-4);
  text-transform: uppercase; letter-spacing: 0.10em;
  margin-bottom: 4px;
}
.ctx-v {
  font-size: 13px; font-weight: 600;
  font-family: var(--ff-mono);
  color: var(--fg);
  letter-spacing: -0.01em;
}
.ctx-v.up { color: var(--up); }
.ctx-v.dn { color: var(--down); }
.ctx-v.ac { color: var(--accent); }

/* strategy picker */
.pick {
  display: flex; gap: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.sc {
  flex-shrink: 0;
  width: 168px;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .12s;
  position: relative;
}
.sc:hover { background: var(--surface-3); border-color: var(--line-strong); }
.sc.sel {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.sc-name {
  font-size: 12px; font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
  line-height: 1.25;
}
.sc-legs {
  font-size: 9.5px; font-family: var(--ff-mono);
  color: var(--fg-4);
  margin-bottom: 8px;
  line-height: 1.5;
  word-break: break-all;
}
.sc-foot {
  display: flex; justify-content: space-between; align-items: center;
}
.sc-foot .px {
  font-size: 10px; font-family: var(--ff-mono);
}

/* legs table */
.legs-tbl { width: 100%; border-collapse: collapse; }
.legs-tbl th {
  padding: 7px 12px;
  font-size: 9.5px; font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  text-align: left;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}
.legs-tbl td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  vertical-align: middle;
}
.legs-tbl tr:last-child td { border-bottom: none; }
.legs-tbl tr:hover td { background: var(--surface-2); }
.leg-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 700;
  color: var(--fg-3);
  font-family: var(--ff-mono);
}
.inp {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg);
  padding: 4px 8px;
  font-size: 11.5px;
  font-family: var(--ff-mono);
  outline: none;
  transition: border-color .12s;
}
.inp:focus { border-color: var(--accent-line); }
.inp.up { color: var(--up); font-weight: 600; }
.inp.dn { color: var(--down); font-weight: 600; }

.leg-tag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--fg-2);
}
.icon-del {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: transparent; border: none;
  color: var(--fg-4);
  border-radius: var(--r-xs);
  transition: all .12s;
}
.icon-del:hover { background: var(--down-soft); color: var(--down); }

.legs-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-1);
  font-size: 11px; color: var(--fg-4);
}

/* summary */
.sum-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-top: 12px;
}
.sum-cell { background: var(--surface-1); padding: 11px 13px; }
.sum-lbl {
  font-size: 9.5px; color: var(--fg-4);
  text-transform: uppercase; letter-spacing: 0.09em;
  margin-bottom: 4px;
}
.sum-v {
  font-size: 16px; font-weight: 600;
  font-family: var(--ff-mono);
  letter-spacing: -0.01em;
}

.callout {
  margin-top: 10px;
  padding: 9px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  font-size: 11.5px; color: var(--fg-2);
  line-height: 1.55;
  display: flex; gap: 9px;
}
.callout strong { color: var(--accent); font-weight: 600; }

/* payoff */
.payoff-wrap { position: relative; height: 280px; padding: 14px; }
.payoff-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px; font-family: var(--ff-mono);
  color: var(--fg-3);
}
.payoff-legend span.lk { color: var(--fg); }

/* scenario table */
.scen { width: 100%; border-collapse: collapse; }
.scen th, .scen td {
  padding: 6px 14px;
  font-size: 11px;
  border-bottom: 1px solid var(--line);
}
.scen th {
  background: var(--surface-1);
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  font-size: 9.5px;
  text-align: left;
}
.scen th.r, .scen td.r { text-align: right; }
.scen td { font-family: var(--ff-mono); color: var(--fg-2); }
.scen tr:last-child td { border-bottom: none; }

/* ── portfolio ──────────────────────────────────────────── */
.port-card {
  padding: 14px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  position: relative;
}
.port-card .lbl {
  font-size: 10px;
  color: var(--fg-4);
  text-transform: uppercase; letter-spacing: 0.10em;
  margin-bottom: 8px;
}
.port-card .v {
  font-size: 22px; font-weight: 600;
  font-family: var(--ff-mono);
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.port-card .v.up { color: var(--up); }
.port-card .v.dn { color: var(--down); }
.port-card .v.ac { color: var(--accent); }
.port-card .v.info { color: var(--info); }
.port-card .s {
  font-size: 11px; color: var(--fg-3);
  margin-top: 5px;
}

/* margin meter */
.meter-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.meter-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), oklch(0.78 0.135 75 / 0.4));
  border-radius: 3px;
}
.meter-ticks {
  display: flex; justify-content: space-between;
  font-size: 10px;
  font-family: var(--ff-mono);
  color: var(--fg-4);
  margin-top: 6px;
}

/* ── AI Advisor (rebuild) ───────────────────────────────── */

/* hero brief */
.brief-hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  margin-bottom: 12px;
}
.brief-main {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.brief-main::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
}
.brief-stamp {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px;
  color: var(--fg-3);
  font-family: var(--ff-mono);
  margin-bottom: 14px;
}
.brief-stamp .dot { color: var(--fg-4); }
.brief-headline {
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.65;
  color: var(--fg-2);
  margin-bottom: 14px;
  text-wrap: pretty;
}
.brief-headline b { color: var(--fg); font-weight: 600; }
.brief-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.brief-chip {
  padding: 9px 12px;
  background: var(--surface-1);
  display: flex; flex-direction: column;
  gap: 3px;
}
.brief-chip-l {
  font-size: 9px;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}
.brief-chip-v {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  font-family: var(--ff-ui);
}
.brief-chip-v.up { color: var(--up); }
.brief-chip-v.dn { color: var(--down); }
.brief-chip-v.ac { color: var(--accent); }
.brief-chip-m {
  font-size: 10px;
  color: var(--fg-4);
  font-family: var(--ff-mono);
}

.brief-side {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 16px 14px;
}
.brief-side-t {
  font-size: 10px; font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 12px;
}
.conf-row {
  display: grid;
  grid-template-columns: 80px 1fr 38px;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 11px;
}
.conf-l { color: var(--fg-3); }
.conf-track {
  height: 5px;
  background: var(--surface-2);
  border-radius: 2.5px;
  overflow: hidden;
}
.conf-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2.5px;
  transition: width .4s ease-out;
}
.conf-fill.up { background: var(--up); }
.conf-fill.warn { background: oklch(0.74 0.16 60); }
.conf-v {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-2);
  text-align: right;
}
.conf-overall {
  display: flex; justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--fg-3);
}
.conf-overall b {
  font-family: var(--ff-mono);
  font-size: 14px;
  font-weight: 700;
}

/* conviction ladder */
.conv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}
.conv-card {
  padding: 14px 16px;
  background: var(--surface-1);
  display: flex; flex-direction: column;
  transition: background .12s;
}
.conv-card:hover { background: var(--surface-2); }

.conv-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.grade {
  display: inline-flex; align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.grade-aplus { background: var(--up-soft); color: var(--up); border: 1px solid var(--up-line); }
.grade-a     { background: var(--up-soft); color: var(--up); border: 1px solid var(--up-line); opacity: 0.85; }
.grade-bplus { background: var(--info-soft); color: var(--info); border: 1px solid var(--info-line); }
.grade-b     { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }

.conv-rank {
  font-size: 10px;
  color: var(--fg-4);
  font-family: var(--ff-mono);
  letter-spacing: 0.04em;
}

.conv-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.conv-cat {
  font-size: 10.5px;
  color: var(--fg-4);
  margin-bottom: 11px;
}
.conv-rationale {
  font-size: 11.5px;
  color: var(--fg-2);
  line-height: 1.55;
  margin-bottom: 12px;
  flex: 1;
}
.conv-rationale b { color: var(--fg); font-weight: 500; }

.conv-payoff {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 10px 4px;
  margin-bottom: 11px;
}
.conv-payoff svg {
  display: block;
  width: 100%;
  height: 48px;
}
.conv-payoff-ticks {
  display: flex; justify-content: space-between;
  font-family: var(--ff-mono);
  font-size: 9px;
  color: var(--fg-4);
}

.conv-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin-bottom: 12px;
  font-family: var(--ff-mono);
}
.conv-metrics > div { padding: 0 4px; }
.conv-metrics > div:first-child { padding-left: 0; }
.conv-metric-l {
  font-size: 9px;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
  font-family: var(--ff-ui);
}
.conv-metric-v {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}
.conv-metric-v.up { color: var(--up); }
.conv-metric-v.dn { color: var(--down); }

.conv-actions {
  display: flex; gap: 6px;
  margin-top: auto;
}
.conv-actions .btn { flex: 1; justify-content: center; }

/* radar */
.radar-wrap {
  position: relative;
  padding: 18px;
}
.radar-svg { display: block; width: 100%; height: auto; }
.radar-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 16px;
  padding: 0 18px 14px;
  font-size: 10.5px;
}
.radar-legend > div { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.radar-legend .lbl { color: var(--fg-3); font-size: 10px; }
.radar-legend .v { font-family: var(--ff-mono); font-weight: 500; color: var(--fg-2); }
.radar-legend .v.warn { color: var(--accent); }
.radar-legend .v.danger { color: var(--down); }
.radar-legend .v.ok { color: var(--up); }

/* vol & flow */
.vf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}
.vf-cell {
  background: var(--surface-1);
  padding: 14px 16px;
}
.vf-l {
  font-size: 10px;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 4px;
}
.vf-chart {
  margin-top: 10px;
  position: relative;
}
.vf-chart svg { display: block; width: 100%; height: 90px; }

/* watchlist briefs */
.brief-row {
  display: grid;
  grid-template-columns: 100px 90px 90px 1fr 90px;
  align-items: center;
  padding: 11px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  transition: background .12s;
}
.brief-row:last-child { border-bottom: none; }
.brief-row:hover { background: var(--surface-2); }
.brief-row .sym { font-weight: 600; color: var(--fg); font-size: 13px; }
.brief-row .px { font-family: var(--ff-mono); color: var(--fg-2); }
.brief-row .px .chg { display: block; font-size: 10px; margin-top: 1px; }
.brief-row .note { color: var(--fg-2); line-height: 1.5; font-size: 11.5px; }
.brief-row .note b { color: var(--fg); font-weight: 500; }

/* ask greeqs (chat redesign) */
/* ── Floating Chat FAB + Window ─────────────────────────────────────────── */
.fchat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, oklch(0.92 0.135 75), var(--accent) 60%, var(--accent-2));
  box-shadow: 0 4px 20px oklch(0.7 0.18 255 / 0.35), 0 1px 4px oklch(0 0 0 / 0.2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  border: none;
  color: oklch(0.12 0.005 250);
}
.fchat-fab:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px oklch(0.7 0.18 255 / 0.45), 0 2px 6px oklch(0 0 0 / 0.2);
}
.fchat-fab-open  { display: grid; place-items: center; }
.fchat-fab-close { display: none; place-items: center; }
.fchat-fab.is-open .fchat-fab-open  { display: none; }
.fchat-fab.is-open .fchat-fab-close { display: grid; }

.fchat-win {
  position: fixed;
  bottom: 88px;
  right: 24px;
  z-index: 1099;
  width: 370px;
  max-height: 580px;
  display: flex;
  flex-direction: column;
  background: var(--surface-0);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 48px oklch(0 0 0 / 0.22), 0 2px 8px oklch(0 0 0 / 0.1);
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease;
  opacity: 1;
  transform: scale(1) translateY(0);
}
.fchat-win[aria-hidden="true"] {
  opacity: 0;
  transform: scale(0.94) translateY(10px);
  pointer-events: none;
}

.fchat-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
  flex-shrink: 0;
}
.fchat-hdr-r { display: flex; align-items: center; gap: 6px; }
.fchat-title { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.fchat-sub   { font-size: 10px; color: var(--fg-4); margin-top: 1px; }

.fchat-close {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: none;
  border: none;
  color: var(--fg-3);
  cursor: pointer;
  transition: background .1s, color .1s;
}
.fchat-close:hover { background: var(--surface-2); color: var(--fg); }

.fchat-prompts {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
  flex-shrink: 0;
}
.fchat-prompts .ask-prompt { font-size: 10.5px; height: 24px; padding: 0 9px; }

.fchat-thread {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.fchat-input-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-0);
  flex-shrink: 0;
}
.fchat-input {
  flex: 1;
  height: 32px;
  padding: 0 11px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg);
  font-size: 12.5px;
  font-family: var(--ff-ui);
  outline: none;
  transition: border-color .12s;
}
.fchat-input:focus { border-color: var(--accent-line); }
.fchat-input::placeholder { color: var(--fg-4); }

.ask-wrap {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.ask-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.ask-hdr-l {
  display: flex; align-items: center; gap: 10px;
}
.ask-orb {
  width: 26px; height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, oklch(0.92 0.135 75), var(--accent) 60%, var(--accent-2));
  box-shadow: 0 0 12px var(--accent-soft);
  flex-shrink: 0;
}
.ask-hdr-t { font-size: 13px; font-weight: 600; color: var(--fg); }
.ask-hdr-s { font-size: 10.5px; color: var(--fg-4); margin-top: 1px; }

.ask-prompts {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}
.ask-prompt {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 11.5px;
  color: var(--fg-2);
  transition: all .12s;
}
.ask-prompt:hover {
  background: var(--surface-3);
  border-color: var(--accent-line);
  color: var(--fg);
}
.ask-prompt svg { color: var(--fg-4); }
.ask-prompt:hover svg { color: var(--accent); }

.ask-thread {
  padding: 16px;
  max-height: 280px;
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 14px;
}

.ask-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-0);
}
.ask-context-tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px;
  padding: 0 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}
.ask-input {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg);
  font-size: 13px;
  font-family: var(--ff-ui);
  outline: none;
  transition: border-color .12s;
}
.ask-input:focus { border-color: var(--accent-line); }
.ask-input::placeholder { color: var(--fg-4); }
.ask-actions { display: flex; gap: 4px; }
.ask-mic, .ask-send {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  transition: all .12s;
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--fg-3);
}
.ask-mic:hover { color: var(--fg); border-color: var(--line-strong); }
.ask-send {
  background: var(--accent);
  border-color: var(--accent);
  color: oklch(0.18 0.005 250);
}
.ask-send:hover { background: var(--accent-2); }

/* chat */
.chat {
  display: flex; flex-direction: column;
  height: 420px;
}
.chat-msgs {
  flex: 1; overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.msg { display: flex; gap: 9px; max-width: 84%; }
.msg.you { align-self: flex-end; flex-direction: row-reverse; }
.msg-av {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
  font-family: var(--ff-mono);
}
.msg.ai .msg-av { background: var(--accent); color: oklch(0.18 0.005 250); }
.msg.you .msg-av { background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--line); }
.bubble {
  padding: 9px 13px;
  font-size: 12px;
  line-height: 1.65;
  border-radius: var(--r-md);
}
.msg.ai .bubble {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--fg);
  border-top-left-radius: 3px;
}
.msg.you .bubble {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--fg);
  border-top-right-radius: 3px;
}
.ai-streaming { white-space: pre-wrap; }
.ai-hdr {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-top: 12px;
  margin-bottom: 3px;
}
.ai-hdr:first-child { margin-top: 0; }
.ai-li {
  padding-left: 12px;
  position: relative;
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.6;
}
.ai-li::before {
  content: '·';
  position: absolute;
  left: 2px;
  color: var(--fg-4);
}
.ai-gap { height: 3px; }
.bubble code { background: var(--surface-3); padding: 1px 4px; border-radius: 3px; font-size: 11px; }
.chat-input-row {
  display: flex; gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.chat-input {
  flex: 1;
  height: 32px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg);
  font-size: 12.5px;
  font-family: var(--ff-ui);
  outline: none;
  transition: border-color .12s;
}
.chat-input:focus { border-color: var(--accent-line); }
.chat-input::placeholder { color: var(--fg-4); }
.btn-send {
  width: 32px; height: 32px;
  background: var(--accent);
  border: none; border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: oklch(0.18 0.005 250);
  transition: transform .12s;
}
.btn-send:hover { transform: scale(1.04); }

/* ── tab bar (orders) ───────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.tab {
  height: 32px;
  padding: 0 16px;
  background: none;
  border: none;
  font-size: 12px; font-weight: 500;
  color: var(--fg-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .12s;
}
.tab:hover { color: var(--fg-2); }
.tab.on { color: var(--fg); border-bottom-color: var(--accent); }

/* ── empty states ───────────────────────────────────────── */
.empty {
  padding: 36px 14px;
  text-align: center;
  color: var(--fg-4);
  font-size: 12px;
}
.empty b { color: var(--fg-2); font-weight: 500; }

/* ── chain inline B/S buttons ───────────────────────────── */
.ltp-cell {
  display: flex; align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.ltp-cell.right { justify-content: flex-end; }
.ltp-cell.left  { justify-content: flex-start; }
.ltp-val {
  font-family: var(--ff-mono);
  font-size: 11.5px;
  font-weight: inherit;
}
.bs-btn {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
  border-radius: 3px;
  font-size: 9.5px; font-weight: 700;
  font-family: var(--ff-mono);
  letter-spacing: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, transform .12s, background .12s;
  border: 1px solid transparent;
  background: transparent;
  line-height: 1;
}
table.chain tr:hover .bs-btn { opacity: 1; }
.bs-btn:hover { transform: scale(1.08); }
.bs-buy {
  color: var(--up);
  background: var(--up-soft);
  border-color: var(--up-line);
}
.bs-buy:hover { background: oklch(0.76 0.17 150 / 0.25); }
.bs-sell {
  color: var(--down);
  background: var(--down-soft);
  border-color: var(--down-line);
}
.bs-sell:hover { background: oklch(0.68 0.20 25 / 0.25); }

/* ATM row: keep buttons visible at low opacity */
table.chain tr.atm .bs-btn { opacity: 0.55; }
table.chain tr.atm:hover .bs-btn { opacity: 1; }

/* ── Order Basket (floating) ────────────────────────────── */
.order-pad {
  position: fixed;
  bottom: 16px; right: 16px;
  width: 400px;
  max-height: calc(100vh - 32px);
  background: var(--surface-0);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 16px 40px oklch(0 0 0 / 0.55), 0 0 0 1px var(--line);
  z-index: 100;
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(0);
  transition: transform .2s ease, opacity .2s ease;
  font-family: var(--ff-ui);
}
.order-pad.hidden {
  transform: translateY(calc(100% + 16px));
  opacity: 0;
  pointer-events: none;
}
.order-pad.minimized .op-body,
.order-pad.minimized .op-foot {
  display: none;
}

.op-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
  cursor: grab;
  user-select: none;
}
.op-hdr:active { cursor: grabbing; }
.op-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg);
}
.op-title .basket-ico {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  color: var(--accent);
}
.op-count {
  display: inline-flex; align-items: center;
  height: 18px; padding: 0 6px;
  background: var(--accent);
  color: oklch(0.18 0.005 250);
  border-radius: 9px;
  font-family: var(--ff-mono);
  font-size: 10px; font-weight: 700;
}
.op-hdr-actions { display: flex; gap: 2px; }
.op-icon-btn {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: none; background: none;
  color: var(--fg-3);
  border-radius: 4px;
  transition: all .12s;
}
.op-icon-btn:hover { background: var(--surface-2); color: var(--fg); }

.op-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  max-height: 320px;
}
.op-empty {
  padding: 36px 14px;
  text-align: center;
  color: var(--fg-4);
  font-size: 12px;
  line-height: 1.6;
}
.op-empty b { color: var(--fg-2); font-weight: 500; }

.op-leg {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  margin-bottom: 6px;
  position: relative;
}
.op-leg:last-child { margin-bottom: 0; }
.op-leg-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.op-leg-id {
  display: inline-flex; align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-3);
}
.op-leg-num {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border-radius: 50%;
  font-family: var(--ff-mono);
  font-size: 10px; font-weight: 700;
  color: var(--fg-3);
}
.op-leg-instr {
  font-weight: 600;
  color: var(--fg);
  font-size: 12px;
}
.op-leg-instr .strike { color: var(--accent); font-family: var(--ff-mono); }
.op-leg-instr .type-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9.5px;
  font-family: var(--ff-mono);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.op-leg-instr .type-tag.ce { background: var(--up-soft); color: var(--up); }
.op-leg-instr .type-tag.pe { background: var(--down-soft); color: var(--down); }

.op-leg-fields {
  display: grid;
  grid-template-columns: 70px 50px 1fr 90px;
  gap: 6px;
  align-items: center;
}
.op-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.op-toggle button {
  flex: 1;
  border: none;
  height: 24px;
  background: none;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--ff-mono);
  color: var(--fg-4);
  cursor: pointer;
  padding: 0 6px;
  transition: all .1s;
}
.op-toggle button.on.buy {
  background: var(--up-soft);
  color: var(--up);
  box-shadow: inset 0 -1.5px 0 var(--up);
}
.op-toggle button.on.sell {
  background: var(--down-soft);
  color: var(--down);
  box-shadow: inset 0 -1.5px 0 var(--down);
}

.op-input, .op-select {
  height: 24px;
  padding: 0 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
  font-size: 11px;
  font-family: var(--ff-mono);
  outline: none;
  width: 100%;
  transition: border-color .12s;
}
.op-input:focus, .op-select:focus { border-color: var(--accent-line); }

.op-leg-del {
  position: absolute;
  top: 6px; right: 6px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  background: none; border: none;
  color: var(--fg-4);
  border-radius: 3px;
  font-size: 14px;
  line-height: 1;
  transition: all .12s;
}
.op-leg-del:hover { background: var(--down-soft); color: var(--down); }

.op-foot {
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}
.op-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 10px 14px;
  gap: 1px;
  background: var(--line);
}
.op-summary > div {
  background: var(--surface-1);
  padding: 0 8px;
}
.op-summary > div:first-child { padding-left: 0; }
.op-summary > div:last-child { padding-right: 0; }
.op-summary .lbl {
  font-size: 9px;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.op-summary .v {
  font-family: var(--ff-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.op-summary .v.up { color: var(--up); }
.op-summary .v.dn { color: var(--down); }
.op-summary .v.ac { color: var(--accent); }

.op-cta {
  display: flex; gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.op-cta .btn { flex: 1; justify-content: center; height: 32px; }

/* Re-open button (when basket exists but pad closed) */
.basket-fab {
  position: fixed;
  bottom: 16px; right: 16px;
  z-index: 99;
  display: none;
  align-items: center; gap: 8px;
  padding: 0 14px;
  height: 40px;
  background: var(--accent);
  color: oklch(0.18 0.005 250);
  border: none;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.4);
  transition: transform .12s;
}
.basket-fab:hover { transform: translateY(-2px); }
.basket-fab.show { display: inline-flex; }
.basket-fab .pip {
  display: inline-grid; place-items: center;
  height: 18px; min-width: 18px;
  padding: 0 5px;
  background: oklch(0.18 0.005 250);
  color: var(--accent);
  border-radius: 9px;
  font-family: var(--ff-mono);
  font-size: 10px; font-weight: 700;
}

/* ── misc ───────────────────────────────────────────────── */
.mono { font-family: var(--ff-mono); }
.fg-2 { color: var(--fg-2); }
.fg-3 { color: var(--fg-3); }
.fg-4 { color: var(--fg-4); }
.up { color: var(--up); }
.dn { color: var(--down); }
.ac { color: var(--accent); }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.row { display: flex; gap: 8px; align-items: center; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }

/* admin */
.form-row { margin-bottom: 12px; }
.form-lbl {
  font-size: 10px; color: var(--fg-4);
  text-transform: uppercase; letter-spacing: 0.09em;
  margin-bottom: 5px;
}
.form-input {
  width: 100%; height: 32px; padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--fg);
  font-size: 12.5px;
  outline: none;
  transition: border-color .12s;
}
.form-input:focus { border-color: var(--accent-line); }

/* tweak panel hooks */
.tweak-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.tweak-swatch.on { border-color: var(--fg); transform: scale(1.1); }

/* utility: hide elements but keep accessible */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
