/* ─── Design Tokens — Cyberpunk Occult Terminal ─ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', ui-monospace, monospace;

  /* Depth layers */
  --bg:            #080c10;
  --bg-deep:       #050709;
  --surface:       #0d1117;
  --surface2:      #111820;
  --surface3:      #151e28;

  /* Structure */
  --border:        rgba(0, 229, 255, 0.10);
  --border-strong: rgba(0, 229, 255, 0.22);
  --border-glow:   rgba(0, 229, 255, 0.45);

  /* Text */
  --text:          #c8d8e8;
  --text-2:        #7a8fa6;
  --muted:         #4a5a6a;

  /* Primary glow — deep cyan "machine consciousness" */
  --accent:        #00e5ff;
  --accent-dim:    rgba(0, 229, 255, 0.18);
  --accent-h:      #33ecff;
  --accent-weak:   rgba(0, 229, 255, 0.06);

  /* Semantic */
  --success:       #00c87a;
  --success-bg:    rgba(0, 200, 122, 0.08);
  --warn:          #f0a800;
  --warn-bg:       rgba(240, 168, 0, 0.08);
  --danger:        #ff3b5c;
  --danger-bg:     rgba(255, 59, 92, 0.08);
  --pill:          rgba(0, 229, 255, 0.07);

  /* Elevation / glow shadows */
  --shadow-xs:     0 1px 3px rgba(0,0,0,.6), 0 0 0 1px rgba(0,229,255,.04);
  --shadow-sm:     0 2px 10px rgba(0,0,0,.7), 0 0 12px rgba(0,229,255,.06);
  --shadow:        0 4px 24px rgba(0,0,0,.8), 0 0 30px rgba(0,229,255,.09);
  --shadow-glow:   0 0 20px rgba(0,229,255,.25), 0 4px 24px rgba(0,0,0,.8);

  --radius:        4px;
  --radius-sm:     3px;
  --nav-h:         52px;
  --ticker-h:      26px;
}

/* ─── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,229,255,.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 0% 100%, rgba(0,100,120,.05) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.015em;
  /* Subtle scanline overlay */
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
  pointer-events: none;
  z-index: 9998;
}

a { color: var(--accent); text-decoration: none; }

/* ─── Persistent Navigation ─────────────────── */
.app-nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(8, 12, 16, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; flex-wrap: nowrap;
  padding: 0 20px; gap: 4px;
  box-shadow: 0 1px 0 rgba(0,229,255,.08), 0 2px 20px rgba(0,0,0,.6);
}

/* Thin accent line at top of nav */
.app-nav::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 30%, var(--accent) 70%, transparent 100%);
  opacity: 0.4;
}

.nav-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 13px;
  white-space: nowrap; margin-right: 20px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-brand .nav-logo {
  font-size: 16px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent));
}

.nav-brand strong {
  color: var(--text);
}

.nav-links { display: flex; gap: 2px; align-items: center; flex: 1; }

.nav-link {
  display: inline-flex; align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 500;
  color: var(--text-2) !important; text-decoration: none !important;
  border: 1px solid transparent;
  background: none; cursor: pointer;
  transition: all .2s; white-space: nowrap; flex-shrink: 0;
  letter-spacing: 0.08em; text-transform: uppercase;
}

.nav-link:hover {
  background: var(--accent-weak);
  border-color: var(--border);
  color: var(--text) !important;
}

.nav-link.active {
  background: rgba(0,229,255,.08);
  border-color: rgba(0,229,255,.3);
  color: var(--accent) !important;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(0,229,255,.12);
}

.nav-divider { width: 1px; height: 20px; background: var(--border); margin: 0 10px; flex-shrink: 0; }
.nav-status { display: flex; align-items: center; gap: 6px; }
.nav-actions { display: flex; align-items: center; gap: 6px; margin-left: 8px; }

