:root {
  --ink: #11110f;
  --paper: #f1eee5;
  --surface: #fffdf6;
  --lime: #d7ff43;
  --orange: #ff6a35;
  --blue: #3769ff;
  --muted: #716e66;
  --line: rgba(17, 17, 15, 0.16);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Helvetica Neue", Arial, sans-serif;
  --display: Impact, "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); grid-template-rows: 70px 1fr; }
.topbar { position: sticky; top: 0; z-index: 20; grid-column: 1 / -1; display: grid; grid-template-columns: 238px 1fr auto; align-items: center; border-bottom: 1px solid var(--ink); background: var(--surface); }
.brand { height: 70px; display: flex; align-items: center; gap: 10px; padding: 0 22px; border-right: 1px solid var(--ink); font-family: var(--display); font-stretch: expanded; font-weight: 800; letter-spacing: -.055em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; background: var(--ink); color: var(--lime); font-family: var(--mono); font-size: 13px; letter-spacing: -.08em; }
.topbar nav { height: 100%; display: flex; align-items: stretch; padding-left: 20px; }
.nav-item { position: relative; padding: 0 18px; border: 0; background: transparent; cursor: pointer; font-family: var(--mono); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.nav-item::after { content: ""; position: absolute; left: 18px; right: 100%; bottom: 0; height: 3px; background: var(--blue); transition: right 160ms ease; }
.nav-item:hover::after, .nav-item.active::after { right: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; padding-right: 20px; }
.mode-pill { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); font-family: var(--mono); font-size: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.mode-pill i, .eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: #d09422; box-shadow: 0 0 0 3px rgba(208,148,34,.12); }
.mode-pill.live i, .eyebrow i { background: #2eb861; box-shadow: 0 0 0 3px rgba(46,184,97,.12); }
.sync-button { height: 34px; padding: 0 12px; border: 1px solid var(--ink); background: var(--ink); color: var(--surface); cursor: pointer; font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.sync-button:hover { background: var(--lime); color: var(--ink); }
.sync-button:disabled { opacity: .45; cursor: wait; }

.sidebar { position: sticky; top: 70px; height: calc(100vh - 70px); display: flex; flex-direction: column; gap: 16px; padding: 22px 18px 16px; border-right: 1px solid var(--ink); background: #e8e4da; }
.sidebar-label { display: block; color: var(--muted); font-family: var(--mono); font-size: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.workspace-switcher { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--ink); background: var(--surface); text-align: left; }
.workspace-avatar { width: 34px; height: 34px; display: grid; place-items: center; background: var(--blue); color: white; font-family: var(--mono); font-size: 9px; font-weight: 700; }
.workspace-switcher b, .workspace-switcher small { display: block; }
.workspace-switcher b { font-size: 12px; }
.workspace-switcher small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.sidebar-section { padding-top: 18px; border-top: 1px solid var(--line); }
.sidebar-providers { display: grid; gap: 5px; margin-top: 10px; }
.sidebar-provider { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 8px; }
.provider-mark { width: 24px; height: 24px; display: grid; place-items: center; background: var(--lime); color: var(--ink); font-family: var(--mono); font-size: 9px; font-weight: 700; }
.provider-mark.anthropic { background: var(--orange); color: white; }
.provider-mark.google { background: var(--blue); color: white; }
.sidebar-provider span:nth-child(2) { font-size: 11px; font-weight: 600; }
.sidebar-provider b { font-family: var(--mono); font-size: 9px; }
.local-card { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: auto; padding: 13px; border: 1px solid var(--ink); background: var(--lime); }
.local-icon { font-family: var(--mono); font-size: 18px; }
.local-card b { font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.local-card p { margin: 5px 0 0; font-size: 10px; line-height: 1.45; }
.sidebar-footer { display: flex; justify-content: space-between; color: var(--muted); font-family: var(--mono); font-size: 7px; text-transform: uppercase; }

.dashboard-main { min-width: 0; padding: 42px 42px 70px; }
.view { display: none; }
.view.active { display: block; }
.page-heading { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 40px; margin-bottom: 38px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.page-heading h1, .subpage-heading h1 { margin: 0; font-family: var(--display); font-stretch: expanded; font-weight: 800; text-transform: uppercase; letter-spacing: -.045em; }
.page-heading h1 { font-size: clamp(52px, 6vw, 88px); line-height: .82; }
.page-heading h1 em { color: var(--blue); font-style: normal; }
.heading-meta { min-width: 230px; display: grid; gap: 5px; padding-left: 20px; border-left: 3px solid var(--lime); font-family: var(--mono); }
.heading-meta span, .heading-meta small { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }
.heading-meta b { font-size: 11px; }
.period-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 15px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.period-tabs { display: flex; }
.period-tabs button { height: 38px; padding: 0 13px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; font-family: var(--mono); font-size: 8px; font-weight: 600; text-transform: uppercase; }
.period-tabs button.active { background: var(--ink); color: var(--surface); }
.period-row > span { padding-right: 10px; color: var(--muted); font-family: var(--mono); font-size: 8px; text-transform: uppercase; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 18px; border: 1px solid var(--ink); background: var(--ink); }
.metric-card { min-width: 0; padding: 19px 20px; background: var(--surface); }
.metric-card > span { color: var(--muted); font-family: var(--mono); font-size: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.metric-card strong { display: block; margin: 15px 0 12px; overflow: hidden; font-family: var(--mono); font-size: clamp(26px, 3.2vw, 48px); font-weight: 600; line-height: 1; letter-spacing: -.07em; text-overflow: ellipsis; white-space: nowrap; }
.metric-card div { font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.metric-card div b { color: #148448; }
.metric-card div small { color: var(--muted); }
.metric-card.primary { background: var(--ink); color: var(--surface); }
.metric-card.primary > span, .metric-card.primary div small { color: #96948d; }
.metric-card.primary strong { color: var(--lime); }
.metric-card.saving strong { color: var(--orange); }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.48fr) minmax(280px, .52fr); gap: 18px; margin-bottom: 18px; }
.lower-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(310px, .7fr); gap: 18px; }
.panel { min-width: 0; border: 1px solid var(--ink); background: var(--surface); }
.panel-heading { min-height: 58px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 12px 16px; border-bottom: 1px solid var(--ink); }
.panel-heading > div:first-child { display: grid; gap: 3px; }
.panel-heading span, .panel-heading button { color: var(--muted); font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }
.panel-heading b { font-size: 13px; }
.panel-heading button { border: 0; background: none; cursor: pointer; }
.panel-heading button:hover { color: var(--blue); }
.legend { display: flex !important; grid-auto-flow: column; gap: 13px !important; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; }
.spend-panel { position: relative; min-height: 350px; }
.spend-chart { height: 270px; display: flex; align-items: end; gap: 5px; padding: 35px 17px 30px 54px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 66px, rgba(17,17,15,.1) 67px); }
.chart-column { flex: 1; min-width: 9px; height: 100%; display: flex; align-items: end; gap: 1px; position: relative; }
.chart-bar { flex: 1; min-width: 2px; transition: height 280ms ease; }
.chart-bar.openai { background: var(--lime); }
.chart-bar.anthropic { background: var(--orange); }
.chart-bar.google { background: var(--blue); }
.chart-column label { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); color: var(--muted); font-family: var(--mono); font-size: 7px; white-space: nowrap; }
.chart-y-axis { position: absolute; left: 15px; top: 88px; bottom: 35px; display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-family: var(--mono); font-size: 7px; }
.provider-panel { padding-bottom: 18px; }
.provider-donut { width: 156px; height: 156px; display: grid; place-items: center; margin: 26px auto 20px; border-radius: 50%; background: conic-gradient(var(--lime) 0 45%, var(--orange) 45% 75%, var(--blue) 75% 100%); }
.provider-donut > div { width: 102px; height: 102px; display: grid; place-items: center; align-content: center; border-radius: 50%; background: var(--surface); }
.provider-donut strong, .provider-donut span { display: block; font-family: var(--mono); }
.provider-donut strong { font-size: 23px; letter-spacing: -.06em; }
.provider-donut span { margin-top: 4px; color: var(--muted); font-size: 7px; text-transform: uppercase; }
.provider-breakdown { display: grid; margin: 0 18px; }
.provider-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 36px; border-top: 1px solid var(--line); }
.provider-row span:nth-child(2) { font-size: 10px; }
.provider-row strong { font-family: var(--mono); font-size: 10px; }
.provider-dot { width: 8px; height: 8px; }
.project-panel table, .full-table-panel table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: right; font-family: var(--mono); font-size: 9px; }
th { color: var(--muted); font-size: 7px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
th:first-child, td:first-child { text-align: left; }
td:first-child b { display: block; font-family: var(--sans); font-size: 11px; }
td:first-child small { color: var(--muted); font-size: 7px; }
.opportunity-panel { padding: 25px; background: var(--blue); color: white; }
.opportunity-kicker { display: inline-flex; padding: 5px 7px; border: 1px solid rgba(255,255,255,.7); font-family: var(--mono); font-size: 7px; text-transform: uppercase; }
.opportunity-panel h2 { margin: 35px 0 12px; font-size: clamp(26px, 3vw, 40px); line-height: .98; letter-spacing: -.055em; }
.opportunity-panel p { margin: 0; color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.5; }
.opportunity-saving { display: flex; justify-content: space-between; align-items: end; gap: 15px; margin: 35px 0 17px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.35); }
.opportunity-saving span { max-width: 100px; font-family: var(--mono); font-size: 7px; text-transform: uppercase; line-height: 1.5; }
.opportunity-saving strong { color: var(--lime); font-family: var(--mono); font-size: 25px; letter-spacing: -.06em; }
.opportunity-panel button { width: 100%; height: 42px; padding: 0 12px; border: 1px solid white; background: white; color: var(--ink); cursor: pointer; font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.opportunity-panel button:hover { background: var(--lime); }

.subpage-heading { margin: 8px 0 40px; }
.subpage-heading > span { color: var(--blue); font-family: var(--mono); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.subpage-heading h1 { margin-top: 14px; font-size: clamp(48px, 6vw, 88px); line-height: .84; }
.subpage-heading p { max-width: 580px; margin: 20px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.full-table-panel .panel-heading input { width: 210px; height: 34px; padding: 0 10px; border: 1px solid var(--line); outline: 0; background: var(--paper); font-family: var(--mono); font-size: 9px; }
.full-table-panel .panel-heading input:focus { border-color: var(--ink); box-shadow: 3px 3px 0 var(--lime); }
.full-table-panel td { padding-top: 17px; padding-bottom: 17px; }
.efficiency-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 18px; border: 1px solid var(--ink); background: var(--ink); }
.efficiency-grid article { min-width: 0; padding: 18px; background: var(--surface); }
.efficiency-grid span, .efficiency-grid small { display: block; color: var(--muted); font-family: var(--mono); font-size: 7px; text-transform: uppercase; letter-spacing: .05em; }
.efficiency-grid strong { display: block; margin: 13px 0 8px; overflow: hidden; font-family: var(--mono); font-size: clamp(22px, 2.7vw, 38px); letter-spacing: -.06em; text-overflow: ellipsis; white-space: nowrap; }
.recommendations { display: grid; gap: 12px; }
.recommendation { border: 1px solid var(--ink); background: var(--surface); }
.recommendation.verified { box-shadow: inset 5px 0 0 #168143; }
.recommendation.observed { box-shadow: inset 5px 0 0 #3e63dd; }
.recommendation.rejected { box-shadow: inset 5px 0 0 var(--orange); }
.recommendation-status { display: flex; justify-content: space-between; gap: 20px; padding: 11px 18px; border-bottom: 1px solid var(--line); font-family: var(--mono); }
.recommendation-status b { color: var(--blue); font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }
.recommendation.verified .recommendation-status b { color: #168143; }
.recommendation.observed .recommendation-status b { color: #3e63dd; }
.recommendation.rejected .recommendation-status b { color: var(--orange); }
.recommendation-status span { color: var(--muted); font-size: 8px; text-align: right; }
.recommendation-route { display: grid; grid-template-columns: 1.2fr auto 1.2fr .8fr; align-items: center; gap: 20px; padding: 22px; }
.recommendation-model { display: flex; align-items: center; gap: 12px; }
.recommendation-model div { display: grid; gap: 3px; }
.recommendation-model b { font-size: 13px; }
.recommendation-model small { color: var(--muted); font-family: var(--mono); font-size: 8px; }
.recommendation-arrow { font-family: var(--mono); color: var(--blue); }
.recommendation-saving { text-align: right; }
.recommendation-saving span, .recommendation-saving strong { display: block; font-family: var(--mono); }
.recommendation-saving span { color: var(--muted); font-size: 7px; text-transform: uppercase; }
.recommendation-saving strong { margin-top: 6px; color: #168143; font-size: 18px; }
.recommendation.rejected .recommendation-saving strong { color: var(--orange); text-decoration: line-through; }
.quality-note { margin: 16px 0 0; color: var(--muted); font-family: var(--mono); font-size: 8px; line-height: 1.5; }
.privacy-contract { display: grid; grid-template-columns: 160px 1fr; gap: 20px; margin-top: 18px; padding: 18px; border: 1px solid var(--ink); background: var(--lime); }
.privacy-contract b { font-family: var(--mono); font-size: 9px; text-transform: uppercase; }
.privacy-contract p { margin: 0; font-size: 12px; line-height: 1.55; }
.onboarding-card { display: grid; grid-template-columns: 1fr 1.35fr; gap: 40px; margin-bottom: 18px; padding: 24px; border: 1px solid var(--ink); background: var(--blue); color: white; }
.onboarding-copy > span { font-family: var(--mono); font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.onboarding-copy h2 { margin: 28px 0 10px; font-size: 30px; letter-spacing: -.05em; }
.onboarding-copy p { max-width: 430px; margin: 0; color: rgba(255,255,255,.72); font-size: 12px; line-height: 1.55; }
.onboarding-card form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.onboarding-card label { display: grid; gap: 6px; font-family: var(--mono); font-size: 7px; text-transform: uppercase; letter-spacing: .05em; }
.onboarding-card input { width: 100%; height: 42px; padding: 0 11px; border: 1px solid white; outline: none; background: rgba(255,255,255,.08); color: white; font-family: var(--mono); font-size: 10px; }
.onboarding-card input::placeholder { color: rgba(255,255,255,.5); }
.onboarding-card input:focus { background: white; color: var(--ink); box-shadow: 4px 4px 0 var(--lime); }
.onboarding-card form button, .connect-button { height: 42px; padding: 0 14px; border: 1px solid var(--ink); background: var(--lime); color: var(--ink); cursor: pointer; font-family: var(--mono); font-size: 8px; text-transform: uppercase; white-space: nowrap; }
.onboarding-card form button:disabled, .connect-button:disabled { opacity: .55; cursor: wait; }
.onboarding-card form small { grid-column: 1 / -1; color: rgba(255,255,255,.66); font-family: var(--mono); font-size: 7px; line-height: 1.5; }
.connection-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.connection-card { min-height: 220px; display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--ink); background: var(--surface); }
.connection-card-top { display: flex; justify-content: space-between; align-items: center; }
.connection-status { padding: 5px 7px; border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 7px; text-transform: uppercase; }
.connection-status.connected { border-color: #168143; color: #168143; }
.connection-card h2 { margin: 30px 0 8px; font-size: 22px; letter-spacing: -.04em; }
.connection-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.connection-card code { margin-top: auto; padding-top: 18px; color: var(--blue); font-family: var(--mono); font-size: 9px; }
.connect-button { width: 100%; margin-top: 14px; }
.terminal-guide { margin-top: 18px; border: 1px solid var(--ink); background: var(--ink); color: white; }
.terminal-title { height: 42px; display: flex; align-items: center; gap: 7px; padding: 0 13px; border-bottom: 1px solid #3b3b36; }
.terminal-title > span { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.terminal-title > span:nth-child(2) { background: #f0c33d; }
.terminal-title > span:nth-child(3) { background: #37bd68; }
.terminal-title b { margin-left: 10px; color: #94928b; font-family: var(--mono); font-size: 8px; font-weight: 500; }
.terminal-guide pre { margin: 0; padding: 24px; overflow-x: auto; font-family: var(--mono); font-size: 11px; line-height: 1.9; }
.terminal-guide code span { color: var(--lime); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 340px; padding: 12px 15px; transform: translateY(20px); opacity: 0; pointer-events: none; background: var(--ink); color: white; font-family: var(--mono); font-size: 9px; transition: 180ms ease; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .topbar { grid-template-columns: 190px 1fr auto; }
  .brand { padding: 0 16px; }
  .dashboard-main { padding: 32px 26px 60px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid, .lower-grid { grid-template-columns: 1fr; }
  .efficiency-grid { grid-template-columns: repeat(2, 1fr); }
  .connection-grid { grid-template-columns: repeat(2, 1fr); }
  .onboarding-card { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .topbar { position: sticky; display: grid; grid-template-columns: 1fr auto; height: auto; }
  .brand { border-right: 0; }
  .topbar nav { grid-column: 1 / -1; order: 3; height: 44px; overflow-x: auto; padding: 0; border-top: 1px solid var(--line); }
  .nav-item { flex: 0 0 auto; padding: 0 13px; }
  .topbar-actions { padding-right: 12px; }
  .mode-pill { display: none; }
  .sidebar { display: none; }
  .dashboard-main { padding: 26px 14px 55px; }
  .page-heading { grid-template-columns: 1fr; }
  .page-heading h1 { font-size: clamp(44px, 13vw, 65px); }
  .heading-meta { min-width: 0; }
  .period-row { align-items: flex-start; flex-direction: column; border-bottom: 0; }
  .period-tabs { width: 100%; overflow-x: auto; }
  .period-tabs button { flex: 0 0 auto; }
  .period-row > span { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 15px; }
  .metric-card strong { font-size: 27px; }
  .spend-chart { overflow-x: auto; }
  .chart-column { min-width: 18px; }
  .panel-heading { align-items: flex-start; }
  .legend { display: none !important; }
  .table-scroll { overflow-x: auto; }
  table { min-width: 650px; }
  .subpage-heading h1 { font-size: 48px; }
  .recommendation-route { grid-template-columns: 1fr; }
  .recommendation-arrow { transform: rotate(90deg); }
  .recommendation-saving { text-align: left; }
  .recommendation-status { align-items: flex-start; flex-direction: column; }
  .recommendation-status span { text-align: left; }
  .connection-grid, .efficiency-grid { grid-template-columns: 1fr; }
  .onboarding-card form { grid-template-columns: 1fr; }
  .onboarding-card form small { grid-column: auto; }
  .privacy-contract { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
