/* PAIS // Batcave — tokens first, then layout, then components. */
:root {
  --void: #050607;
  --cave: #0a0c0f;
  --plate: #111419;
  --plate-2: #171b22;
  --plate-3: #1f242d;
  --edge: rgba(255, 255, 255, 0.07);
  --edge-2: rgba(255, 255, 255, 0.14);
  --ink: #e6eaee;
  --ink-2: #a3adb8;
  --muted: #69737e;
  --hud: #5fd4ff;
  --hud-dim: rgba(95, 212, 255, 0.14);
  --signal: #f3c431;
  --signal-glow: rgba(243, 196, 49, 0.35);
  --ok: #3ddc84;
  --warn: #f3c431;
  --danger: #ff5a5a;
  --danger-dim: rgba(255, 90, 90, 0.12);

  --font-ui: "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --text-xs: 0.72rem;
  --text-sm: 0.84rem;
  --text-base: 0.95rem;
  --text-lg: 1.15rem;
  --text-xl: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem);
  --text-hero: clamp(2.6rem, 1.4rem + 4.2vw, 4.6rem);

  --r-sm: 4px;
  --r-md: 10px;
  --r-lg: 16px;
  --gap: 14px;
  --pad: clamp(14px, 1rem + 1vw, 28px);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 140ms;
  --normal: 320ms;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--void);
  color: var(--ink);
  font: 400 var(--text-base)/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--hud); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ---------- atmosphere (shared) ---------- */
#fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.55; }
.fog { position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40% 30% at 20% 80%, rgba(120, 140, 160, 0.10), transparent 70%),
    radial-gradient(35% 25% at 80% 70%, rgba(120, 140, 160, 0.08), transparent 70%),
    radial-gradient(60% 40% at 50% 100%, rgba(95, 212, 255, 0.05), transparent 70%);
  animation: drift 38s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate3d(4%, -3%, 0) scale(1.05); } }
.scanlines { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0.05;
  background: repeating-linear-gradient(0deg, #fff 0 1px, transparent 1px 3px); }

/* ---------- login: the bat-signal ---------- */
#gate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; overflow: hidden;
  transition: opacity 900ms var(--ease), transform 900ms var(--ease); }
#gate.opening { opacity: 0; transform: scale(1.08); pointer-events: none; }
.sky-signal { position: absolute; top: 7vh; left: 50%; width: min(46vmin, 360px); aspect-ratio: 1;
  transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 120, 0.95) 0 52%, rgba(243, 196, 49, 0.55) 60%, rgba(243, 196, 49, 0) 72%);
  filter: blur(0.4px); opacity: 0.18; transition: opacity 1200ms var(--ease), filter 1200ms var(--ease);
  display: grid; place-items: center; }
.sky-signal svg { width: 74%; fill: #07080a; opacity: 0.92; }
#gate.lit .sky-signal { opacity: 0.9; filter: blur(0.4px) drop-shadow(0 0 60px var(--signal-glow)); }
.beam { position: absolute; left: 50%; bottom: -10vh; width: 30vmin; height: 110vh; transform: translateX(-50%);
  background: linear-gradient(to top, rgba(243, 196, 49, 0.10), rgba(243, 196, 49, 0.02) 70%, transparent);
  clip-path: polygon(44% 100%, 56% 100%, 100% 0, 0 0); opacity: 0; transition: opacity 1200ms var(--ease); }
#gate.lit .beam { opacity: 1; }
.skyline { position: absolute; bottom: 0; left: 0; right: 0; height: 24vh; fill: #030405; }

.gate-card { position: relative; z-index: 2; width: min(92vw, 440px); margin-top: 26vh; text-align: center;
  padding: 28px var(--pad) 24px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(17, 20, 25, 0.82), rgba(10, 12, 15, 0.92));
  box-shadow: 0 0 0 1px var(--edge), 0 30px 80px -20px #000; backdrop-filter: blur(6px); }
.wordmark { font-weight: 700; font-size: var(--text-xl); letter-spacing: 0.42em; margin: 0 0 2px 0.42em; }
.wordmark-sub { font-size: var(--text-xs); letter-spacing: 0.28em; color: var(--muted); text-transform: uppercase; margin: 0; }
.gate-prompt { color: var(--ink-2); font-size: var(--text-sm); margin: 22px 0 14px; min-height: 2.6em; }
.code-cells { display: flex; gap: 8px; justify-content: center; }
.code-cells input { width: 46px; height: 58px; text-align: center; font: 600 1.6rem var(--font-mono);
  background: var(--cave); border: 0; border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--edge-2);
  caret-color: var(--signal); transition: box-shadow var(--fast), transform var(--fast); }
.code-cells input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--signal), 0 0 24px -6px var(--signal-glow); }
.code-cells.bad input { box-shadow: inset 0 0 0 2px var(--danger); }
.code-cells.bad { animation: shake 360ms; }
.code-cells.good input { box-shadow: inset 0 0 0 2px var(--ok); }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.gate-foot { margin-top: 18px; font-size: var(--text-xs); color: var(--muted); letter-spacing: 0.08em; }