/* ─── Auth / Settings ───────────────────────── */
.auth-shell {
  min-height: calc(100vh - var(--nav-h) - var(--ticker-h));
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.auth-card, .settings-card {
  width: min(100%, 520px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-mark {
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 0 10px var(--accent));
}

.auth-card h1 {
  font-size: 22px;
  letter-spacing: .16em;
  line-height: 1.2;
}

.settings-shell {
  max-width: 760px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

input[type=password] {
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font: inherit;
  outline: none;
}

input[type=password]:focus {
  border-color: rgba(0,229,255,.50);
  box-shadow: 0 0 0 2px rgba(0,229,255,.08);
}

.settings-secret-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.settings-secret-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: var(--radius-sm);
}

.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Ticker Strip ───────────────────────────── */
.ticker-strip {
  position: sticky;
  top: var(--nav-h);
  z-index: 99;
  height: var(--ticker-h);
  background: var(--bg-deep);
  border-bottom: 1px solid rgba(0, 229, 255, 0.12);
  box-shadow: 0 1px 0 rgba(0,229,255,.05), 0 2px 10px rgba(0,0,0,.5);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  user-select: none;
}

.ticker-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(0,229,255,.65);
  background: linear-gradient(135deg, rgba(0,229,255,.10) 0%, rgba(0,229,255,.02) 100%);
  border-right: 1px solid rgba(0,229,255,.22);
  min-width: 62px;
  justify-content: center;
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 2.5%, #000 97.5%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 2.5%, #000 97.5%, transparent 100%);
}

.ticker-inner {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;        /* must NOT shrink — full content width needed for offsetWidth measurement */
  will-change: transform;
}

/* Individual data segment */
.t-seg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  border-right: 1px solid rgba(0,229,255,.05);
  height: var(--ticker-h);
}

.t-sep {
  color: var(--muted);
  font-size: 8px;
  padding: 0 2px;
  opacity: 0.35;
}

.t-lbl {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.t-val {
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-2);
}

/* Value colour modifiers */
.t-val.up   { color: var(--success); text-shadow: 0 0 7px rgba(0,200,122,.45); }
.t-val.dn   { color: var(--danger);  text-shadow: 0 0 7px rgba(255,59,92,.45); }
.t-val.cyan { color: var(--accent);  text-shadow: 0 0 7px rgba(0,229,255,.35); }
.t-val.warn { color: var(--warn);    text-shadow: 0 0 7px rgba(240,168,0,.45); }

/* Oracle / LLM transmission segment */
.t-seg.oracle-seg {
  padding: 0 20px;
  gap: 9px;
  background: linear-gradient(90deg, rgba(240,168,0,.05) 0%, transparent 80%);
  border-right: 1px solid rgba(240,168,0,.14);
}
.t-seg.oracle-seg .t-lbl {
  color: var(--warn);
  text-shadow: 0 0 8px rgba(240,168,0,.55);
  letter-spacing: 0.2em;
}
.t-seg.oracle-seg .t-val {
  color: rgba(240,168,0,.88);
  font-style: italic;
  letter-spacing: 0.03em;
  max-width: 900px;
}

/* High-severity flag segment */
.t-seg.flag-seg { background: linear-gradient(90deg, rgba(255,59,92,.04) 0%, transparent 80%); }
.t-seg.flag-seg .t-lbl { color: var(--danger); text-shadow: 0 0 8px rgba(255,59,92,.55); }
.t-seg.flag-seg .t-val { color: rgba(255,59,92,.88); }

/* ─── App Shell ──────────────────────────────── */
.app-main { min-height: calc(100vh - var(--nav-h) - var(--ticker-h)); }
.bot-shell, .page-shell {
  max-width: 1320px; margin: 0 auto;
  padding: 20px 18px;
  display: flex; flex-direction: column; gap: 14px;
}

