/* iVEX design system v2 — simulated marketplace. Tokens live on :root; dark theme via data-theme. */
:root {
  --navy: #0b2545; --navy-2: #13315c; --teal: #0f9d8f; --teal-2: #0b7f74; --cyan: #0891b2;
  --blue: #2563eb; --green: #15803d; --red: #b91c1c; --amber: #b45309; --violet: #6d28d9;
  --bg: #f4f7fb; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #eef3f9;
  --text: #0f172a; --muted: #5b6b82; --border: #e2e8f0; --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px -12px rgba(15,23,42,.18);
  --radius: 14px; --radius-sm: 9px; --focus: 0 0 0 3px rgba(15,157,143,.35);
  --pos: var(--green); --neg: var(--red);
  --pos-bg: #dcfce7; --neg-bg: #fee2e2; --warn-bg: #fef3c7; --info-bg: #dbeafe;
  --sidebar: #0b2545; --sidebar-text: #cbd5e1; --sidebar-active: rgba(15,157,143,.18);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #07101f; --surface: #0f1b2e; --surface-2: #12213a; --surface-3: #172a47;
  --text: #e6edf7; --muted: #94a3b8; --border: #22344f; --border-strong: #334a6b;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
  --pos-bg: rgba(34,197,94,.14); --neg-bg: rgba(248,113,113,.14); --warn-bg: rgba(251,191,36,.14); --info-bg: rgba(96,165,250,.14);
  --pos: #4ade80; --neg: #f87171; --sidebar: #050b16; --sidebar-active: rgba(45,212,191,.16);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #07101f; --surface: #0f1b2e; --surface-2: #12213a; --surface-3: #172a47;
    --text: #e6edf7; --muted: #94a3b8; --border: #22344f; --border-strong: #334a6b;
    --pos-bg: rgba(34,197,94,.14); --neg-bg: rgba(248,113,113,.14); --warn-bg: rgba(251,191,36,.14); --info-bg: rgba(96,165,250,.14);
    --pos: #4ade80; --neg: #f87171; --sidebar: #050b16; --sidebar-active: rgba(45,212,191,.16);
    color-scheme: dark;
  }
}