/* ---------- app shell ---------- */
#cave { position: relative; z-index: 1; min-height: 100%; opacity: 0; transition: opacity 700ms var(--ease) 200ms; }
#cave.on { opacity: 1; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px var(--pad); background: linear-gradient(180deg, rgba(5, 6, 7, 0.96), rgba(5, 6, 7, 0.82));
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--edge); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: 0.3em; font-size: var(--text-sm); }
.brand svg { width: 38px; fill: var(--signal); filter: drop-shadow(0 0 8px var(--signal-glow)); }
.brand small { color: var(--muted); letter-spacing: 0.16em; font-weight: 500; }
.clock { margin-left: auto; color: var(--ink-2); font-size: var(--text-sm); }
.toggles { display: flex; gap: 6px; }
.tog { border: 0; background: var(--plate); box-shadow: inset 0 0 0 1px var(--edge); border-radius: 999px;
  padding: 5px 11px; font-size: var(--text-xs); letter-spacing: 0.14em; color: var(--muted); cursor: pointer;
  transition: color var(--fast), box-shadow var(--fast), background var(--fast); }
.tog:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge-2); }
.tog[aria-pressed="true"] { color: var(--signal); box-shadow: inset 0 0 0 1px rgba(243, 196, 49, 0.5); background: rgba(243, 196, 49, 0.06); }
.tog:disabled { opacity: 0.4; cursor: not-allowed; }

.tabs { display: flex; gap: 2px; padding: 0 var(--pad); border-bottom: 1px solid var(--edge); overflow-x: auto;
  scrollbar-width: none; background: rgba(5, 6, 7, 0.7); position: sticky; top: 63px; z-index: 19; backdrop-filter: blur(8px); }
.tab { position: relative; border: 0; background: none; cursor: pointer; padding: 14px 16px 13px; white-space: nowrap;
  color: var(--muted); letter-spacing: 0.16em; font-size: var(--text-sm); font-weight: 600; transition: color var(--fast); }
.tab span { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); margin-right: 8px; letter-spacing: 0; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"] span { color: var(--signal); }
.tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--signal);
  transform: scaleX(0); transition: transform var(--normal) var(--ease); box-shadow: 0 0 12px var(--signal-glow); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }

main { padding: var(--pad); padding-bottom: 150px; max-width: 1320px; margin: 0 auto; }
.panel { animation: rise 420ms var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- building blocks ---------- */
.eyebrow { font-size: var(--text-xs); letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.eyebrow b { color: var(--hud); font-weight: 600; }
h1.title { font-size: var(--text-xl); margin: 0; letter-spacing: 0.02em; font-weight: 700; }
h2.sect { font-size: var(--text-sm); letter-spacing: 0.22em; text-transform: uppercase; margin: 0; color: var(--ink-2); font-weight: 600; }
.lede { color: var(--ink-2); margin: 6px 0 0; max-width: 62ch; }
.head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }

.grid { display: grid; gap: var(--gap); }
.g-hero { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.card { position: relative; background: linear-gradient(180deg, var(--plate), var(--cave)); border-radius: var(--r-lg);
  box-shadow: 0 0 0 1px var(--edge); padding: var(--pad); min-width: 0; overflow: hidden; }
.card.hud::before { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(90deg, var(--hud-dim), transparent 30%) top left / 100% 1px no-repeat,
              linear-gradient(180deg, var(--hud-dim), transparent 40%) top left / 1px 100% no-repeat; }
.card.alert { box-shadow: 0 0 0 1px rgba(255, 90, 90, 0.35); background: linear-gradient(180deg, #1a1113, var(--cave)); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.link-btn { border: 0; background: none; color: var(--hud); cursor: pointer; font-size: var(--text-xs); letter-spacing: 0.14em; padding: 0; }
.link-btn:hover { color: var(--ink); }

.kpi-label { font-size: var(--text-xs); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font: 600 1.7rem/1.1 var(--font-mono); margin-top: 6px; letter-spacing: -0.02em; }
.kpi-value.hero { font-size: var(--text-hero); color: var(--ink); text-shadow: 0 0 40px rgba(95, 212, 255, 0.15); }
.kpi-sub { color: var(--ink-2); font-size: var(--text-sm); margin-top: 6px; }
.up { color: var(--ok); }
.down { color: var(--danger); }

.light { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.light.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.light.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.light.bad { background: var(--danger); box-shadow: 0 0 10px var(--danger); animation: pulse 1.6s infinite; }
.light.cloud { background: var(--hud); box-shadow: 0 0 10px var(--hud); }
@keyframes pulse { 50% { opacity: 0.35; } }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-xs); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-2); }

.table-wrap { overflow-x: auto; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: left; font-weight: 500; font-size: var(--text-xs); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--edge-2); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--edge); vertical-align: middle; }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr { transition: background var(--fast); }
tbody tr:hover { background: rgba(95, 212, 255, 0.04); }
.tag { display: inline-block; font-size: var(--text-xs); letter-spacing: 0.12em; padding: 2px 8px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px currentColor; text-transform: uppercase; white-space: nowrap; }
.tag.long { color: var(--ok); }
.tag.short { color: var(--danger); }
.tag.flag { color: var(--warn); }

