/* Demand Pulse — Vexto / Mirage frost language (matte glass, true black) */
:root {
  --canvas: #000;
  --glass: rgba(18, 18, 20, 0.58);
  --line: rgba(255, 255, 255, 0.15);
  --text: rgba(255, 255, 255, 0.92);
  --text-dim: rgba(255, 255, 255, 0.58);
  --text-faint: rgba(255, 255, 255, 0.38);
  --accent: #f39444;
  --radius: 26px;
  --radius-sm: 16px;
  --gap: 12px;
  --pad: 18px;
  --font-ui: "Geist Variable", "Geist", system-ui, sans-serif;
  --font-num: "Doto Variable", "Doto", sans-serif;
  --font-mono: "Geist Mono Variable", "Geist Mono", ui-monospace, monospace;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body {
  background: var(--canvas);
  color: var(--text);
  margin: 0;
  height: 100%;
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* App shell: ambient out of flow; grid reserves footer rows */
.app {
  position: relative;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--canvas);
}
.ambient {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 18% 22%, rgba(243, 148, 68, 0.18), transparent 55%),
    radial-gradient(ellipse 55% 45% at 82% 18%, rgba(90, 120, 180, 0.16), transparent 50%),
    radial-gradient(ellipse 60% 50% at 70% 78%, rgba(243, 148, 68, 0.1), transparent 55%),
    radial-gradient(ellipse 50% 40% at 12% 85%, rgba(60, 80, 120, 0.14), transparent 50%),
    #000;
}
.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}
.shell {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 54px;
  padding: 0 22px 0 20px;
}
.brand { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.wordmark { font-size: 17px; font-weight: 550; letter-spacing: -0.03em; color: #fff; white-space: nowrap; }
.subtitle { color: var(--text-dim); font-size: 12.5px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-of { color: rgba(255, 255, 255, 0.78); font-family: var(--font-mono); font-size: 12px; font-weight: 400; letter-spacing: 0; white-space: nowrap; }

.top-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(243, 148, 68, 0.4);
  background: rgba(243, 148, 68, 0.1);
  color: var(--accent);
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.nav-link:hover {
  background: rgba(243, 148, 68, 0.18);
  border-color: rgba(243, 148, 68, 0.6);
}


.stage {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: 6px var(--pad) 72px;
}

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 14px 16px 12px;
}
.card-title { display: flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, 0.94); font-size: 13.5px; font-weight: 500; letter-spacing: -0.012em; }
.card-hint { color: var(--text-faint); font-size: 11.5px; font-weight: 400; letter-spacing: -0.006em; margin-left: auto; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); flex: none; }
.kpi { min-width: 0; }
.metric { display: flex; align-items: baseline; gap: 0; margin-top: 10px; }
.num {
  font-family: var(--font-num);
  font-variation-settings: "wght" 550, "ROND" 100;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: #fff;
  font-size: 42px;
  line-height: 0.92;
  font-weight: 550;
}
.num-unit {
  font-family: var(--font-num);
  font-variation-settings: "wght" 500, "ROND" 100;
  letter-spacing: 0;
  color: #fff;
  margin-left: 0.12em;
  font-size: 0.72em;
  font-weight: 500;
}
.num-unit.word { font-family: var(--font-ui); font-size: 18px; font-weight: 500; letter-spacing: -0.02em; margin-left: 0.3em; color: rgba(255, 255, 255, 0.88); }
.kpi[data-kpi="overstock"] .num { font-size: 34px; letter-spacing: -0.01em; }
.metric-caption { color: var(--text-dim); margin-top: 8px; font-size: 12.5px; letter-spacing: -0.008em; line-height: 1.35; }
.kpi-accent { width: 18px; height: 2px; border-radius: 99px; background: var(--accent); margin-top: 12px; opacity: 0.85; }