/* ─── Cards / Modules ────────────────────────── */
.card {
  background: var(--surface);
  background-image: linear-gradient(135deg, rgba(0,229,255,.025) 0%, transparent 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: border-color .25s, box-shadow .25s;
}

/* Corner accent marks — angular machine aesthetic */
.card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 24px; height: 24px;
  border-top: 1px solid rgba(0,229,255,.3);
  border-left: 1px solid rgba(0,229,255,.3);
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

/* ─── Grid & Flex ────────────────────────────── */
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.flex { display: flex; align-items: center; gap: 8px; }
.flex.between { justify-content: space-between; }
.flex.wrap { flex-wrap: wrap; }

/* ─── Pills & Badges ─────────────────────────── */
.pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 2px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  background: var(--pill);
  color: var(--text-2);
  border: 1px solid rgba(0,229,255,.10);
}

.pill.success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(0,200,122,.25);
  box-shadow: 0 0 8px rgba(0,200,122,.10);
}
.pill.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: rgba(240,168,0,.25);
  box-shadow: 0 0 8px rgba(240,168,0,.10);
}
.pill.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(255,59,92,.25);
  box-shadow: 0 0 8px rgba(255,59,92,.12);
}
.pill.info {
  background: var(--accent-weak);
  color: var(--accent);
  border-color: rgba(0,229,255,.25);
  box-shadow: 0 0 8px rgba(0,229,255,.08);
}

.badge {
  padding: 2px 7px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 10px;
  display: inline-flex; letter-spacing: 0.07em; text-transform: uppercase;
}
.badge.exec     { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,200,122,.25); }
.badge.noop     { background: var(--surface3);   color: var(--muted);   border: 1px solid var(--border); }
.badge.halt     { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(255,59,92,.25); }
.badge.flatfail { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(255,59,92,.25); }

/* ─── Buttons ────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(0,229,255,.03);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 6px 13px;
  font-size: 11px; font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.07em; text-transform: uppercase;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  position: relative; overflow: hidden;
}

.button::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(0,229,255,.05) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .2s;
}

.button:hover:not(:disabled) {
  background: rgba(0,229,255,.07);
  border-color: rgba(0,229,255,.35);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0,229,255,.12);
}

.button:hover:not(:disabled)::before { opacity: 1; }

.button.primary {
  background: rgba(0,229,255,.10);
  color: var(--accent);
  border-color: rgba(0,229,255,.40);
  box-shadow: 0 0 14px rgba(0,229,255,.12);
}

.button.primary:hover:not(:disabled) {
  background: rgba(0,229,255,.18);
  border-color: rgba(0,229,255,.60);
  box-shadow: 0 0 20px rgba(0,229,255,.22);
}

.button.danger {
  background: rgba(255,59,92,.08);
  color: var(--danger);
  border-color: rgba(255,59,92,.35);
}

.button.danger:hover:not(:disabled) {
  background: rgba(255,59,92,.14);
  box-shadow: 0 0 14px rgba(255,59,92,.15);
}

.button.sm { padding: 4px 9px; font-size: 10px; }
.button:disabled { opacity: .35; cursor: not-allowed; }

/* ─── Table ──────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }

.table th {
  background: var(--surface2);
  color: var(--muted);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .10em;
  padding: 7px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0,229,255,.05);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.table tbody tr {
  transition: background .15s;
}

.table tbody tr:hover {
  background: rgba(0,229,255,.04);
  cursor: pointer;
}

.table tbody tr:last-child td { border-bottom: none; }

/* ─── Forms ──────────────────────────────────── */
input[type=text], input[type=number], select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  letter-spacing: 0.02em;
}

input[type=text]:focus, input[type=number]:focus, select:focus {
  border-color: rgba(0,229,255,.50);
  box-shadow: 0 0 0 2px rgba(0,229,255,.08), 0 0 10px rgba(0,229,255,.10);
}

select option { background: var(--surface2); }

/* ─── Misc ───────────────────────────────────── */
small.muted, .muted {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface2) 25%,
    rgba(0,229,255,.06) 50%,
    var(--surface2) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ─── Breathing pulse for live/active indicators */
@keyframes pulse-glow {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 4px currentColor); }
  50%       { opacity: 0.6; filter: drop-shadow(0 0 10px currentColor); }
}

.pulse-live {
  animation: pulse-glow 2.8s ease-in-out infinite;
}