.runs { display: flex; flex-direction: column; gap: 4px; }
.run { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 9px 10px; border-radius: var(--r-md); color: var(--ink-2); font-size: var(--text-sm); transition: background var(--fast); }
.run:hover { background: var(--plate-2); color: var(--ink); }
.run[aria-current="true"] { background: var(--plate-3); color: var(--ink); box-shadow: inset 2px 0 0 var(--signal); }
.run .when { flex: 1; }
.dots { display: flex; gap: 4px; }
.dots i { width: 10px; height: 10px; border-radius: 2px; background: var(--plate-3); }
.dots i.ok { background: var(--ok); } .dots i.bad { background: var(--danger); } .dots i.none { background: var(--muted); }

.report { font-size: var(--text-sm); line-height: 1.65; color: var(--ink-2); max-width: 100%; overflow-wrap: anywhere; }
.report h1, .report h2, .report h3, .report h4 { color: var(--ink); letter-spacing: 0.04em; margin: 1.4em 0 0.5em; font-size: var(--text-base); }
.report h2 { font-size: var(--text-lg); }
.report strong { color: var(--ink); }
.report code { font-family: var(--font-mono); font-size: 0.85em; background: var(--plate-3); padding: 1px 5px; border-radius: 4px; }
.report pre { background: var(--void); padding: 12px; border-radius: var(--r-md); overflow-x: auto; box-shadow: inset 0 0 0 1px var(--edge); }
.report pre code { background: none; padding: 0; }
.report table { margin: 10px 0; font-size: var(--text-xs); }
.report .tbl { overflow-x: auto; }
.report ul, .report ol { padding-left: 1.3em; }
.report.clamp { max-height: 520px; overflow-y: auto; padding-right: 8px; }

.empty { color: var(--muted); padding: 28px 0; text-align: center; font-size: var(--text-sm); letter-spacing: 0.06em; }
.err { color: var(--danger); font-size: var(--text-sm); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--plate); box-shadow: inset 0 0 0 1px var(--edge);
  cursor: pointer; font-size: var(--text-xs); letter-spacing: 0.1em; color: var(--ink-2); transition: all var(--fast); }
.chip:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge-2); }
.chip[aria-pressed="true"] { color: var(--void); background: var(--signal); box-shadow: none; }
.chip b { font-family: var(--font-mono); margin-left: 6px; }
.search { background: var(--cave); border: 0; border-radius: 999px; padding: 8px 14px; box-shadow: inset 0 0 0 1px var(--edge-2);
  min-width: 220px; }
select.status { background: var(--cave); border: 0; border-radius: var(--r-sm); padding: 5px 6px; box-shadow: inset 0 0 0 1px var(--edge-2); cursor: pointer; }

.funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
.funnel div { padding: 14px 16px; background: var(--plate-2); }
.funnel div:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.funnel div:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.funnel .kpi-value { font-size: 2rem; }

.agent { display: flex; flex-direction: column; gap: 10px; }
.agent .codename { font: 700 var(--text-lg) var(--font-mono); letter-spacing: 0.2em; color: var(--signal); }
.agent .meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: var(--text-sm); color: var(--ink-2); }
.agent .meta dt { color: var(--muted); font-size: var(--text-xs); letter-spacing: 0.14em; text-transform: uppercase; padding-top: 2px; }
.agent .meta dd { margin: 0; }
.logbox { font: var(--text-xs)/1.5 var(--font-mono); background: var(--void); border-radius: var(--r-md); padding: 10px;
  color: var(--ink-2); max-height: 180px; overflow: auto; white-space: pre-wrap; box-shadow: inset 0 0 0 1px var(--edge); }

.spark { width: 100%; height: 150px; display: block; }
iframe.vitals { width: 100%; height: 1500px; border: 0; border-radius: var(--r-lg); background: var(--plate); }

/* ---------- Alfred console ---------- */
#alfred { position: fixed; z-index: 30; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(94vw, 760px);
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-lg);
  background: rgba(10, 12, 15, 0.92); backdrop-filter: blur(10px);
  box-shadow: 0 0 0 1px var(--edge-2), 0 20px 60px -20px #000; }