*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); min-height: 100vh; }
img, svg { max-width: 100%; }
a { color: var(--teal-2); text-decoration: none; }
a:hover { text-decoration: underline; }
:root[data-theme="dark"] a { color: #5eead4; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 750; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .8em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.strong { font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.mt { margin-top: 22px; }
.inline { display: inline; margin: 0; }
.stack > * + * { margin-top: 14px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 99; border-radius: 8px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
.symbol { font-family: var(--mono); font-weight: 650; font-size: .9rem; color: var(--text); }
a.symbol:hover { color: var(--teal-2); }

/* ---------- Simulated / demo banners ---------- */
.sim-banner, .demo-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(180,83,9,.12), rgba(180,83,9,.04));
  border: 1px solid rgba(180,83,9,.35); color: var(--amber); font-weight: 650; font-size: .8rem;
  letter-spacing: .06em; text-transform: uppercase; padding: 9px 14px; border-radius: 10px; margin: 0 0 18px;
}
:root[data-theme="dark"] .sim-banner, :root[data-theme="dark"] .demo-banner { color: #fbbf24; }
.demo-banner { color: var(--violet); background: rgba(109,40,217,.08); border-color: rgba(109,40,217,.3); }

/* ---------- Ticker ---------- */
.ticker { overflow: hidden; background: var(--navy); color: #e2e8f0; font-size: .82rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.ticker-track { display: flex; width: max-content; gap: 34px; padding: 8px 0; animation: ticker 70s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.tk { display: inline-flex; gap: 8px; align-items: baseline; white-space: nowrap; }
.tk .symbol { color: #fff; font-size: .8rem; }
.tk .tk-p { font-variant-numeric: tabular-nums; color: #cbd5e1; }
.tk .tk-up { color: #4ade80; } .tk .tk-down { color: #f87171; } .tk .tk-flat { color: #94a3b8; }
@keyframes ticker { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; flex-wrap: wrap; width: auto; justify-content: center; } .ticker [aria-hidden="true"] { display: none; } }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .25s ease; }
.sb-collapsed .shell { grid-template-columns: 72px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 16px 12px; gap: 6px; z-index: 30; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; color: #fff; text-decoration: none; }
.sidebar .brand img { height: 34px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 750; letter-spacing: .02em; }
.brand-sub { font-size: .7rem; opacity: .7; }
.nav-group { margin-top: 10px; }
.nav-label { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; opacity: .55; padding: 8px 12px 4px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--sidebar-text); font-weight: 500; position: relative; white-space: nowrap; }
.nav-link i { width: 18px; text-align: center; opacity: .85; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--sidebar-active); color: #fff; }
.nav-link.is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #2dd4bf; }
.sidebar-note { margin: 10px 4px 0; font-size: .75rem; opacity: .6; }
.sidebar-foot { margin-top: auto; padding-top: 10px; }
.collapse-btn { width: 100%; display: flex; align-items: center; gap: 10px; background: transparent; color: var(--sidebar-text); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 8px 12px; cursor: pointer; font: inherit; }
.collapse-btn:hover { color: #fff; }
.sb-collapsed .sidebar { padding-inline: 10px; }
.sb-collapsed .brand-text, .sb-collapsed .nav-label, .sb-collapsed .nav-link span, .sb-collapsed .sidebar-note, .sb-collapsed .collapse-btn span { display: none; }
.sb-collapsed .nav-link { justify-content: center; padding: 10px; }
.sb-collapsed .nav-group { border-top: 1px solid rgba(255,255,255,.08); padding-top: 6px; margin-top: 8px; }
.sb-collapsed .nav-group:first-of-type { border-top: 0; }
.scrim { position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 25; backdrop-filter: blur(2px); }
.scrim[hidden] { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; }
.cmdk-trigger { display: flex; align-items: center; gap: 10px; min-width: 240px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 7px 12px; cursor: pointer; font: inherit; font-size: .9rem; }
.cmdk-trigger:hover { border-color: var(--border-strong); }
.cmdk-trigger kbd { margin-left: auto; font: 500 .72rem var(--mono); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: var(--surface); }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 650; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); text-transform: capitalize; white-space: nowrap; }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-open { color: var(--green); } .status-open::before { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.status-closed { color: var(--red); } .status-closed::before { background: #ef4444; }
.icon-btn { position: relative; width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn .count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; }
.icon-btn.star { border: 0; background: transparent; width: 32px; height: 32px; color: var(--amber); }
.icon-btn.star:hover { background: var(--warn-bg); }
.profile { position: relative; }
.profile > summary { list-style: none; display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.profile > summary::-webkit-details-marker { display: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--teal), var(--navy-2)); color: #fff; font-weight: 700; font-size: .8rem; }
.profile-name { font-size: .88rem; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; z-index: 40; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu .menu-danger { color: var(--red); }
.menu .menu-meta { padding: 8px 10px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.content { padding: 26px clamp(16px, 3vw, 36px) 40px; width: 100%; max-width: 1360px; margin: 0 auto; flex: 1; }
.content.narrow { max-width: 920px; }
.content.wide { max-width: 1500px; }
.footer { border-top: 1px solid var(--border); padding: 18px clamp(16px,3vw,36px); color: var(--muted); font-size: .84rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-brand { font-weight: 700; color: var(--text); }
.only-mobile { display: none; }

/* ---------- Page heads ---------- */
.page-head { margin-bottom: 18px; }
.page-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head p.small { margin-top: 2px; }
.eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--teal-2); margin: 0 0 6px; }
:root[data-theme="dark"] .eyebrow { color: #5eead4; }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 70ch; }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-strip { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; padding: 22px 24px; border-radius: var(--radius); background: radial-gradient(120% 140% at 0% 0%, rgba(15,157,143,.22), transparent 60%), linear-gradient(135deg, var(--navy), var(--navy-2)); color: #e2e8f0; box-shadow: var(--shadow); }
.hero-strip h1 { color: #fff; margin: 0 0 4px; }
.hero-strip .muted { color: #b6c4d8; margin: 0; }
.hero-strip .eyebrow { color: #5eead4; }
.hero-strip .btn-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #fff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; font: 600 .9rem/1 var(--sans); cursor: pointer; text-decoration: none !important; background: var(--surface-3); color: var(--text); transition: transform .12s ease, box-shadow .15s ease, background .15s ease, opacity .15s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { box-shadow: var(--focus); outline: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: linear-gradient(135deg, var(--teal), var(--teal-2)); color: #fff; box-shadow: 0 6px 16px -8px rgba(15,157,143,.7); }
.btn-primary:hover { color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: 13px 18px; font-size: 1rem; }
.btn-block { width: 100%; }
.link-arrow { font-weight: 600; font-size: .88rem; white-space: nowrap; }
.link-arrow i { font-size: .75rem; margin-left: 2px; }

/* ---------- Panels & cards ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); min-width: 0; margin-bottom: 18px; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { margin-bottom: 2px; display: flex; align-items: center; gap: 8px; }
.panel-head p { margin: 0; }
.panel-head.pad { padding: 18px 22px 0; margin-bottom: 10px; }
.table-meta { display: flex; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; align-items: stretch; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-trade { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-main > .panel, .grid-2 > .panel, .grid-3 > .panel { margin-bottom: 18px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.chart-box { position: relative; height: 290px; }
.chart-box.chart-sm { height: 240px; }
.defs { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; align-items: baseline; }
.defs dt { color: var(--muted); font-size: .86rem; }
.defs dd { margin: 0; }
.stat-row, .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 15px; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .2s ease; }
.kpi::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--accent, var(--teal)); opacity: .85; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent, var(--teal)) 16%, transparent); color: var(--accent, var(--teal)); font-size: 1rem; }
.kpi > div { display: flex; flex-direction: column; min-width: 0; }
.kpi-l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 650; }
.kpi-v { font-size: 1.5rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-top: 2px; }
.kpi-s { font-size: .8rem; color: var(--muted); }
.kpi-teal { --accent: var(--teal); } .kpi-blue { --accent: var(--blue); } .kpi-green { --accent: var(--green); }
.kpi-cyan { --accent: var(--cyan); } .kpi-navy { --accent: var(--navy-2); } .kpi-amber { --accent: var(--amber); }
:root[data-theme="dark"] .kpi-navy { --accent: #60a5fa; }
.kpi-compact { margin-bottom: 14px; }
.kpi-compact .kpi-v { font-size: 1.25rem; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.stat-v { font-size: 1.4rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-l { font-size: .8rem; color: var(--muted); }
.cta-band { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px; border-radius: var(--radius); background: linear-gradient(120deg, var(--navy), var(--navy-2)); color: #e2e8f0; }
.cta-band h2 { color: #fff; }
.box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 16px; }
.notice i { margin-top: 3px; }
.notice-info { background: var(--info-bg); border-color: transparent; }
.notice-warn { background: var(--warn-bg); border-color: transparent; }
.notice-danger { background: var(--neg-bg); border-color: transparent; }
.notice-success { background: var(--pos-bg); border-color: transparent; }
.answer { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.empty, .empty-state { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty-state i { font-size: 2rem; color: var(--border-strong); margin-bottom: 8px; display: block; }
.empty-state p { margin: 0; }
.empty-state.compact { padding: 14px; }
.empty-state .btn { margin-top: 10px; }
.list { margin: 0; padding-left: 20px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 650; background: var(--surface-3); color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-good { background: var(--pos-bg); color: var(--green); }
.badge-bad { background: var(--neg-bg); color: var(--red); }
.badge-warn { background: var(--warn-bg); color: var(--amber); }
.badge-info { background: var(--info-bg); color: var(--blue); }
.badge-neutral { background: var(--surface-3); color: var(--muted); }
:root[data-theme="dark"] .badge-good { color: #4ade80; } :root[data-theme="dark"] .badge-bad { color: #f87171; }
:root[data-theme="dark"] .badge-warn { color: #fbbf24; } :root[data-theme="dark"] .badge-info { color: #93c5fd; }
.side-tag { display: inline-block; font: 700 .72rem var(--mono); padding: 2px 8px; border-radius: 6px; }
.side-buy { background: var(--pos-bg); color: var(--pos); }
.side-sell { background: var(--neg-bg); color: var(--neg); }
.chg { display: inline-block; font: 650 .8rem var(--mono); padding: 2px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.chg-up { color: var(--pos); background: var(--pos-bg); }
.chg-down { color: var(--neg); background: var(--neg-bg); }
.chg-flat { color: var(--muted); background: var(--surface-3); }
.spark { width: 96px; height: 30px; display: block; color: var(--teal); }
.spark-up { color: var(--green); } .spark-down { color: var(--red); }
:root[data-theme="dark"] .spark-up { color: #4ade80; } :root[data-theme="dark"] .spark-down { color: #f87171; }
.spark-empty { color: var(--border-strong); font-size: .75rem; }
.spark path, .spark polyline { vector-effect: non-scaling-stroke; }
.spark-cell { width: 110px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th.num { text-align: right; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-dense th, .table-dense td { padding: 7px 10px; font-size: .86rem; }
.table caption { text-align: left; font-weight: 650; padding: 4px 0 6px; color: var(--muted); }
.table .cell-title { font-weight: 600; }
.actions-col { text-align: right; white-space: nowrap; width: 1%; }
.actions-col form + a, .actions-col a + form { margin-left: 4px; }
.row-link { cursor: default; }
.market-table td:first-child { min-width: 110px; }

/* ---------- Filters, segments, pager ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-select { display: flex; }
.field-inline { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.field-inline select { min-width: 260px; }
.balance-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-stat { display: inline-flex; gap: 8px; align-items: baseline; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: .9rem; }
.chip-stat.chip-good { border-color: rgba(21,128,61,.35); }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--border); padding: 12px; border-radius: var(--radius); }
.search-field { position: relative; flex: 1 1 260px; min-width: 200px; }
.search-field i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input { padding-left: 36px; }
.filter-bar select { width: auto; }
.seg-ctrl { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-ctrl button { border: 0; background: transparent; color: var(--muted); font: 600 .84rem var(--sans); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg-ctrl button:hover { color: var(--text); }
.seg-ctrl button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-3); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); transition: all .15s; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented .seg-buy input:checked + span { color: var(--green); }
.segmented .seg-sell input:checked + span { color: var(--red); }
.segmented input:focus-visible + span { box-shadow: var(--focus); }
.segmented input:disabled + span { opacity: .5; cursor: not-allowed; }
.pager { display: flex; gap: 6px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pager a { min-width: 34px; text-align: center; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); color: var(--text); }
.pager a.current { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 12px; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: 400 .95rem var(--sans); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: auto; margin: 0 6px 0 0; accent-color: var(--teal); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); opacity: .7; }
textarea { min-height: 96px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: span 2; }
.radio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.radio-grid label { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-weight: 500; cursor: pointer; }
.radio-grid label:has(input:checked) { border-color: var(--teal); background: rgba(15,157,143,.08); }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.checkbox input { margin-top: 4px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { margin: 0; flex: 1 1 160px; }
.inline-form input, .inline-form select { margin-top: 0; }
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 30px 16px; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 4px; }
.auth-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 16px 0 0; }
.auth-links span { color: var(--muted); }
.demo-hint { margin-top: 18px; border: 1px dashed var(--violet); border-radius: var(--radius-sm); padding: 12px 14px; background: rgba(109,40,217,.06); }
.demo-hint code { background: var(--surface); padding: 1px 5px; border-radius: 5px; font-size: .82rem; word-break: break-all; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* Project wizard */
.wizard-steps { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.wstep { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px 6px 6px; font: 600 .84rem var(--sans); cursor: pointer; }
.wstep span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text); font-size: .78rem; }
.wstep.active, .wstep.is-done { color: var(--text); border-color: var(--teal); }
.wstep.active span { background: var(--teal); color: #fff; }
.wizard-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.wizard-nav .btn[disabled] { opacity: .4; }
.step[hidden] { display: none; }
.step h2 { margin-bottom: 4px; }
.wizard .panel { margin-bottom: 12px; }

/* Trade ticket */
.ticket { position: sticky; top: 84px; }
.quick-fill { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.chip-btn { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 11px; font: 600 .78rem var(--sans); cursor: pointer; }
.chip-btn:hover:not([disabled]) { border-color: var(--teal); color: var(--teal-2); }
.chip-btn[disabled] { opacity: .45; cursor: not-allowed; }
.estimate { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.estimate > div { display: flex; flex-direction: column; }
.estimate strong { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.estimate-warn { grid-column: 1 / -1; margin: 0; color: var(--amber); font-size: .84rem; font-weight: 600; }
.estimate-warn[hidden] { display: none; }
.estimate-warn.bad { color: var(--red); }
.ticket-form .btn-lg { margin-top: 4px; }
.btn[data-submit].is-busy { opacity: .75; pointer-events: none; }

/* Order book */
.live-pill { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 650; color: var(--muted); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 9px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@media (prefers-reduced-motion: reduce) { .pulse-dot { animation: none; } }
.book { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.book-head, .book-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; font-size: .86rem; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.book-head { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; padding-bottom: 4px; }
.book-row { position: relative; border-radius: 6px; overflow: hidden; }
.book-row > span:not(.depth) { position: relative; }
.book-row .depth { position: absolute; top: 0; bottom: 0; right: 0; opacity: .16; z-index: 0; border-radius: 6px 0 0 6px; }
.book-row.bid .depth { background: var(--green); }
.book-row.ask .depth { background: var(--red); }
.book-row.bid:hover, .book-row.ask:hover { background: var(--surface-2); cursor: pointer; }
.book-row.flash { animation: flash 0.8s ease; }
@keyframes flash { from { background: rgba(37,99,235,.2); } to { background: transparent; } }
.book-rows { display: flex; flex-direction: column; gap: 1px; min-height: 60px; }
.book-rows .empty-state { padding: 10px; }

/* Charts toolbar, misc */
.inline-chart-controls { display: flex; gap: 8px; align-items: center; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 60; width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 12px; padding: 12px 12px 12px 14px; box-shadow: var(--shadow); animation: slideIn .3s ease; }
.toast-icon { margin-top: 2px; }
.toast-msg { flex: 1; font-size: .92rem; }
.toast-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0 2px; }
.toast-success { border-left-color: var(--green); } .toast-success .toast-icon { color: var(--green); }
.toast-danger, .toast-error { border-left-color: var(--red); } .toast-danger .toast-icon, .toast-error .toast-icon { color: var(--red); }
.toast-warning { border-left-color: var(--amber); } .toast-warning .toast-icon { color: var(--amber); }
.toast-info { border-left-color: var(--blue); } .toast-info .toast-icon { color: var(--blue); }
.toast.is-leaving { opacity: 0; transform: translateX(12px); transition: all .3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Dialogs & command palette ---------- */
dialog.modal { border: 1px solid var(--border); border-radius: 16px; padding: 22px; background: var(--surface); color: var(--text); width: min(460px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(2,6,23,.5); }
dialog.modal::backdrop, dialog.palette::backdrop { background: rgba(2,6,23,.55); backdrop-filter: blur(3px); }
.modal-body { margin-bottom: 18px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
dialog.palette { border: 1px solid var(--border); border-radius: 16px; padding: 0; background: var(--surface); color: var(--text); width: min(640px, calc(100vw - 24px)); margin-top: 10vh; box-shadow: 0 30px 80px -20px rgba(2,6,23,.6); overflow: hidden; }
.palette-box { display: flex; flex-direction: column; }
.palette-input { margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 16px 18px; font-size: 1rem; background: transparent; }
.palette-input:focus { box-shadow: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.palette-list li a, .palette-list li button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500; }
.palette-list li[aria-selected="true"] a { background: var(--surface-3); }
.palette-list li i { width: 18px; text-align: center; color: var(--teal-2); }
.palette-group { margin-left: auto; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.palette-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: .78rem; flex-wrap: wrap; background: var(--surface-2); }
.palette-foot kbd { font: 600 .72rem var(--mono); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 5px; background: var(--surface); }

/* ---------- Feeds, notifications ---------- */
.feed { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.feed-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; }
.feed-item:hover { background: var(--surface-2); }
.feed-item.is-unread { background: var(--surface-2); }
.feed-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: transparent; flex: 0 0 auto; }
.feed-item.is-unread .feed-dot { background: var(--teal); }
.feed-body { flex: 1; min-width: 0; font-size: .92rem; }

/* ---------- Wizard / timeline / report ---------- */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 18px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--teal); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.report-card { display: flex; flex-direction: column; gap: 10px; }
.report-card i { font-size: 1.4rem; color: var(--teal-2); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tab.is-on, .tab[aria-current="page"] { color: var(--text); border-color: var(--teal); text-decoration: none; }
.tab:hover { color: var(--text); text-decoration: none; }
.pubnav { display: flex; align-items: center; gap: 18px; padding: 14px clamp(16px,3vw,36px); background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.pubnav .brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; }
.pubnav .brand img { height: 32px; }
.pubnav nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.pubnav nav a { padding: 7px 11px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.pubnav nav a:hover, .pubnav nav a.is-current { color: var(--text); background: var(--surface-3); text-decoration: none; }
.public .hero { padding: 40px 0 20px; display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); gap: 30px; align-items: center; }
.hero-mark { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 26px; box-shadow: var(--shadow); }
.hero-copy h1 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); }
.public .grid-3 { margin-bottom: 18px; }
.stat-row .stat { min-width: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 1180px) {
  .grid-trade { grid-template-columns: minmax(280px, 340px) minmax(0,1fr); }
  .cmdk-trigger { min-width: 0; }
  .cmdk-trigger span, .cmdk-trigger kbd { display: none; }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .shell, .sb-collapsed .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .nav-open .sidebar { transform: none; }
  .sb-collapsed .sidebar { width: 272px; }
  .sb-collapsed .brand-text, .sb-collapsed .nav-label, .sb-collapsed .nav-link span, .sb-collapsed .sidebar-note, .sb-collapsed .collapse-btn span { display: revert; }
  .sb-collapsed .nav-link { justify-content: flex-start; padding: 9px 12px; }
  .collapse-btn { display: none; }
  .menu-toggle { display: inline-grid; }
  .grid-2, .grid-3, .grid-trade, .public .hero { grid-template-columns: 1fr; }
  .ticket { position: static; }
  .span-2 { grid-column: auto; }
  .profile-name { display: none; }
  .only-mobile { display: inline; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 10px 14px; }
  .topbar .status-pill { display: none; }
  .hero-strip { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-v { font-size: 1.2rem; }
  .book { grid-template-columns: 1fr; }
  .filter-bar > * { flex: 1 1 100%; }
  .filter-bar select { width: 100%; }
  .seg-ctrl { width: 100%; }
  .seg-ctrl button { flex: 1; }
  .field-inline select { min-width: 0; width: 100%; }
  .toast-stack { left: 12px; right: 12px; width: auto; }
  .panel { padding: 16px; }
  .auth-card { padding: 22px; }
  .table th, .table td { padding: 9px 10px; }
}
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .cmdk-trigger { display: none; }
}