.scenario {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto auto;
  align-items: center;
  gap: 18px 28px;
  padding: 14px 18px;
  flex: none;
}
.scenario-label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.scenario-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.scenario-headline { margin: 0; font-size: 16px; font-weight: 550; letter-spacing: -0.02em; color: rgba(255, 255, 255, 0.95); line-height: 1.25; }
.scenario-stat { display: flex; flex-direction: column; gap: 2px; text-align: right; }
.scenario-stat .stat-v {
  font-family: var(--font-num);
  font-variation-settings: "wght" 600, "ROND" 100;
  font-size: 22px;
  color: #fff;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.scenario-stat .stat-k { font-size: 11.5px; color: var(--text-dim); }
.scenario-one {
  grid-column: 1 / -1;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.4;
  letter-spacing: -0.006em;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  margin-top: 2px;
}

.exceptions {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 8px;
  overflow: hidden;
}
.exceptions .card-head { display: flex; align-items: center; gap: 12px; padding: 0 4px 10px; flex: none; }
.exception-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); margin-left: auto; }
.exception-count .id-num { font-family: var(--font-mono); font-variation-settings: normal; font-size: inherit; letter-spacing: inherit; font-weight: 500; }
.ex-table { display: flex; flex-direction: column; min-height: 0; flex: 1 1 0; overflow: hidden; }
.ex-colhead {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(220px, 1.4fr);
  column-gap: 14px;
  align-items: center;
  padding: 4px 10px 8px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex: none;
}
.ex-body { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; overflow: auto; min-height: 0; flex: 1 1 0; }
.ex-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(220px, 1.4fr);
  column-gap: 14px;
  align-items: start;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: #fff;
  text-align: left;
  width: 100%;
}
.ex-row:hover { background: rgba(255, 255, 255, 0.04); }
.ex-row:focus-visible { border-color: rgba(243, 148, 68, 0.45); }
.id-num {
  font-family: var(--font-num);
  font-variation-settings: "wght" 600, "ROND" 100;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.95);
}
.cell-item { color: rgba(255, 255, 255, 0.95); font-size: 13.5px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.35; overflow-wrap: anywhere; }
.cell-why { color: rgba(255, 255, 255, 0.78); font-size: 13px; line-height: 1.4; letter-spacing: -0.008em; }
.cell-action { font-size: 12.5px; line-height: 1.4; color: rgba(255, 255, 255, 0.78); letter-spacing: -0.008em; }
.field-k { display: none; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 2px; }

.dock {
  flex: 0 0 auto;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.94);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 4px;
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
}
.gloss {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 0 var(--pad) 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.gloss::-webkit-scrollbar { display: none; }
.gloss-chip {
  flex: 0 0 auto;
  max-width: 280px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(18, 18, 20, 0.45);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.gloss-term { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.gloss-plain { font-size: 12px; color: var(--text-dim); letter-spacing: -0.008em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

.legal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 22px 10px;
}
.disclaimer { color: rgba(255, 255, 255, 0.42); letter-spacing: -0.006em; margin: 0; font-size: 11px; font-weight: 400; line-height: 1.35; }
.repo { color: rgba(255, 255, 255, 0.35); font-family: var(--font-mono); font-size: 11px; text-decoration: none; white-space: nowrap; }
.repo:hover { color: rgba(255, 255, 255, 0.65); }

@media (width <= 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scenario { grid-template-columns: 1fr 1fr; }
  .scenario-label { grid-column: 1 / -1; }
}
@media (width <= 860px) {
  html, body { overflow: auto; height: auto; }
  .app { height: auto; max-height: none; overflow: visible; }
  .shell { height: auto; grid-template-rows: auto auto auto auto; }
  .stage { overflow: visible; }
  .exceptions { min-height: 240px; }
  .topbar { height: auto; padding: 12px 16px 8px; flex-wrap: wrap; gap: 8px; }
  .brand { flex-direction: column; align-items: flex-start; gap: 2px; }
  .subtitle { white-space: normal; }
  .stage { padding: 4px 12px 12px; }
  .num { font-size: 36px; }
  .ex-colhead { display: none; }
  .ex-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 4px;
  }
  .ex-row .cell-item, .ex-row .cell-why, .ex-row .cell-action { grid-column: 1 / -1; }
  .ex-row .cell-action { padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
  .field-k { display: block; }
  .legal { flex-direction: column; align-items: flex-start; padding: 4px 16px 12px; }
  .disclaimer { white-space: normal; }
}
@media (width <= 520px) {
  .kpis { grid-template-columns: 1fr; }
  .scenario { grid-template-columns: 1fr; }
  .scenario-stat { text-align: left; }
  .gloss-chip { max-width: 240px; }
}
@media (height <= 860px) and (width > 860px) {
  .kpi { padding: 10px 12px 8px; }
  .metric { margin-top: 6px; }
  .num { font-size: 34px; }
  .kpi[data-kpi="overstock"] .num { font-size: 28px; }
  .metric-caption { margin-top: 4px; font-size: 11.5px; }
  .kpi-accent { margin-top: 8px; }
  .scenario { padding: 10px 14px; gap: 10px 20px; }
  .scenario-one { display: none; }
  .scenario-stat .stat-v { font-size: 18px; }
  .exceptions { padding: 10px 12px 6px; }
  .ex-row { padding: 8px 10px; }
  .gloss { padding-bottom: 4px; }
  .gloss-chip { padding: 6px 10px; }
  .legal { padding-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

.charts-hint {
  margin: 0 0 2px;
  padding: 0 2px;
  font-size: 12.5px;
  color: var(--text-dim);
  letter-spacing: -0.008em;
}
.charts-hint a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(243, 148, 68, 0.35);
}
.charts-hint a:hover { border-bottom-color: var(--accent); }