#alfred .who { font: 700 var(--text-xs) var(--font-mono); letter-spacing: 0.2em; color: var(--hud); padding-top: 3px; white-space: nowrap; }
#alfred .said { flex: 1; font-size: var(--text-sm); color: var(--ink); min-height: 1.5em; }
#alfred .said::after { content: "▍"; color: var(--hud); animation: blink 1s steps(2) infinite; margin-left: 2px; }
#alfred.idle .said::after { content: ""; }
@keyframes blink { 50% { opacity: 0; } }
.wave { display: flex; gap: 2px; align-items: center; height: 18px; padding-top: 2px; }
.wave i { width: 2px; height: 4px; background: var(--hud); border-radius: 1px; }
#alfred.speaking .wave i { animation: bar 700ms ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: -120ms !important; } .wave i:nth-child(3) { animation-delay: -240ms !important; }
.wave i:nth-child(4) { animation-delay: -360ms !important; } .wave i:nth-child(5) { animation-delay: -480ms !important; }
@keyframes bar { 50% { height: 16px; } }

@media (max-width: 980px) {
  .g-hero, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: auto; }
  .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel div { border-radius: var(--r-md) !important; }
}
@media (max-width: 560px) {
  .brand small, .clock { display: none; }
  .code-cells input { width: 40px; height: 52px; }
  .tabs { top: 59px; }
  .search { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* fixes */
[hidden] { display: none !important; }
.agent .link-btn { align-self: flex-start; }
td a { white-space: nowrap; }

/* ---------- goals: meters, missions, agents ---------- */
.meter { display: flex; flex-direction: column; gap: 8px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.meter-num { color: var(--ink-2); font-size: var(--text-sm); }
.meter-num strong { color: var(--ink); font-size: 1.5rem; }
.meter-track { height: 8px; border-radius: 999px; background: var(--plate-3); overflow: hidden; }
.meter-fill { height: 100%; width: 100%; transform-origin: left; background: var(--hud); border-radius: inherit;
  transition: transform 900ms var(--ease); box-shadow: 0 0 12px rgba(95, 212, 255, 0.4); }
.meter.done .meter-fill { background: var(--signal); box-shadow: 0 0 14px var(--signal-glow); }
.meter.far .meter-fill { background: #3b7ea1; box-shadow: none; }

.agent-top { display: flex; align-items: center; gap: 10px; }
.agent-top .spacer { flex: 1; }
.goal-tag { font: 600 var(--text-xs) var(--font-mono); letter-spacing: 0.14em; color: var(--hud); padding: 2px 8px;
  border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(95, 212, 255, 0.35); }
.how { margin: 0; padding-left: 1.3em; color: var(--ink-2); font-size: var(--text-sm); display: grid; gap: 4px; }
.how li::marker { color: var(--signal); font-family: var(--font-mono); }

.roi-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--pad); align-items: center; }
.roi-hero.win { box-shadow: 0 0 0 1px rgba(243, 196, 49, 0.45), 0 0 60px -20px var(--signal-glow); }
.roi-hero .kpi-value.hero.up { color: var(--ink); text-shadow: 0 0 40px rgba(61, 220, 132, 0.25); }
.axis-note { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--muted); margin-top: 6px; }

.stale { margin: 12px var(--pad) 0; padding: 10px 14px; border-radius: var(--r-md); font-size: var(--text-sm);
  background: rgba(243, 196, 49, 0.08); color: var(--signal); box-shadow: inset 0 0 0 1px rgba(243, 196, 49, 0.3); }

@media (max-width: 980px) { .roi-hero { grid-template-columns: minmax(0, 1fr); } }

/* ---------- trading: live badge + equity chart ---------- */
.live-badge { display: inline-flex; align-items: center; gap: 8px; font: 600 var(--text-xs) var(--font-mono);
  letter-spacing: 0.12em; color: var(--ok); padding: 4px 10px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(61, 220, 132, 0.35); }
.live-badge.off { color: var(--muted); box-shadow: inset 0 0 0 1px var(--edge-2); }
svg.equity { width: 100%; height: auto; display: block; overflow: visible; }
svg.equity .axis { font: 11px var(--font-mono); fill: var(--muted); }
svg.equity .axis.goal { fill: var(--signal); }
svg.equity circle { cursor: default; }
.muted { color: var(--muted); }

/* =====================================================================
   THEME v2 — sign-in: the cave (lifted brighter); signed-in: the lit
   Batmobile bunker with smoked-glass panels (Tumbler matte black + gold).
   ===================================================================== */
:root {
  --glass: rgba(14, 16, 19, 0.80);
  --glass-2: rgba(22, 25, 30, 0.86);
  --glass-edge: rgba(255, 255, 255, 0.10);
  --hud: #8fd3ff;
  --hud-dim: rgba(143, 211, 255, 0.16);
}

/* ---- sign-in: the cave ---- */
#gate { place-items: end center; }
.gate-bg { position: absolute; inset: 0; background: #0b0d10 url("/cave/img/cave.webp") center 35% / cover no-repeat;
  animation: cave-in 2.4s var(--ease) both; }
.gate-bg::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(55% 55% at 50% 40%, transparent 30%, rgba(5, 6, 8, 0.55) 100%),
              linear-gradient(to bottom, transparent 55%, rgba(5, 6, 8, 0.7)); }