/* ─── Toast ─────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-glow);
  font-size: 12px; z-index: 9999;
  letter-spacing: 0.03em;
  animation: toastIn .2s ease;
}
@keyframes toastIn {
  from { transform: translateY(10px) translateX(4px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ─── Banners ────────────────────────────────── */
.banner {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500; font-size: 11px;
  letter-spacing: 0.05em;
  border-left: 2px solid;
}
.banner.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-left-color: var(--warn);
}
.banner.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-left-color: var(--danger);
}

/* ─── Modal ─────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}

.modal {
  background: var(--surface);
  background-image: linear-gradient(135deg, rgba(0,229,255,.03) 0%, transparent 50%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-glow);
  max-height: 90vh; overflow-y: auto;
  min-width: 200px;
  position: relative;
}

.modal::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 28px; height: 28px;
  border-top: 1px solid rgba(0,229,255,.5);
  border-left: 1px solid rgba(0,229,255,.5);
  pointer-events: none;
}

/* ─── Accounts / Portfolio ───────────────────── */
.acct-portfolio-header {
  padding-bottom: 4px;
}

.acct-stat-box {
  background: var(--surface2);
  background-image: linear-gradient(135deg, rgba(0,229,255,.03) 0%, transparent 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}

.acct-stat-box::before {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 60px; height: 60px;
  background: radial-gradient(circle at 80% 80%, rgba(0,229,255,.05) 0%, transparent 70%);
}

.acct-stat-box small.muted {
  display: block; margin-bottom: 4px;
}

.acct-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.acct-card {
  background: var(--surface);
  background-image: linear-gradient(135deg, rgba(0,229,255,.02) 0%, transparent 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-xs);
  transition: border-color .25s, box-shadow .25s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.acct-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 16px; height: 16px;
  border-top: 1px solid rgba(0,229,255,.25);
  border-right: 1px solid rgba(0,229,255,.25);
  pointer-events: none;
}

.acct-card:hover {
  border-color: rgba(0,229,255,.30);
  box-shadow: var(--shadow-sm), 0 0 20px rgba(0,229,255,.08);
}

.acct-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 10px;
}

/* ─── Dashboard Report ───────────────────────── */
.report-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.5fr) minmax(260px, .85fr);
  gap: 12px;
  align-items: stretch;
}

.report-networth-panel,
.report-status-panel {
  background: var(--surface2);
  background-image: linear-gradient(135deg, rgba(0,229,255,.035) 0%, transparent 62%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-width: 0;
}

.report-networth-value {
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.report-pnl {
  font-size: 12px;
  font-weight: 700;
  margin: 4px 0 10px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.report-pnl.up, .success-text { color: var(--success); }
.report-pnl.down, .warn-text { color: var(--danger); }

.report-networth-chart {
  height: 190px;
  margin: 8px 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid rgba(0,229,255,.05);
  border-bottom: 1px solid rgba(0,229,255,.05);
}

.report-metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.report-metric-strip > div {
  background: rgba(0,229,255,.035);
  border: 1px solid rgba(0,229,255,.08);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.report-metric-strip strong { display: block; font-size: 13px; margin-top: 2px; }

.report-status-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.report-status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,229,255,.06);
}
.report-status-row span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.report-status-row strong {
  color: var(--text);
  text-align: right;
  text-transform: capitalize;
}

.report-recast-strip {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(0,229,255,.10);
  border-radius: var(--radius-sm);
  background: rgba(0,229,255,.035);
}
.report-recast-strip.empty { color: var(--muted); }
.report-recast-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: var(--text-2);
  font-size: 11px;
}
.report-recast-drift {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 6px;
}
.report-recast-drift span {
  padding: 2px 7px;
  border-radius: 2px;
  background: var(--surface3);
  border: 1px solid rgba(0,229,255,.08);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
}

.activity-table tbody tr[data-run] { cursor: pointer; }

/* ─── Account Holdings ───────────────────────── */
.acct-holdings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.acct-holding-row {
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,229,255,.06);
}
.acct-holding-row:last-child { border-bottom: none; }

