/*
 * CrushCrash admin theme — the design language of the Futures Analyzer applied app-wide.
 * Loaded after application.css; restyles the shared components (shell, headers, metric strips,
 * panels, tables, chips, buttons, forms) without changing page-specific layout rules.
 */

:root {
  --bg: #080c12;
  --surface: #0f1620;
  --surface-alt: #121b27;
  --surface-soft: #0b111a;
  --ink: #e8eef6;
  --muted: #a7b4c8;
  --faint: #7b899e;
  --line: rgba(148, 163, 184, 0.14);
  --line-soft: rgba(148, 163, 184, 0.08);
  --line-strong: rgba(148, 163, 184, 0.22);
  --panel-line: rgba(148, 163, 184, 0.14);
  --control-line: rgba(148, 163, 184, 0.24);
  --accent: #0f766e;
  --accent-dark: #5eead4;
  --up: #2dd4bf;
  --down: #f87171;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #93c5fd;
  --sidebar: #070b10;
  --sidebar-line: rgba(148, 163, 184, 0.1);
  --shadow: none;
  --active-bg: rgba(124, 180, 245, 0.1);
  --active-border: rgba(124, 180, 245, 0.42);
  --input-bg: #0a1018;
  --radius: 10px;
  --radius-sm: 7px;
  --section-gap: 12px;
  --content-gutter: clamp(14px, 1.8vw, 28px);
  --font-ui: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

/* ---- base typography ------------------------------------------------------------------------ */
body {
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

strong { font-weight: 600; }

h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
h3 { letter-spacing: -0.005em; }

.eyebrow {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.panel .eyebrow,
.panel-head .eyebrow { margin-bottom: 3px; color: var(--faint); font-size: 10.5px; }

.num,
td.num,
th.num,
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

td, .metric strong, .status, code { font-variant-numeric: tabular-nums; }

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(148, 163, 184, 0.08);
  font-size: 0.92em;
}

pre code { padding: 0; background: none; }

a { color: var(--accent-dark); }
a:hover { color: #99f6e4; }

::selection { background: rgba(45, 212, 191, 0.28); }

/* ---- sidebar -------------------------------------------------------------------------------- */
.admin-sidebar {
  padding: 16px 12px;
  background: var(--sidebar);
  box-shadow: inset -1px 0 0 var(--sidebar-line);
}

.brand-mark {
  border-color: rgba(45, 212, 191, 0.35);
  border-radius: 8px;
  background: rgba(45, 212, 191, 0.12);
  box-shadow: none;
  font-family: var(--font-mono);
  font-weight: 500;
}

.brand-lockup strong { font-size: 14px; font-weight: 600; letter-spacing: -0.015em; }
.brand-lockup small { color: var(--faint); font-size: 10px; font-weight: 500; letter-spacing: 0.1em; }

.side-nav { gap: 16px; }

.nav-section > span {
  padding: 0 10px 4px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.side-nav a,
.sidebar-account a {
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.side-nav a::before {
  width: 22px;
  height: 18px;
  border-color: var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
}

.side-nav a:hover,
.sidebar-account a:hover { border-color: transparent; background: rgba(148, 163, 184, 0.07); color: var(--ink); }

.side-nav a.active,
.sidebar-account a.active { border-color: transparent; background: var(--active-bg); color: var(--ink); }
.side-nav a.active::before { border-color: rgba(45, 212, 191, 0.4); background: rgba(45, 212, 191, 0.12); color: var(--accent-dark); }

.sidebar-account {
  border-color: var(--sidebar-line);
  border-radius: var(--radius);
  background: rgba(148, 163, 184, 0.03);
}

.sidebar-account span:not(.account-avatar) { color: var(--faint); font-weight: 500; letter-spacing: 0.08em; }
.account-actions a,
.sidebar-link-button { border-radius: var(--radius-sm); font-weight: 500; }

/* ---- topbar & shell --------------------------------------------------------------------------- */
.admin-topbar {
  background: rgba(8, 12, 18, 0.86);
  backdrop-filter: saturate(140%) blur(14px);
  box-shadow: 0 1px 0 var(--line-soft);
}

.admin-topbar-context span { color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: 0.09em; }
.admin-topbar-context strong { font-weight: 600; letter-spacing: -0.01em; }

.admin-topbar-link,
.admin-topbar-chip {
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 11.5px;
  font-weight: 500;
}

.admin-topbar-link:hover { border-color: var(--line-strong); background: rgba(148, 163, 184, 0.07); }
.admin-topbar-chip { border-color: rgba(45, 212, 191, 0.3); background: rgba(45, 212, 191, 0.08); font-family: var(--font-mono); font-size: 10.5px; }

.admin-shell { padding-top: 18px; padding-bottom: 56px; }

/* ---- page header ---------------------------------------------------------------------------- */
.page-head {
  gap: 20px;
  padding: 4px 0 16px;
  margin-bottom: 4px;
}

.page-subtitle { max-width: 76ch; margin-top: 6px; color: var(--muted); font-size: 13.5px; }

/* ---- metric strips -------------------------------------------------------------------------- */
.metric-grid {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: var(--section-gap);
}

.metric-grid > .metric,
.metric-grid > article {
  min-width: 0;
  min-height: 0;
  margin: 0 -1px -1px 0;
  padding: 13px 15px 14px;
  border: 0;
  border-right: 1px solid var(--panel-line);
  border-bottom: 1px solid var(--panel-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.metric-grid > .metric-emphasis { background: linear-gradient(180deg, rgba(45, 212, 191, 0.07), transparent); }

.metric > span,
.metric-grid > article > span,
.command-summary-card > span,
.report-summary-card > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.metric strong,
.metric-grid > article > strong,
.command-summary-card strong,
.report-summary-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.metric small,
.metric-grid > article > small,
.command-summary-card small,
.report-summary-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.command-summary-grid,
.reports-summary-grid { gap: 0; overflow: hidden; border: 1px solid var(--panel-line); border-radius: var(--radius); background: var(--surface); }

.command-summary-card,
.report-summary-card {
  margin: 0 -1px -1px 0;
  padding: 13px 15px 14px;
  border: 0;
  border-right: 1px solid var(--panel-line);
  border-bottom: 1px solid var(--panel-line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
}

a.command-summary-card:hover,
a.report-summary-card:hover { background: rgba(148, 163, 184, 0.04); }
.command-summary-primary,
.report-summary-primary { border-color: var(--panel-line); background: linear-gradient(180deg, rgba(45, 212, 191, 0.08), transparent); }

/* ---- panels --------------------------------------------------------------------------------- */
.metric,
.panel {
  border-color: var(--panel-line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
}

.panel-head {
  min-height: 48px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head h2,
.panel-title-row h2 { font-size: 13.5px; font-weight: 600; }
.panel-head a { font-weight: 500; }

.form-panel > h2,
.form-panel > .panel-title-row { padding: 12px 15px; border-bottom: 1px solid var(--line-soft); }
.form-panel > form,
.form-panel > .grid-form,
.form-panel > .stack-form { padding: 15px; }

.panel-note,
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.55; }

.panel-foot-actions { padding: 10px 15px; border-top: 1px solid var(--line-soft); background: transparent; }

/* ---- tables --------------------------------------------------------------------------------- */
th,
td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }

th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

thead th { border-bottom-color: var(--line); }
tbody tr:hover > td { background: rgba(148, 163, 184, 0.035); }
.dense-table th,
.dense-table td { padding-top: 7px; padding-bottom: 7px; }

.table-subtext { color: var(--muted); font-size: 12px; }

.admin-fit-table thead th,
.trading-table-wrap > table thead th { background: var(--surface-alt); }

.table-wrap { scrollbar-color: var(--line-strong) transparent; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { border-color: var(--surface); }

.pagination-bar { padding: 10px 15px; border-top: 1px solid var(--line-soft); background: transparent; }
.pagination-count,
.pagination-page { font-family: var(--font-mono); font-size: 11.5px; }

/* ---- chips ---------------------------------------------------------------------------------- */
.status {
  min-height: 21px;
  padding: 0 8px;
  border-color: var(--line);
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.status-good { border-color: rgba(45, 212, 191, 0.32); background: rgba(45, 212, 191, 0.1); color: #5eead4; }
.status-bad { border-color: rgba(248, 113, 113, 0.32); background: rgba(248, 113, 113, 0.1); color: #fca5a5; }
.trend-positive { color: var(--up); }
.trend-negative { color: var(--down); }

/* ---- buttons -------------------------------------------------------------------------------- */
.button,
input[type="submit"].button {
  min-height: 32px;
  padding: 0 13px;
  border-color: var(--line-strong);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.04);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.button:hover,
input[type="submit"].button:hover { border-color: rgba(148, 163, 184, 0.4); background: rgba(148, 163, 184, 0.09); }

.button-primary,
input[type="submit"].button-primary { border-color: rgba(45, 212, 191, 0.5); background: rgba(45, 212, 191, 0.14); color: #ccfbf1; }
.button-primary:hover,
input[type="submit"].button-primary:hover { border-color: rgba(45, 212, 191, 0.7); background: rgba(45, 212, 191, 0.22); }

.button-ghost,
input[type="submit"].button-ghost { background: transparent; }

.button-danger,
input[type="submit"].button-danger { border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); color: #fca5a5; }

.icon-button { width: 32px; padding: 0; }
.table-icon-button { width: 28px; min-height: 28px; border-radius: 7px; }

/* ---- forms ---------------------------------------------------------------------------------- */
label span,
.field-label,
.criteria-section legend,
.credential-fieldset legend { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; }

input[type="text"],
input[type="search"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
  min-height: 34px;
  padding: 7px 10px;
  border-color: var(--control-line);
  border-radius: 8px;
  background: var(--input-bg);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"] { font-family: var(--font-mono); font-size: 12.5px; }

input:focus,
select:focus,
textarea:focus { border-color: rgba(45, 212, 191, 0.6); outline: none; box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.14); }

textarea { line-height: 1.5; }
textarea.code,
textarea[name*="json"],
textarea[name*="settings"] { font-family: var(--font-mono); font-size: 12px; }

.provider-panel,
.credential-fieldset { border-color: var(--panel-line); border-radius: var(--radius); }

/* ---- flash ---------------------------------------------------------------------------------- */
.flash {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
}

/* ---- tooltips ------------------------------------------------------------------------------- */
.tooltip-panel { border-color: var(--line-strong); border-radius: var(--radius); }

/* ---- sign-in -------------------------------------------------------------------------------- */
.topbar { background: rgba(8, 12, 18, 0.9); box-shadow: 0 1px 0 var(--line-soft); }
.auth-panel { border-radius: 14px; }

/* ---- more summary strips (opportunities, scans, backtest detail) ------------------------------ */
.scanner-summary,
.quant-kpi-grid {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: var(--surface);
}

.scanner-summary > div,
.quant-kpi-grid > .quant-kpi {
  min-height: 0;
  margin: 0 -1px -1px 0;
  padding: 13px 15px 14px;
  border: 0;
  border-right: 1px solid var(--panel-line);
  border-bottom: 1px solid var(--panel-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.quant-kpi-grid > .quant-kpi-primary { background: linear-gradient(180deg, rgba(45, 212, 191, 0.07), transparent); }

.scanner-summary > div > span,
.quant-kpi > span { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0.07em; }

.scanner-summary strong,
.quant-kpi > strong {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Two-column scanner layouts need room; stack them on laptop-width content areas. */
@media (max-width: 1240px) {
  .scanner-layout,
  .instrument-workbench { grid-template-columns: minmax(0, 1fr); }
}

/* ---- calendar --------------------------------------------------------------------------------- */
.market-calendar-filters { margin: 0; padding: 12px 15px; }
.market-calendar-grid { padding: 0 15px 15px; }
.compact-form { padding: 12px 15px; }
.market-calendar-weekday { color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; }
.market-calendar-day { border-radius: 8px; }
.market-calendar-day.today { border-color: rgba(45, 212, 191, 0.45); }

/* ---- table primitives (shared with the Futures Analyzer look) --------------------------------- */
td.num,
th.num { text-align: right; white-space: nowrap; }

.ui-identity { color: var(--ink); font-weight: 600; text-decoration: none; }
a.ui-identity:hover { color: var(--accent-dark); }
.ui-mono { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; letter-spacing: -0.01em; }
.ui-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.35; }
.ui-faint { color: var(--faint); }
.ui-up { color: var(--up); }
.ui-down { color: var(--down); }
.ui-flat { color: var(--muted); }
.ui-nowrap { white-space: nowrap; }

.ui-range { position: relative; display: block; width: 100%; max-width: 132px; height: 4px; margin: 7px 0 3px auto; border-radius: 2px; background: rgba(148, 163, 184, 0.14); }
.ui-range-fill { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: rgba(45, 212, 191, 0.28); }
.ui-range-mark { position: absolute; top: -3px; width: 2px; height: 10px; margin-left: -1px; border-radius: 1px; background: var(--ink); }

.ui-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ui-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.ui-tag-more { color: var(--faint); font-family: var(--font-mono); font-size: 11px; }

.ui-group-row td {
  padding: 14px 12px 6px;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--accent-dark);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
tbody tr.ui-group-row:hover > td { background: transparent; }

.status-warn { border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.09); color: #fcd34d; }
.status-info { border-color: rgba(147, 197, 253, 0.3); background: rgba(147, 197, 253, 0.09); color: #bfdbfe; }

.table-subtext { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.empty.table-subtext { color: var(--muted); }

/* Fixed-layout tables: wrap at word boundaries instead of mid-word. */
.admin-fit-table th,
.admin-fit-table td { overflow-wrap: break-word; word-break: normal; }

.ui-meter { display: block; width: 100%; max-width: 140px; height: 4px; margin: 6px 0 2px; overflow: hidden; border-radius: 2px; background: rgba(148, 163, 184, 0.14); }
.ui-meter > span { display: block; height: 100%; border-radius: 2px; }
.ui-meter-good > span { background: var(--up); }
.ui-meter-warn > span { background: var(--amber); }
.ui-meter-bad > span { background: var(--down); }
td.num .ui-meter { margin-left: auto; }
.symbol-chip { min-height: 20px; padding: 0 7px; border-color: var(--line); border-radius: 6px; background: transparent; font-family: var(--font-mono); font-size: 11px; }
a.symbol-chip:hover { border-color: rgba(45, 212, 191, 0.4); background: rgba(45, 212, 191, 0.08); }
.symbol-chip-muted { color: var(--faint); }

/* Sub-lines under numbers are labels (UI font) unless explicitly mono. */
td.num .ui-sub { font-family: var(--font-ui); letter-spacing: 0; }
td.num .ui-sub.ui-mono,
td .ui-sub.ui-mono { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: -0.01em; }

@media (min-width: 901px) {
  td.mobile-primary-cell { min-width: 170px; }
}

/* Summary strips: fill the row instead of wrapping into an orphan tile. */
.command-summary-grid,
.reports-summary-grid,
.quant-kpi-grid,
.workflow-summary-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* The sidebar eats 216px, so two-column layouts need a later breakpoint than the viewport suggests. */
@media (max-width: 1100px) {
  .dashboard-command-grid { grid-template-columns: minmax(0, 1fr); }
}
.preset-edge-off { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border: 1px solid var(--line-soft); border-radius: 6px; color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ---- scanner / opportunity cells (executions, execution detail, opportunities) ---------------- */
.scanner-secondary { margin-top: 1px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.scanner-identity-cell,
.scanner-stack,
.scanner-signal-cell { gap: 4px; }
.scanner-inline-head strong a,
.scanner-inline-head > strong { font-family: var(--font-mono); font-size: 13px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.scanner-inline-head strong a:hover { color: var(--accent-dark); }
.scanner-chip,
.option-chip {
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.scanner-metric-cell strong,
.scanner-score,
.option-table-value { font-family: var(--font-mono); font-size: 14px; font-weight: 500; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
.scanner-metric-cell > span { color: var(--faint); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.candidate-table code,
.scanner-candidate-table code { padding: 0; background: none; color: var(--muted); font-size: 11.5px; }

/* Key/value rows used in side panels (readiness, snapshots, status lists). */
.snapshot-row,
.status-row { min-height: 40px; padding: 9px 15px; border-bottom-color: var(--line-soft); }
.status-row strong,
.snapshot-row strong { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Links inside tables: no permanent underline (hover only) — the Futures table convention. */
td a:not(.button):not(.symbol-chip) { text-decoration: none; }
td a:not(.button):not(.symbol-chip):hover { text-decoration: underline; text-underline-offset: 3px; }

/* Main column + fixed sidebar layouts: stack once the content area (viewport − 216px sidebar) gets narrow. */
@media (max-width: 1180px) {
  .activity-grid,
  .opportunity-activity-grid,
  .report-delivery-grid,
  .report-ai-grid,
  .report-analysis-grid,
  .dashboard-grid,
  .scan-command-grid,
  .backtest-workbench,
  .backtest-setup-grid,
  .backtest-support-grid,
  .quant-forecast-grid,
  .workflow-detail-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Row labels in key/value tables are not column headers. */
tbody th { background: transparent; color: var(--muted); font-weight: 500; }

/* Mobile card mode: label | value grid — keep numbers and their sub-lines in the value column. */
@media (max-width: 900px) {
  .mobile-card-table td.num { text-align: left; }
  .mobile-card-table td > .ui-sub,
  .mobile-card-table td > .ui-range,
  .mobile-card-table td > .ui-meter { grid-column: 2; margin-left: 0; }
  .mobile-card-table td.mobile-primary-cell > .ui-sub { grid-column: auto; }
  .mobile-card-table td::before { font-weight: 500; letter-spacing: 0.06em; }
}

/* ---- sign-in screen ------------------------------------------------------------------------- */
.auth-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 16px;
  align-content: center;
  justify-items: center;
  gap: 18px;
  background:
    radial-gradient(640px 420px at 12% 8%, rgba(63, 100, 232, 0.2), transparent 70%),
    radial-gradient(520px 380px at 88% 92%, rgba(255, 184, 0, 0.09), transparent 70%),
    var(--bg);
}

.auth-card {
  width: min(400px, 100%);
  padding: 28px 28px 26px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(19, 28, 41, 0.94), rgba(12, 18, 27, 0.94));
  box-shadow: 0 28px 70px -28px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand svg { flex: none; width: 40px; height: 40px; }
.auth-brand-text strong { display: block; color: var(--ink); font-size: 15px; line-height: 1.2; }
.auth-brand-text span { color: var(--muted); font-size: 12px; }
.auth-env {
  margin-left: auto;
  padding: 3px 9px;
  border: 1px solid rgba(251, 191, 36, 0.32);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.06);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-card h1 { margin: 0 0 6px; color: var(--ink); font-size: 24px; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

.auth-flash { margin: 0 0 16px; padding: 10px 12px; border: 1px solid; border-radius: 9px; font-size: 13px; }
.auth-flash-alert { border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); color: #fca5a5; }
.auth-flash-notice { border-color: rgba(94, 234, 212, 0.32); background: rgba(94, 234, 212, 0.08); color: var(--accent-dark); }

.auth-form { display: grid; gap: 14px; }
.auth-card .auth-field { display: grid; gap: 6px; margin: 0; }
.auth-card .auth-field span { color: var(--muted); font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.auth-card .auth-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--control-line);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-card .auth-field input::placeholder { color: var(--faint); }
.auth-card .auth-field input:focus { border-color: #5b7cf0; outline: none; box-shadow: 0 0 0 3px rgba(63, 100, 232, 0.28); }

.auth-card .auth-submit,
.auth-card .auth-demo {
  width: 100%;
  height: 42px;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.auth-card .auth-submit {
  margin-top: 6px;
  border: 1px solid rgba(120, 150, 255, 0.45);
  background: linear-gradient(180deg, #4b70f2, #3354d6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 8px 22px -10px rgba(63, 100, 232, 0.8);
  color: #fff;
}
.auth-card .auth-submit:hover { filter: brightness(1.08); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 14px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after { flex: 1; height: 1px; background: var(--line); content: ""; }

.auth-demo-form { margin: 0; }
.auth-card .auth-demo { border: 1px solid rgba(255, 184, 0, 0.36); background: rgba(255, 184, 0, 0.07); color: #ffd666; }
.auth-card .auth-demo:hover { border-color: rgba(255, 184, 0, 0.55); background: rgba(255, 184, 0, 0.12); }
.auth-note { margin: 10px 0 0; color: var(--faint); font-size: 12px; line-height: 1.5; text-align: center; }
.auth-note .mono { color: var(--muted); white-space: nowrap; }

.auth-foot { margin: 0; color: var(--faint); font-size: 12px; }
.auth-foot a, .auth-note a { color: var(--muted); }

/* Passkey steps (ADR-0012) */
.auth-step { margin: 0 0 8px; color: var(--accent-dark); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.auth-passkey-status { min-height: 20px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-passkey-status.is-error, .passkey-status.is-error { color: #fca5a5; }
.passkey-status:empty { display: none; }
.auth-recovery { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.auth-recovery summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.auth-recovery[open] summary { margin-bottom: 14px; }
.auth-card .auth-submit.auth-submit-quiet { border-color: var(--line-strong); background: transparent; box-shadow: none; color: var(--ink); }
.auth-inline-form { margin: 12px 0 0; text-align: center; }
.auth-card .auth-link-button { padding: 4px 8px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.auth-card .auth-field input.mono { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; letter-spacing: 0.06em; }
.recovery-code-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; margin: 16px 0; padding-left: 24px; color: var(--ink); font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 15px; }
.recovery-code-list li { padding: 2px 0; }

/* ---- one app: the topbar's symbol box, the row of links on symbol pages, the dashboard map ------------------ */
.admin-topbar-search { display: flex; margin: 0; }
.admin-topbar-search input {
  width: clamp(180px, 22vw, 280px);
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  font: 500 12px/1 var(--font-ui);
}
.admin-topbar-search input::placeholder { color: var(--faint); }
.admin-topbar-search input:focus { border-color: var(--active-border); outline: none; box-shadow: 0 0 0 3px var(--active-bg); }

.symbol-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin: 0 0 var(--section-gap);
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-size: 12px;
}
.symbol-links-symbol { color: var(--ink); font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.symbol-links-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.symbol-links-kicker { margin-right: 4px; color: var(--faint); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.symbol-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
a.symbol-link:hover { border-color: var(--active-border); color: var(--ink); background: rgba(148, 163, 184, 0.06); }
.symbol-link.is-current { border-color: var(--active-border); background: var(--active-bg); color: var(--accent-dark); }
.fx .symbol-links { margin-bottom: 14px; }
.trading-viewport-page > .symbol-links { flex: 0 0 auto; }

.app-map { margin-bottom: var(--section-gap); }
.app-map h3 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.app-map-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}
.app-map-step { position: relative; padding: 14px 18px 14px 15px; border-right: 1px solid var(--line-soft); }
.app-map-step:last-child { border-right: 0; }
.app-map-step:not(:last-child)::after {
  position: absolute;
  top: 16px;
  right: -9px;
  z-index: 1;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--faint);
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  content: "→";
}
.app-map-step-head { display: flex; align-items: center; gap: 8px; }
.app-map-num {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--active-border);
  border-radius: 50%;
  background: var(--active-bg);
  color: var(--accent-dark);
  font: 600 11px/1 var(--font-mono);
}
.app-map-purpose { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.app-map-items { display: grid; gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }
.app-map-items li { color: var(--faint); font-size: 12px; line-height: 1.4; }
.app-map-items a { margin-right: 4px; color: var(--ink); font-weight: 600; text-decoration: none; }
.app-map-items a:hover { color: var(--accent-dark); }
.app-map-beside {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-soft);
}
.app-map-side { padding: 12px 15px; border-right: 1px solid var(--line-soft); }
.app-map-side:last-child { border-right: 0; }
.app-map-links { margin: 7px 0 0; color: var(--faint); font-size: 12px; line-height: 1.6; }
.app-map-links a { color: var(--ink); font-weight: 500; text-decoration: none; }
.app-map-links a:hover { color: var(--accent-dark); }
.app-map-foot { margin: 0; padding: 10px 15px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: 12px; }
.app-map-foot code { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; }

@media (max-width: 900px) {
  /* Phones hide the topbar; keep its symbol box, full width, under the menu bar. */
  .admin-body .admin-topbar {
    position: static;
    display: flex;
    min-height: 0;
    padding: 10px var(--content-gutter) 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }
  .admin-body .admin-topbar-context,
  .admin-body .admin-topbar-chip { display: none; }
  .admin-topbar-actions,
  .admin-topbar-search,
  .admin-topbar-search input { flex: 1 1 auto; width: 100%; }
  .admin-topbar-search input { min-height: 34px; font-size: 14px; }
  .app-map-flow,
  .app-map-beside { grid-template-columns: minmax(0, 1fr); }
  .app-map-step,
  .app-map-side { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .app-map-step:not(:last-child)::after { top: auto; right: auto; bottom: -9px; left: 24px; content: "↓"; }
}


/* ==== The shell standard (docs/UI_STANDARD.md) ================================================
 * One sidebar, one header row. Loaded last in this file so it settles the older shell rules above.
 * Navigation state is blue; teal and red mean up and down; amber means "look at this". */
:root { --nav: #7cb4f5; }

/* Numbers, tickers and times: one fixed-width face, digits of one width, so columns line up. */
td, th.num, .num, .mono, .ui-mono, .metric strong, .status, code, time, .fx-symbol { font-variant-numeric: tabular-nums lining-nums; }
td.num, th.num, .num, .ui-mono, .fx-symbol { font-family: var(--font-mono); }

/* Sidebar: plain one-line links, no letter chips; the page shown has a blue bar. */
.admin-body .side-nav { gap: 8px; }
.admin-body .side-nav a::before { content: none; display: none; }
.admin-body .side-nav a { position: relative; justify-content: space-between; min-height: 27px; padding: 0 10px 0 12px; color: var(--muted); font-size: 13.5px; font-weight: 400; }
.admin-body .side-nav a:hover { color: var(--ink); }
.admin-body .side-nav a.active { background: rgba(148, 163, 184, 0.09); color: var(--ink); font-weight: 500; }
.admin-body .side-nav a.active::after { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--nav); }
.admin-body .nav-section > span,
.admin-body .nav-section > summary > span,
.admin-body .nav-more-label { padding: 0 12px 2px; color: var(--faint); font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-more { padding-top: 10px; border-top: 1px solid var(--sidebar-line); }
.nav-more > summary { display: flex; align-items: center; min-height: 28px; cursor: pointer; list-style: none; }
.nav-more > summary::-webkit-details-marker { display: none; }
.admin-body .nav-more > summary .nav-more-label { padding-bottom: 0; }
.nav-more > summary::after { content: "+"; margin-left: auto; padding-right: 12px; color: var(--faint); font-family: var(--font-mono); }
.nav-more[open] > summary::after { content: "−"; }
.nav-more[open] { display: grid; gap: 8px; }
.nav-badge { min-width: 18px; padding: 0 5px; border-radius: 9px; background: rgba(148, 163, 184, 0.16); color: var(--ink); font: 500 11px/18px var(--font-mono); text-align: center; }
.nav-badge-warn { background: rgba(251, 191, 36, 0.2); color: #fcd34d; }
.admin-body .brand-mark { border-color: rgba(124, 180, 245, 0.4); background: rgba(124, 180, 245, 0.12); color: var(--nav); }
.admin-body .brand-lockup small { font-family: var(--font-mono); text-transform: uppercase; }
.admin-body .sidebar-account { padding: 10px 12px; border: 0; border-top: 1px solid var(--sidebar-line); border-radius: 0; background: transparent; }
.admin-body .sidebar-account strong { font-size: 13px; font-weight: 500; }

/* Header: the page's name, the symbol box, one status chip and the stop. */
.admin-body .admin-topbar { min-height: 50px; gap: 20px; }
.admin-body .admin-topbar-context { align-items: baseline; gap: 8px; }
.admin-body .admin-topbar-context span { color: var(--faint); font-family: var(--font-mono); font-size: 11px; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; }
.admin-body .admin-topbar-context span::after { content: "/"; margin-left: 8px; color: var(--line-strong); }
.admin-body .admin-topbar-context strong { color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: 0; }
/* The header row already says where you are, so a page starts at its title: no second breadcrumb line. */
.admin-body .admin-shell .fx-crumb:not(:has(a)),
.admin-body .page-head .eyebrow { display: none; }
.admin-topbar-context span[hidden] { display: none; }
.admin-topbar-actions { gap: 12px; }
.admin-topbar-status { display: inline-flex; align-items: center; gap: 8px; }
.admin-body .admin-topbar-chip { gap: 7px; min-height: 30px; padding: 0 10px; border-color: var(--line); background: transparent; color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; text-decoration: none; white-space: nowrap; }
.admin-topbar-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.admin-topbar-chip-warn { border-color: rgba(251, 191, 36, 0.4); color: #fcd34d; }
.admin-topbar-chip-warn .admin-topbar-dot { background: var(--amber); }
.admin-topbar-chip-neg { border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }
.admin-topbar-chip-neg .admin-topbar-dot { background: var(--down); }
.admin-topbar-chip-info .admin-topbar-dot { background: var(--blue); }
@media (max-width: 900px) { .admin-topbar-status { display: none; } }

/* One title block for every page (docs/UI_STANDARD.md, "A page"): the title, one line under it. */
.admin-body .admin-shell h1,
.admin-body .admin-shell .fx-title,
.admin-body .admin-shell .br-title,
.ui-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.admin-body .admin-shell h1 small { margin-left: 8px; color: var(--muted); font-family: var(--font-mono); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.ui-head { margin: 0 0 14px; }
.ui-lede, .admin-body .page-subtitle { max-width: 76ch; margin: 5px 0 0; color: var(--muted); font-size: 14px; }
/* A panel's title stands alone: no small label over it. */
.admin-body .panel-head .eyebrow, .admin-body .panel-title-row .eyebrow { display: none; }
.admin-body .panel-head h2, .admin-body .panel-title-row h2, .admin-body .fx-card-head h2, .admin-body .fx-card-head h3 { font-size: 14px; font-weight: 600; letter-spacing: 0; }