#gate.lit .gate-bg { filter: brightness(1.12); transition: filter 1.2s var(--ease); }
@keyframes cave-in { from { opacity: 0; transform: scale(1.06); } }
.gate-card { margin: 0 0 6vh; background: rgba(10, 12, 15, 0.62); backdrop-filter: blur(10px) saturate(1.1);
  box-shadow: 0 0 0 1px var(--glass-edge), 0 30px 80px -20px #000; }
@media (min-width: 1100px) {
  #gate { place-items: center end; }
  .gate-card { margin: 0 7vw 0 0; }   /* keep the figure in frame; card sits in the right light shaft */
}
.fog { opacity: 0.6; }
body.in-cave .fog, body.in-cave .scanlines { display: none; }

/* ---- signed-in: the bunker ---- */
body.in-cave { background: #cfd3d6 url("/api/cave/bg/bunker") center top / cover fixed no-repeat; }
body.in-cave::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.10), rgba(20, 22, 26, 0.18) 60%, rgba(20, 22, 26, 0.42)); }
body.in-cave .topbar, body.in-cave .tabs { background: rgba(12, 14, 17, 0.82); border-bottom-color: var(--glass-edge); }
body.in-cave .head { background: var(--glass); backdrop-filter: blur(12px); padding: 18px var(--pad);
  border-radius: var(--r-lg); box-shadow: 0 0 0 1px var(--glass-edge), 0 18px 50px -24px rgba(0, 0, 0, 0.6); }
body.in-cave .card { background: linear-gradient(180deg, var(--glass-2), var(--glass)); backdrop-filter: blur(14px) saturate(1.05);
  box-shadow: 0 0 0 1px var(--glass-edge), 0 22px 60px -28px rgba(0, 0, 0, 0.75); }
body.in-cave .card.alert { background: linear-gradient(180deg, rgba(48, 18, 20, 0.88), rgba(24, 12, 14, 0.85)); }
body.in-cave .card.hud::before { background:
    linear-gradient(90deg, rgba(243, 196, 49, 0.35), transparent 35%) top left / 100% 1px no-repeat,
    linear-gradient(180deg, rgba(243, 196, 49, 0.35), transparent 45%) top left / 1px 100% no-repeat; }
body.in-cave .roi-hero.win { box-shadow: 0 0 0 1px rgba(243, 196, 49, 0.55), 0 0 70px -18px var(--signal-glow); }
body.in-cave #alfred { background: rgba(10, 12, 15, 0.88); }
body.in-cave .empty { color: var(--ink-2); }

/* One sticky unit for bar + tabs (no seam for the background to show through). */
.chrome { position: sticky; top: 0; z-index: 20; }
.chrome .topbar, .chrome .tabs { position: static; backdrop-filter: none; }
body.in-cave .chrome { background: rgba(12, 14, 17, 0.84); backdrop-filter: blur(10px); box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.7); }
body.in-cave .chrome .topbar, body.in-cave .chrome .tabs { background: transparent; }

/* ---------- market outlook (X) ---------- */
.outlook-overall { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.outlook-src { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: var(--r-md);
  background: var(--plate-3); box-shadow: inset 0 0 0 1px var(--edge); min-width: 0; }
.outlook-src-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.outlook-src-head .source-name { color: var(--ink); text-decoration: none; }
.outlook-src-head .source-name:hover, .outlook-src-head .source-name:focus-visible { color: var(--signal); }
.outlook-levels { color: var(--signal); font-size: var(--text-xs); overflow-wrap: anywhere; }
.outlook-quote { color: var(--ink-2); font-size: var(--text-sm); font-style: italic; text-decoration: none; overflow-wrap: anywhere;
  border-left: 2px solid var(--edge); padding-left: 8px; transition: border-color var(--duration-fast, 150ms) ease; }
.outlook-quote:hover, .outlook-quote:focus-visible { border-left-color: var(--signal); color: var(--ink); }
.outlook-count { font-size: var(--text-xs); }

/* ---------- signal sources ---------- */
.sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.source { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--r-md); text-decoration: none;
  color: var(--ink); background: rgba(255, 255, 255, 0.03); box-shadow: inset 0 0 0 1px var(--glass-edge);
  transition: transform var(--fast), box-shadow var(--fast), background var(--fast); }