.acct-weight-bar {
  height: 3px;
  background: rgba(0,229,255,.08);
  border-radius: 1px;
  margin-top: 6px;
  overflow: hidden;
}

.acct-weight-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(0,229,255,.6) 100%);
  border-radius: 1px;
  transition: width .4s ease;
  box-shadow: 0 0 6px rgba(0,229,255,.5);
}

/* ─── Numbers & Data ─────────────────────────── */
[style*="font-size:22px"], [style*="font-size: 22px"] {
  font-variant-numeric: tabular-nums;
}

/* ─── Section headings within cards ─────────── */
.card > strong:first-child,
.card > div > strong:first-child {
  color: var(--text-2);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ─── Scrollbars ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: rgba(0,229,255,.18);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0,229,255,.35); }

/* ─── Selection ──────────────────────────────── */
::selection { background: rgba(0,229,255,.18); color: var(--text); }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 700px) {
  .app-nav { padding: 0 12px; }
  .nav-status { display: none; }
  .bot-shell, .page-shell { padding: 12px 10px; gap: 10px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .report-layout { grid-template-columns: 1fr; }
  .report-metric-strip { grid-template-columns: 1fr; }
  .chat-panel { width: 100vw !important; right: 0 !important; border-left: none; }
}

/* ─── Oracle Chat Panel ──────────────────────── */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  width: 46px; height: 46px;
  border-radius: 3px;
  background: rgba(0,229,255,.10);
  border: 1px solid rgba(0,229,255,.45);
  color: var(--accent);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0,229,255,.20), 0 4px 16px rgba(0,0,0,.7);
  transition: all .2s;
  backdrop-filter: blur(8px);
}
.chat-fab:hover {
  background: rgba(0,229,255,.18);
  box-shadow: 0 0 32px rgba(0,229,255,.40), 0 4px 24px rgba(0,0,0,.8);
  transform: scale(1.06);
}
.chat-fab.has-unread::after {
  content: '';
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 6px var(--warn);
}

.chat-panel {
  position: fixed;
  top: 0; bottom: 0;
  right: 0;
  width: min(var(--chat-width, 420px), calc(100vw - 24px));
  z-index: 150;
  display: flex;
  flex-direction: column;
  background: rgba(8,12,16,.97);
  backdrop-filter: blur(16px);
  border-left: 1px solid rgba(0,229,255,.18);
  box-shadow: -4px 0 40px rgba(0,0,0,.8), -1px 0 0 rgba(0,229,255,.10);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1), width .18s ease;
}
.chat-panel.open { transform: translateX(0); }

.chat-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  width: 10px;
  cursor: ew-resize;
  z-index: 2;
}
.chat-resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 4px;
  width: 2px;
  height: 72px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: rgba(0,229,255,.24);
  box-shadow: 0 0 12px rgba(0,229,255,.18);
  opacity: .65;
  transition: opacity .15s, background .15s;
}
.chat-resize-handle:hover::after,
.chat-resizing .chat-resize-handle::after {
  opacity: 1;
  background: var(--accent);
}
.chat-resizing {
  cursor: ew-resize !important;
  user-select: none;
}

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,229,255,.12);
  background: rgba(0,229,255,.04);
  flex-shrink: 0;
}
.chat-header-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(0,229,255,.5);
}
.chat-header-title .chat-logo { font-size: 14px; }
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-icon-btn,
.chat-close {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; padding: 0 4px;
  line-height: 1; transition: color .15s;
}
.chat-icon-btn {
  min-width: 24px;
  height: 24px;
  border: 1px solid rgba(0,229,255,.10);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .03em;
}
.chat-icon-btn:hover,
.chat-close:hover { color: var(--text); }

