:root {
  --black: #08090b;
  --soft-black: #101114;
  --graphite: #191b1f;
  --carbon: #2b2d32;
  --ice: #f3f6fb;
  --cool-white: #f8faff;
  --silver-light: #c8d1de;
  --silver-surface: #e2e8f1;
  --silver-edge: #aeb9c8;
  --fisher-blue: #01a9fa;
  --success: #16a34a;
  --color-background: #eef3fa;
  --color-surface: #f8faff;
  --color-border: #c8d1de;
  --color-foreground: #08090b;
  --color-subtle: #191b1f;
  --shadow-panel: 0 10px 25px rgba(8, 9, 11, .075);
  --radius: 8px;
  --sidebar-width: 300px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(1, 169, 250, .42);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  flex: 0 0 auto;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1rem; line-height: 1.2; }
h2 { margin-bottom: 0; font-size: 1.35rem; }
h3 { margin-bottom: 0; font-size: 1rem; }
.eyebrow {
  margin: 0 0 3px;
  color: inherit;
  opacity: .72;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.login-overlay {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 78% 18%, rgba(1, 169, 250, .22), transparent 28%),
    radial-gradient(circle at 12% 76%, rgba(1, 169, 250, .12), transparent 32%),
    linear-gradient(145deg, #08090b, #191b1f);
}
.login-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid rgba(200, 209, 222, .42);
  border-radius: var(--radius);
  background: var(--cool-white);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .34);
}
.login-card img {
  width: min(290px, 100%);
  margin: -4px 0 24px -16px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--black);
}
.login-card h1 { margin-bottom: 10px; font-size: 1.7rem; }
.login-card > p:not(.eyebrow):not(.form-message) { color: #39404a; }
label { display: grid; gap: 6px; font-size: .83rem; font-weight: 800; }
input, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--silver-edge);
  border-radius: var(--radius);
  background: #fff;
  color: var(--black);
}
.login-card .primary-button { width: 100%; margin-top: 16px; }
.form-message { min-height: 24px; margin: 12px 0 0; color: #b91c1c; font-size: .85rem; font-weight: 700; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-right: 1px solid var(--color-border);
  background:
    radial-gradient(circle at 92% 10%, rgba(1, 169, 250, .22), transparent 28%),
    radial-gradient(circle at 14% 58%, rgba(1, 169, 250, .12), transparent 32%),
    linear-gradient(180deg, #08090b 0%, #101114 54%, #08090b 100%);
  color: var(--cool-white);
  box-shadow: inset -1px 0 0 rgba(1, 169, 250, .16);
}
.brand-block { display: grid; gap: 10px; min-height: 92px; }
.brand-logo {
  display: block;
  width: min(260px, 100%);
  max-height: 58px;
  height: auto;
  margin-left: -16px;
  object-fit: contain;
  object-position: left center;
}
.nav-list { display: grid; gap: 6px; }
.nav-item, .primary-button, .icon-button, .sidebar-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.nav-item, .sidebar-signout {
  justify-content: flex-start;
  width: 100%;
  padding: 10px 12px;
  border-color: rgba(200, 209, 222, .52);
  background: linear-gradient(180deg, #fff 0%, var(--silver-surface) 100%);
  color: var(--black);
  text-align: left;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .16);
}
.nav-item:hover, .nav-item.is-active, .sidebar-signout:hover, .icon-button:hover {
  border-color: rgba(1, 169, 250, .66);
  background: linear-gradient(180deg, #eaf7ff 0%, #c8d1de 100%);
}
.nav-item.is-active { box-shadow: inset 4px 0 0 var(--fisher-blue), 0 8px 18px rgba(1, 169, 250, .18); }
.nav-item svg, .sidebar-signout svg { color: var(--fisher-blue); }
.saved-panel { min-height: 0; display: flex; flex: 1; flex-direction: column; gap: 10px; }
.panel-heading, .section-heading, .topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-heading h2 { color: var(--cool-white); font-size: .9rem; }
.icon-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
  border-color: rgba(200, 209, 222, .52);
  background: linear-gradient(180deg, #fff 0%, var(--silver-surface) 100%);
  color: var(--fisher-blue);
}
.saved-list { display: grid; gap: 8px; min-height: 0; overflow: auto; }
.saved-item {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(226, 232, 240, .14);
  border-radius: var(--radius);
  background: rgba(25, 27, 31, .7);
  color: #d8dde6;
  text-align: left;
}
.saved-item:hover { border-color: rgba(1, 169, 250, .55); background: #191b1f; }
.saved-item strong, .saved-item span, .saved-item small { display: block; }
.saved-item span { color: #aab4c2; font-size: .8rem; }
.saved-item small { margin-top: 4px; color: #8996a8; font-size: .7rem; font-weight: 700; }
.sidebar-signout { margin-top: auto; }

.workspace { min-width: 0; padding: 18px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  margin: -18px -18px 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  background: rgba(248, 250, 252, .96);
  backdrop-filter: blur(12px);
}
.topbar .eyebrow { color: var(--color-subtle); }
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  color: #39404a;
  font-size: .78rem;
  font-weight: 800;
}
.status-chip span { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(22, 163, 74, .14); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: end;
  gap: 20px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid rgba(1, 169, 250, .22);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 92% 8%, rgba(1, 169, 250, .11), transparent 28%),
    linear-gradient(135deg, #fff 0%, #f3f6fb 48%, #e2e8f1 100%);
  box-shadow: var(--shadow-panel);
}
.hero-panel h3 { max-width: 760px; font-size: clamp(1.2rem, 2vw, 1.55rem); }
.hero-panel p:last-child { margin: 8px 0 0; color: #4b5563; }
.period-control { align-self: center; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.metric-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}
.metric-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(1, 169, 250, .12);
  color: var(--fisher-blue);
}
.metric-icon.claude { background: #f3e7df; color: #b55b32; }
.metric-icon.codex { background: #e6f7ff; color: #007bb8; }
.metric-icon svg { width: 23px; height: 23px; }
.metric-card strong { display: block; overflow: hidden; font-size: clamp(1.25rem, 2vw, 1.65rem); font-variant-numeric: tabular-nums; text-overflow: ellipsis; }
.metric-card small { color: #4b5563; font-size: .73rem; font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-8 { grid-column: span 8; }
.span-4 { grid-column: span 4; }
.span-12 { grid-column: span 12; }
.panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}
.section-heading { margin-bottom: 14px; }
.section-copy { margin: -4px 0 18px; color: #4b5563; }
.legend { display: flex; align-items: center; gap: 6px; color: #4b5563; font-size: .76rem; font-weight: 700; }
.legend span { width: 9px; height: 9px; margin-left: 6px; border-radius: 50%; }
.claude-dot { background: #b55b32; }
.codex-dot { background: var(--fisher-blue); }
.chart { min-height: 300px; overflow-x: auto; }
.chart svg { width: 100%; min-width: 620px; height: 300px; overflow: visible; }
.chart .grid-line { stroke: #d8dde6; stroke-width: 1; }
.chart .axis-label { fill: #667085; stroke: none; font-size: 11px; font-weight: 700; }
.chart .claude-line { stroke: #b55b32; stroke-width: 3; fill: none; }
.chart .codex-line { stroke: var(--fisher-blue); stroke-width: 3; fill: none; }
.chart .claude-area { fill: rgba(181, 91, 50, .08); stroke: none; }
.chart .codex-area { fill: rgba(1, 169, 250, .09); stroke: none; }
.empty-state { display: grid; place-items: center; min-height: 240px; color: #667085; font-weight: 700; text-align: center; }

.token-mix { display: grid; gap: 15px; }
.mix-row { display: grid; gap: 6px; }
.mix-row div { display: flex; justify-content: space-between; gap: 12px; font-size: .8rem; font-weight: 800; }
.mix-track { height: 9px; overflow: hidden; border-radius: 999px; background: var(--silver-surface); }
.mix-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #008bcd, var(--fisher-blue)); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--color-border); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
th { color: #4b5563; font-size: .7rem; letter-spacing: .02em; text-transform: uppercase; }
.agent-pill { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: #e6f7ff; color: #007bb8; font-size: .7rem; font-weight: 800; text-transform: capitalize; }
.agent-pill.claude { background: #f3e7df; color: #914523; }

.history-grid, .model-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.history-card, .model-card {
  padding: 15px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #fff, #f3f6fb);
}
.history-card strong, .history-card span, .model-card strong, .model-card span { display: block; }
.history-card span, .model-card span { color: #667085; font-size: .78rem; }
.history-card .history-cost, .model-card .model-cost { margin-top: 12px; color: var(--black); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.model-card header { display: flex; justify-content: space-between; gap: 10px; }
.model-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 0; }
.model-card dt { color: #667085; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.model-card dd { margin: 0; font-size: .84rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.forecast-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
.range-label { margin-top: 22px; }
input[type="range"] { padding: 0; border: 0; accent-color: var(--fisher-blue); }
.forecast-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.forecast-grid div { padding: 16px; border: 1px solid var(--color-border); border-radius: var(--radius); background: #fff; }
.forecast-grid span, .forecast-grid strong { display: block; }
.forecast-grid span { color: #667085; font-size: .76rem; font-weight: 800; }
.forecast-grid strong { margin-top: 4px; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.assumption-card { align-self: start; background: var(--black); color: var(--cool-white); }
.assumption-card p:last-child { margin: 10px 0 0; color: var(--silver-light); }
.primary-button {
  padding: 10px 16px;
  border-color: #008fd4;
  background: linear-gradient(180deg, #14b7ff, #0198df);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(1, 169, 250, .22);
}
.primary-button:hover { background: linear-gradient(180deg, #42c5ff, #008fd4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-8, .span-4 { grid-column: span 12; }
  .forecast-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; }
  .nav-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .nav-item { justify-content: center; }
  .nav-item.is-active { box-shadow: inset 0 -4px 0 var(--fisher-blue), 0 8px 18px rgba(1, 169, 250, .18); }
  .saved-panel { max-height: 230px; }
  .history-grid, .model-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .workspace, .sidebar { padding: 12px; }
  .brand-block { min-height: auto; }
  .brand-logo { width: min(300px, 100%); max-height: 52px; margin-left: -8px; }
  .topbar { position: static; align-items: stretch; flex-direction: column; margin: -12px -12px 12px; padding: 12px; }
  .nav-list { gap: 8px; }
  .nav-item { min-height: 58px; flex-direction: column; gap: 4px; padding: 7px 3px; font-size: .72rem; line-height: 1.05; }
  .saved-panel { display: none; }
  .hero-panel { grid-template-columns: 1fr; padding: 15px; }
  .metric-grid, .history-grid, .model-cards, .forecast-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 110px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}