.source:hover { transform: translateY(-2px); background: rgba(243, 196, 49, 0.06); box-shadow: inset 0 0 0 1px rgba(243, 196, 49, 0.45); }
.source-name { font-weight: 600; letter-spacing: 0.04em; }
.source-handle { color: var(--signal); font-size: var(--text-sm); }

/* ---------- trading chart (black, exchange-style) ---------- */
/* Chart card uses the same smoked-glass card as the rest of the page; the chart canvas itself is transparent. */
.card.tv-card { padding: 16px 16px 10px; }
.tv-card .sect { color: var(--ink-2); }
.tv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tv-legend { font-size: 12px; color: #c9d1d9; margin-top: 6px; white-space: pre-wrap; min-height: 1.2em; }
.tv-tfs { display: inline-flex; gap: 2px; background: #0d1117; border-radius: 8px; padding: 3px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.tv-tf { border: 0; background: transparent; color: #8b949e; font: 600 12px var(--font-mono); padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.tv-tf:hover { color: #e6edf3; background: rgba(255, 255, 255, 0.06); }
.tv-tf[aria-pressed="true"] { color: #000; background: var(--signal); }
.tv-host { height: 400px; width: 100%; position: relative; }
@media (max-width: 560px) { .tv-host { height: 300px; } }

/* ---------- JOB · today's mission ---------- */
.btn { border: 0; cursor: pointer; border-radius: 999px; padding: 6px 14px; font-size: var(--text-xs); letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--void); background: var(--signal); box-shadow: 0 0 18px var(--signal-glow);
  transition: transform var(--fast) ease, box-shadow var(--fast) ease; text-decoration: none; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 26px var(--signal-glow); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: none; color: var(--hud); box-shadow: inset 0 0 0 1px var(--hud-dim); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--hud); }
.card.alert-soft { box-shadow: 0 0 0 1px rgba(243, 196, 49, 0.28); }
.mission { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.mission-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.mission-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--plate-2); box-shadow: inset 0 0 0 1px var(--edge); transition: opacity 200ms ease; }
.mission-list li.done { opacity: 0.55; }
.mission-list li.done strong { text-decoration: line-through; text-decoration-color: var(--ok); }
.mission-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.mission-text span { font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 0; cursor: pointer; background: var(--plate-3);
  box-shadow: inset 0 0 0 1px var(--edge-2); position: relative; }