.chat-panel.collapsed {
  width: 64px !important;
  min-width: 64px;
}
.chat-panel.collapsed .chat-header {
  height: 100%;
  padding: 14px 8px;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
}
.chat-panel.collapsed .chat-header-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  gap: 10px;
  line-height: 1;
}
.chat-panel.collapsed .chat-header-actions {
  flex-direction: column;
}
.chat-panel.collapsed .chat-messages,
.chat-panel.collapsed .chat-input-row,
.chat-panel.collapsed #chat-wide,
.chat-panel.collapsed #chat-forget,
.chat-panel.collapsed #chat-close,
.chat-panel.collapsed .chat-resize-handle {
  display: none;
}

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex; flex-direction: column; gap: 12px;
}

/* Empty / welcome state */
.chat-empty {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; text-align: center;
  color: var(--muted);
  padding: 20px;
}
.chat-empty .chat-empty-glyph {
  font-size: 32px;
  color: rgba(0,229,255,.25);
  text-shadow: 0 0 20px rgba(0,229,255,.3);
  margin-bottom: 4px;
}
.chat-empty p { font-size: 11px; letter-spacing: 0.04em; line-height: 1.7; }

/* Message bubbles */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 92%;
}
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.assistant { align-self: flex-start; align-items: flex-start; }
.chat-msg.system { align-self: center; align-items: center; max-width: 100%; }

.chat-bubble {
  padding: 9px 13px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-msg.user .chat-bubble {
  background: rgba(0,229,255,.10);
  border: 1px solid rgba(0,229,255,.25);
  color: var(--text);
  border-bottom-right-radius: 1px;
}
.chat-msg.assistant .chat-bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 1px;
}
.chat-msg.system .chat-bubble {
  background: rgba(240,168,0,.06);
  border: 1px solid rgba(240,168,0,.18);
  color: var(--warn);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-align: center;
  max-width: 100%;
}
.chat-ts {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-top: 3px;
  padding: 0 2px;
}

/* Actions list below assistant message */
.chat-actions {
  margin-top: 6px;
  display: flex; flex-direction: column; gap: 3px;
  width: 100%;
}
.chat-action-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 0.05em;
}
.chat-action-item .ca-icon { font-size: 11px; flex-shrink: 0; }
.chat-action-item .ca-tool { color: var(--muted); text-transform: uppercase; flex-shrink: 0; }
.chat-action-item .ca-detail { color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-action-item.ok .ca-icon { color: var(--success); }
.chat-action-item.err .ca-icon { color: var(--danger); }
.chat-action-item.err { border-color: rgba(255,59,92,.20); }

/* Typing indicator */
.chat-typing {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  width: fit-content;
  border-bottom-left-radius: 1px;
}
.chat-typing span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: typing-dot 1.2s infinite;
  opacity: 0.4;
}
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing-dot {
  0%, 80%, 100% { transform: scale(1); opacity: .4; }
  40% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 6px var(--accent); }
}

/* Input area */
.chat-input-row {
  padding: 10px 12px;
  border-top: 1px solid rgba(0,229,255,.10);
  display: flex; align-items: flex-end; gap: 8px;
  flex-shrink: 0;
  background: rgba(0,229,255,.02);
}
.chat-textarea {
  flex: 1;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  letter-spacing: 0.01em;
  resize: none;
  min-height: 36px; max-height: 120px;
  outline: none;
  line-height: 1.5;
  overflow-y: auto;
  transition: border-color .2s, box-shadow .2s;
}
.chat-textarea:focus {
  border-color: rgba(0,229,255,.45);
  box-shadow: 0 0 0 2px rgba(0,229,255,.08);
}
.chat-textarea::placeholder { color: var(--muted); }
.chat-send {
  flex-shrink: 0;
  width: 36px; height: 36px;
  background: rgba(0,229,255,.10);
  border: 1px solid rgba(0,229,255,.35);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.chat-send:hover:not(:disabled) {
  background: rgba(0,229,255,.20);
  box-shadow: 0 0 12px rgba(0,229,255,.25);
}
.chat-send:disabled { opacity: .35; cursor: not-allowed; }
.chat-clear {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-size: 10px; font-family: inherit;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 8px; cursor: pointer;
  transition: all .15s;
  align-self: flex-end; margin-bottom: 1px;
}
.chat-clear:hover { color: var(--text); border-color: var(--border-strong); }