.check.on { background: var(--ok); box-shadow: 0 0 12px rgba(61, 220, 132, 0.4); }
.check.on::after { content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid var(--void);
  border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check:disabled { cursor: default; }

/* ---------- ACADEMICS ---------- */
.kpi-value.alarm { color: var(--danger); text-shadow: 0 0 24px rgba(255, 90, 90, 0.35); }
.class-list, .todo, .tests { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.class-list li { display: grid; grid-template-columns: 7.5em auto 1fr; gap: 10px; align-items: baseline; font-size: var(--text-sm); }
.class-list .muted { text-align: right; }
.todo li { display: grid; grid-template-columns: 6.5em minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 9px 0;
  border-bottom: 1px solid var(--edge); font-size: var(--text-sm); }
.todo li:last-child { border-bottom: 0; }
.todo li.soon .todo-due { color: var(--warn); }
.todo li.missing { box-shadow: inset 3px 0 0 var(--danger); padding-left: 10px; }
.todo-course { color: var(--hud); font-size: var(--text-xs); }
.todo-due { color: var(--ink-2); font-size: var(--text-xs); text-align: right; }
.todo a, .tests a, .kpi-sub a { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--edge-2); }
.todo a:hover, .tests a:hover, .kpi-sub a:hover { color: var(--signal); border-bottom-color: var(--signal); }
.grades { display: grid; gap: 14px; }
.grade-top { display: flex; justify-content: space-between; gap: 10px; font-size: var(--text-sm); margin-bottom: 6px; }
.grade.done .meter-fill { background: var(--ok); }
.grade.near .meter-fill { background: var(--warn); }
.grade.far .meter-fill { background: var(--danger); }
.tests li { display: grid; grid-template-columns: 4.2em 7.5em 6em minmax(0, 1fr) auto; gap: 10px; align-items: baseline; font-size: var(--text-sm); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head div { font-size: var(--text-xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); padding: 0 4px 4px; }
.cal-day { min-height: 74px; border-radius: 6px; background: var(--plate-2); box-shadow: inset 0 0 0 1px var(--edge); padding: 4px; display: grid;
  align-content: start; gap: 2px; min-width: 0; }
.cal-day.past { opacity: 0.4; }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--signal), 0 0 14px var(--signal-glow); }
.cal-num { font: 600 var(--text-xs) var(--font-mono); color: var(--ink-2); }
.cal-item { font-size: 0.66rem; line-height: 1.25; padding: 1px 4px; border-radius: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--hud-dim); color: var(--ink); }
.cal-item.exam { background: var(--danger-dim); color: var(--danger); font-weight: 600; }
.cal-item.quiz { background: rgba(243, 196, 49, 0.12); color: var(--warn); }
.cal-item.done { background: rgba(61, 220, 132, 0.1); color: var(--ok); text-decoration: line-through; }
.cal-more { font-size: 0.66rem; color: var(--muted); }
.cal-legend { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.week-col { display: grid; gap: 6px; align-content: start; padding: 8px; border-radius: var(--r-md); background: var(--plate-2);
  box-shadow: inset 0 0 0 1px var(--edge); min-height: 120px; }
.week-col.today { box-shadow: inset 0 0 0 1px var(--signal); }
.week-name { font-size: var(--text-xs); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.week-col.today .week-name { color: var(--signal); }
.week-block { display: grid; gap: 1px; padding: 6px 8px; border-radius: 6px; background: var(--plate-3); border-left: 2px solid var(--hud);
  font-size: var(--text-xs); }
@media (max-width: 980px) {
  .mission, .week { grid-template-columns: minmax(0, 1fr); }
  .week-col { min-height: 0; }
  .tests li { grid-template-columns: 4.2em 1fr; }
  .tests li > :nth-child(n+4) { grid-column: 2; }
}
@media (max-width: 560px) {
  .cal-item { font-size: 0; padding: 0; height: 5px; }  /* dots on phones; tap a day's title tooltip on desktop */
  .cal-day { min-height: 44px; }
  .todo li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .todo-due { text-align: left; }
  .mission-list li { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .btn, .mission-list li { transition: none; } }
@media (max-width: 420px) {
  .toggles { margin-left: auto; gap: 4px; }
  .tog { padding: 5px 7px; letter-spacing: 0.06em; }
  .brand { letter-spacing: 0.18em; }
}
@media (max-width: 360px) { .brand svg { width: 26px; } .topbar { gap: 8px; } }
@media (max-width: 560px) { .card-head { flex-wrap: wrap; } .card-head .btn { width: 100%; text-align: center; } }

/* ---------- JOB · AI Brief ---------- */
.news-headline { margin: 0 0 12px; color: var(--signal); font-size: var(--text-lg); font-weight: 600; }
.news { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.news-item { padding: 12px 14px; border-radius: var(--r-md); background: var(--plate-2); box-shadow: inset 0 0 0 1px var(--edge);
  transition: box-shadow 250ms ease, transform 250ms ease; }
.news-item.reading { box-shadow: inset 0 0 0 1px var(--signal), 0 0 18px var(--signal-glow); transform: translateY(-1px); }
.news-meta { display: flex; gap: 8px; align-items: baseline; font-size: var(--text-xs); }
.news-title { margin: 8px 0 6px; font-size: var(--text-base); line-height: 1.3; }
.news-title a { color: var(--ink); text-decoration: none; }
.news-title a:hover { color: var(--signal); }
.news-item p { margin: 0 0 6px; font-size: var(--text-sm); color: var(--ink-2); line-height: 1.5; }
.news-why { border-left: 2px solid var(--hud); padding-left: 8px; }
.news-why b { color: var(--hud); font-weight: 600; }
.news-learn { display: grid; gap: 2px; margin-top: 12px; padding: 12px 14px; border-radius: var(--r-md); background: rgba(95, 212, 255, 0.06);
  box-shadow: inset 0 0 0 1px var(--hud-dim); font-size: var(--text-sm); }
.news-learn a { color: var(--hud); }
.learn-videos { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.learn-videos a { text-decoration: none; font-weight: 600; }
.learn-videos a:hover, .learn-videos a:focus-visible { text-decoration: underline; }
@media (max-width: 980px) { .news { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .news-item { transition: none; } .news-item.reading { transform: none; } }

/* Degree plan (ACADEMICS) */
.dg-meter { position: relative; height: 10px; border-radius: 999px; background: var(--plate-3); overflow: hidden; margin: 4px 0 8px; }
.dg-seg { position: absolute; top: 0; bottom: 0; }
.dg-seg.now { background: var(--ok); }
.dg-seg.pet { background: var(--hud); }
.dg-seg.ask { background: repeating-linear-gradient(45deg, var(--warn) 0 4px, transparent 4px 8px); }
.dg-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--text-xs); color: var(--ink-2); margin-bottom: 14px; }
.dg-legend .now { color: var(--ok); } .dg-legend .pet { color: var(--hud); } .dg-legend .ask { color: var(--warn); }
.dg-terms { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.dg-term { background: var(--plate-2); border: 1px solid var(--edge); border-radius: var(--r-md); padding: 8px; }
.dg-term.dg-now { border-color: var(--hud); }
.dg-term.dg-plan { border-style: dashed; }
.dg-term.dg-optional { opacity: 0.7; }
.dg-term-head { display: flex; justify-content: space-between; font-weight: 600; letter-spacing: 0.08em; margin-bottom: 8px; }
.dg-term ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dg-course { border-left: 3px solid var(--edge-2); padding: 4px 6px; background: var(--plate); border-radius: var(--r-sm); }
.dg-row { display: flex; justify-content: space-between; gap: 6px; font-size: var(--text-sm); }
.dg-title { font-size: var(--text-xs); color: var(--ink-2); }
.dg-status { font-size: var(--text-xs); letter-spacing: 0.06em; color: var(--muted); }
.dg-ok { border-left-color: var(--ok); }
.dg-hud { border-left-color: var(--hud); } .dg-hud .dg-status { color: var(--hud); }
.dg-warn { border-left-color: var(--warn); } .dg-warn .dg-status { color: var(--warn); }
.dg-bad { border-left-color: var(--danger); opacity: 0.75; } .dg-bad strong { text-decoration: line-through; } .dg-bad .dg-status { color: var(--danger); }
.dg-mute { opacity: 0.5; }
.dg-plan { border-left-color: var(--edge-2); }
.dg-note { font-size: var(--text-xs); margin-top: 10px; }
.dg-label { font-size: var(--text-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 6px 0 6px; }
.dg-terms + .dg-label { margin-top: 14px; }

/* caption under the equity chart: sits on the page background, so give it a plate */
.chart-note { margin: 8px 0 0; padding: 8px 14px; background: var(--plate); border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--edge); }

/* month-start markers on the equity chart (overlay above the canvas, never takes clicks) */
.tv-months { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.tv-month { position: absolute; top: 0; border-left: 1px dashed rgba(243, 196, 49, 0.55); }
.tv-month-label { position: absolute; top: 6px; left: 6px; white-space: nowrap; font-size: 10px; letter-spacing: 0.04em;
  color: #f3c431; background: rgba(13, 17, 23, 0.85); padding: 2px 6px; border-radius: 4px; }

/* GYM — coach's read: recovery strip + ranked findings, tone carried by the left rule */
.coach-recovery { margin-bottom: 12px; }
.coach-marker .kpi-value small { font-size: var(--text-sm); color: var(--muted); }
.coach-down { color: var(--danger); }
.coach-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.coach-item { border-left: 3px solid var(--edge-2); background: var(--plate-2); border-radius: var(--r-sm);
  padding: 10px 12px; transition: transform 150ms ease, background 150ms ease; }
.coach-item:hover { transform: translateX(2px); background: var(--plate-3); }
.coach-item h3 { margin: 2px 0 4px; font-size: var(--text-base); }
.coach-tag { font-size: var(--text-xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.coach-finding { margin: 0 0 6px; color: var(--ink-2); font-size: var(--text-sm); }
.coach-action { margin: 0; font-size: var(--text-sm); }
.coach-action b { color: var(--signal); }
.coach-act { border-left-color: var(--danger); } .coach-act .coach-tag { color: var(--danger); }
.coach-watch { border-left-color: var(--warn); } .coach-watch .coach-tag { color: var(--warn); }
.coach-good { border-left-color: var(--ok); } .coach-good .coach-tag { color: var(--ok); }
@media (prefers-reduced-motion: reduce) { .coach-item { transition: none; } .coach-item:hover { transform: none; } }
.panel-stat .kpi-value { font-size: var(--text-lg); }
.panel-cap { margin: 12px 0 4px; font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.panel-note { margin: 8px 0; font-size: var(--text-sm); color: var(--ink-2); }
.panel-note.load-high, .panel-note.load-under { color: var(--warn); }
.panel-note.load-very_high { color: var(--danger); }
.panel-note.load-optimal { color: var(--ok); }

/* Exit map: one full-width block per group of positions that move together */
.exit-groups { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.exit-group .table-wrap { margin: 4px 0; }
.exit-group td .kpi-sub { display: inline-block; max-width: 22ch; }
.plan-scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; }
.plan-up { box-shadow: inset 3px 0 0 var(--ok), inset 0 0 0 1px var(--edge); }
.plan-flag { box-shadow: inset 3px 0 0 var(--warn), inset 0 0 0 1px var(--edge); }
.plan-down { box-shadow: inset 3px 0 0 var(--danger), inset 0 0 0 1px var(--edge); }
.exit-stack { display: flex; flex-direction: column; gap: 14px; }
