:root {
  color-scheme: light;
  --ink: #0c2032;
  --muted: #637484;
  --line: #dbe4e8;
  --panel: #ffffff;
  --canvas: #f3f7f7;
  --navy: #071a2b;
  --teal: #16a695;
  --mint: #6fe3d2;
  --blue: #3975e8;
  --coral: #e86f51;
  --gold: #e6b957;
  --purple: #7668d9;
  --shadow: 0 18px 50px rgba(17, 41, 57, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.5; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(57,117,232,.28); outline-offset: 2px; }
.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; }

.page-shell { min-height: 100vh; }
.topbar { height: 76px; padding: 0 clamp(20px, 4vw, 64px); background: var(--navy); color: white; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; position: sticky; top: 0; z-index: 30; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: 12px; width: max-content; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--mint); color: var(--navy); border-radius: 10px; font-weight: 850; letter-spacing: -.04em; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: .94rem; }
.brand-copy small { font-size: .72rem; color: #9db0bd; margin-top: 4px; }
.view-switch { display: flex; padding: 5px; border-radius: 11px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); }
.view-tab { color: #aebec8; background: transparent; border: 0; border-radius: 7px; padding: 8px 16px; font-weight: 700; font-size: .84rem; }
.view-tab.active { color: var(--navy); background: white; box-shadow: 0 4px 14px rgba(0,0,0,.17); }
.header-meta { justify-self: end; display: flex; align-items: center; gap: 15px; font-size: .76rem; color: #aebec8; }
.data-badge { display: flex; align-items: center; gap: 7px; }
.data-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(111,227,210,.12); }

main { max-width: 1580px; margin: 0 auto; padding: 38px clamp(20px, 4vw, 64px) 28px; }
.workspace { animation: viewIn .25s ease-out; }
.workspace[hidden] { display: none; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.workspace-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 26px; }
.eyebrow, .panel-kicker { margin: 0 0 7px; text-transform: uppercase; letter-spacing: .12em; color: var(--teal); font-size: .72rem; font-weight: 850; }
h1 { margin: 0; font-size: clamp(2rem, 3.4vw, 3.2rem); letter-spacing: -.055em; line-height: 1.02; max-width: 740px; }
.intro { color: var(--muted); margin: 12px 0 0; max-width: 700px; font-size: 1rem; }
.head-actions { display: flex; gap: 10px; align-items: flex-end; }
.select-wrap { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-weight: 700; font-size: .72rem; }
.select-wrap select { min-width: 126px; padding: 10px 34px 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font-weight: 750; }
.icon-button { width: 42px; height: 42px; border-radius: 10px; background: white; border: 1px solid var(--line); color: var(--muted); display: grid; place-items: center; }
.icon-button:hover { border-color: #9eb1bd; color: var(--ink); }
.icon-button svg, .search-box svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.filter-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 15px 17px; border: 1px solid var(--line); background: rgba(255,255,255,.68); border-radius: 14px; margin-bottom: 18px; }
.filter-group { display: flex; flex-direction: column; gap: 8px; }
.filter-group > span { color: var(--muted); font-size: .72rem; font-weight: 750; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--line); background: white; color: #526575; border-radius: 999px; padding: 6px 12px; font-size: .78rem; font-weight: 750; }
.chip:hover { border-color: #a9bac3; }
.chip.active { color: white; background: var(--navy); border-color: var(--navy); }
.search-box { width: min(280px, 100%); height: 40px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 0 11px; color: #8a9aa5; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); font-size: .84rem; background: transparent; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi-card { min-height: 178px; position: relative; overflow: hidden; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 30px rgba(16,39,52,.035); }
.kpi-card.primary { color: white; background: var(--navy); border-color: var(--navy); }
.kpi-card.primary:after { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; right: -72px; top: -76px; background: rgba(111,227,210,.08); border: 24px solid rgba(111,227,210,.04); }
.kpi-label { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .8rem; font-weight: 750; }
.primary .kpi-label { color: #afc0ca; }
.mini-icon { position: relative; z-index: 1; width: 27px; height: 27px; border-radius: 8px; background: rgba(255,255,255,.08); display: grid; place-items: center; color: var(--mint); font-size: .78rem; }
.mini-icon.teal { color: var(--teal); background: rgba(22,166,149,.1); }
.mini-icon.blue { color: var(--blue); background: rgba(57,117,232,.1); }
.mini-icon.coral { color: var(--coral); background: rgba(232,111,81,.1); }
.kpi-card > strong { display: block; margin: 16px 0 9px; font-size: clamp(1.85rem, 3vw, 2.5rem); letter-spacing: -.045em; line-height: 1; }
.kpi-detail { display: flex; gap: 7px; color: var(--muted); font-size: .74rem; }
.primary .kpi-detail { color: #9eb0bc; }
.positive { color: #38c5a8; font-weight: 800; }
.risk-text { color: var(--coral); font-weight: 800; }
.spread { justify-content: space-between; }
.progress-track { height: 5px; margin: 14px 0 9px; background: #ecf1f2; border-radius: 9px; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--teal); border-radius: inherit; transition: width .35s ease; }
.spark-bars { height: 42px; display: flex; align-items: end; gap: 5px; margin-top: 15px; }
.spark-bars i { flex: 1; max-width: 17px; background: rgba(111,227,210,.25); border-radius: 3px 3px 0 0; }
.spark-bars i:nth-last-child(-n+2) { background: var(--mint); }
.award-dots { display: grid; grid-template-columns: repeat(6, 9px); gap: 6px; margin-top: 18px; }
.award-dots i { height: 9px; border-radius: 50%; background: var(--blue); opacity: .28; }
.award-dots i:nth-child(-n+8) { opacity: 1; }
.text-button { padding: 0; border: 0; background: none; color: var(--ink); font-weight: 800; font-size: .76rem; }
.text-button:hover { color: var(--teal); }
.risk-card .text-button { position: absolute; bottom: 19px; left: 20px; }

.analytics-grid { display: grid; grid-template-columns: 1.5fr .82fr; gap: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 30px rgba(16,39,52,.035); }
.spend-panel, .agency-panel, .runway-panel, .risk-map-panel { min-height: 390px; padding: 22px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-head h2 { margin: 0; font-size: 1.02rem; letter-spacing: -.02em; }
.legend { display: flex; gap: 13px; color: var(--muted); font-size: .72rem; }
.legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.legend .actual, .legend .revenue { background: var(--teal); }
.legend .plan { border: 2px dashed #8da0ac; }
.legend .expense { background: var(--coral); }
.chart-callout { display: grid; grid-template-columns: auto auto; gap: 0 12px; width: max-content; margin-top: 21px; }
.chart-callout span { grid-column: 1 / -1; color: var(--muted); font-size: .68rem; }
.chart-callout strong { font-size: 1.28rem; letter-spacing: -.03em; }
.chart-callout small { color: var(--teal); align-self: end; margin-bottom: 2px; font-weight: 750; }
.svg-chart { height: 246px; margin-top: -12px; }
.svg-chart svg { width: 100%; height: 100%; overflow: visible; }
.chart-grid { stroke: #e8eef0; stroke-width: 1; }
.chart-axis { fill: #7c8c98; font-size: 10px; }
.actual-area { fill: url(#actualGradient); }
.actual-line { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.plan-line { fill: none; stroke: #8da0ac; stroke-width: 2; stroke-dasharray: 5 6; stroke-linecap: round; }
.chart-point { fill: white; stroke: var(--teal); stroke-width: 2.5; }
.more-button { border: 0; background: transparent; color: #82929d; letter-spacing: .08em; }
.donut-wrap { display: grid; grid-template-columns: 160px 1fr; gap: 23px; align-items: center; margin-top: 36px; }
.donut { width: 154px; aspect-ratio: 1; border-radius: 50%; position: relative; background: conic-gradient(var(--blue) 0 34%, var(--teal) 34% 60%, var(--gold) 60% 78%, var(--purple) 78% 91%, var(--coral) 91% 100%); }
.donut:before { content: ""; position: absolute; inset: 20px; border-radius: 50%; background: white; }
.donut > div { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; }
.donut strong { font-size: 1.32rem; letter-spacing: -.04em; }
.donut span { color: var(--muted); font-size: .68rem; }
.agency-list { display: flex; flex-direction: column; gap: 12px; }
.agency-item { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; font-size: .74rem; }
.agency-item i { width: 8px; height: 8px; border-radius: 2px; }
.agency-item span { color: var(--muted); }
.agency-item strong { font-size: .76rem; }
.pill { border-radius: 999px; background: #e9f7f4; color: #168678; padding: 4px 9px; font-weight: 750; font-size: .67rem; }
.pill.muted { color: #70818d; background: #eef2f3; }
.runway-list { display: flex; flex-direction: column; gap: 19px; margin-top: 28px; }
.runway-row { display: grid; grid-template-columns: 106px 1fr 46px; align-items: center; gap: 12px; }
.runway-label { font-size: .73rem; }
.runway-label strong { display: block; font-size: .77rem; }
.runway-label span { color: var(--muted); font-size: .66rem; }
.runway-track { height: 9px; background: #ecf1f2; border-radius: 10px; overflow: hidden; }
.runway-track i { display: block; height: 100%; border-radius: inherit; }
.runway-row > strong { font-size: .72rem; text-align: right; }
.risk-map { position: relative; height: 275px; margin: 29px 9px 0 35px; border-left: 1px solid #dbe4e8; border-bottom: 1px solid #dbe4e8; background: linear-gradient(to right, transparent 49.8%, #e7edef 50%, transparent 50.2%), linear-gradient(to bottom, transparent 49.8%, #e7edef 50%, transparent 50.2%); }
.risk-map:before { content: "Budget utilized →"; position: absolute; right: 0; bottom: -26px; color: var(--muted); font-size: .66rem; }
.risk-map:after { content: "Time elapsed →"; position: absolute; transform: rotate(-90deg); transform-origin: left; left: -30px; top: 115px; color: var(--muted); font-size: .66rem; }
.quadrant-label { position: absolute; color: #9aa8b0; font-size: .61rem; text-transform: uppercase; letter-spacing: .05em; }
.risk-bubble { position: absolute; border-radius: 50%; transform: translate(-50%, 50%); display: grid; place-items: center; color: white; font-size: .58rem; font-weight: 850; box-shadow: 0 6px 16px rgba(12,32,50,.12); cursor: default; transition: transform .18s ease; }
.risk-bubble:hover { transform: translate(-50%, 50%) scale(1.12); z-index: 2; }

.table-panel { margin-top: 14px; padding: 22px; }
.table-head { align-items: center; }
.table-summary { text-align: right; }
.table-summary strong { display: block; font-size: 1.2rem; line-height: 1; }
.table-summary span { color: var(--muted); font-size: .66rem; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin-top: 19px; min-width: 720px; }
th { padding: 11px 12px; text-align: left; color: #7a8a95; background: #f4f7f8; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; }
td { padding: 14px 12px; border-bottom: 1px solid #edf1f2; font-size: .76rem; }
tbody tr:hover { background: #f8fbfb; }
.award-name strong { display: block; font-size: .78rem; }
.award-name span { color: var(--muted); font-size: .68rem; }
.table-agency { font-weight: 850; }
.spent-cell { min-width: 128px; }
.spent-cell div { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.spent-cell div span { color: var(--muted); font-size: .68rem; }
.tiny-progress { height: 4px; background: #ebf0f2; border-radius: 5px; overflow: hidden; }
.tiny-progress i { display: block; height: 100%; border-radius: inherit; }
.health { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 8px; font-size: .66rem; font-weight: 800; }
.health:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.health.healthy { color: #168678; background: #e8f7f3; }
.health.watch { color: #a36f13; background: #fff4da; }
.health.risk { color: #c45439; background: #feeee9; }
.empty-row td { padding: 36px; text-align: center; color: var(--muted); }

.scenario-switch { display: flex; padding: 5px; background: white; border: 1px solid var(--line); border-radius: 11px; }
.scenario-switch button { border: 0; background: transparent; color: var(--muted); padding: 8px 13px; border-radius: 7px; font-size: .76rem; font-weight: 800; }
.scenario-switch button.active { background: var(--navy); color: white; }
.model-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); align-items: start; gap: 14px; }
.assumptions-panel { padding: 22px; position: sticky; top: 96px; }
.assumptions-title { display: flex; justify-content: space-between; align-items: flex-start; }
.assumptions-title h2 { margin: 0; font-size: 1.04rem; }
.driver { margin-top: 28px; }
.driver-head { display: flex; justify-content: space-between; gap: 10px; font-size: .75rem; }
.driver-head label { font-weight: 750; }
.driver-head output { color: var(--teal); font-weight: 850; }
input[type="range"] { width: 100%; height: 5px; margin-top: 13px; border-radius: 10px; accent-color: var(--teal); }
.range-labels { display: flex; justify-content: space-between; color: #9aa7af; font-size: .61rem; }
.assumption-note { display: flex; gap: 9px; margin-top: 30px; background: #f2f7f7; border-radius: 10px; padding: 12px; color: var(--muted); font-size: .68rem; }
.assumption-note span { flex: 0 0 20px; height: 20px; border-radius: 50%; background: #dce9e8; display: grid; place-items: center; color: var(--teal); font-weight: 850; }
.assumption-note p { margin: 0; }
.model-results { min-width: 0; }
.forecast-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.forecast-kpi { padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.forecast-kpi span { color: var(--muted); font-size: .72rem; font-weight: 750; }
.forecast-kpi strong { display: block; margin: 10px 0 6px; font-size: 1.7rem; letter-spacing: -.04em; }
.forecast-kpi small { color: var(--teal); font-size: .68rem; }
.forecast-kpi.dark { color: white; background: var(--navy); border-color: var(--navy); }
.forecast-kpi.dark span { color: #a9bbc6; }
.forecast-kpi.dark small { color: var(--mint); }
.forecast-chart-panel { padding: 22px; min-height: 380px; }
.forecast-chart { height: 295px; margin-top: 12px; }
.bar-revenue { fill: var(--teal); }
.bar-expense { fill: var(--coral); opacity: .84; }
.margin-line { fill: none; stroke: var(--navy); stroke-width: 2.5; }
.margin-point { fill: white; stroke: var(--navy); stroke-width: 2; }
.forecast-lower-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; margin-top: 14px; }
.bridge-panel, .sensitivity-panel, .model-table-panel { padding: 22px; }
.bridge-chart { height: 210px; margin-top: 18px; display: flex; align-items: end; gap: 8px; padding-bottom: 27px; border-bottom: 1px solid var(--line); }
.bridge-step { flex: 1; position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bridge-step i { width: 65%; min-width: 27px; border-radius: 5px 5px 2px 2px; background: var(--teal); }
.bridge-step.negative i { background: var(--coral); }
.bridge-step.total i { background: var(--navy); }
.bridge-step strong { position: absolute; font-size: .67rem; transform: translateY(-5px); }
.bridge-step span { position: absolute; top: calc(100% + 8px); text-align: center; color: var(--muted); font-size: .6rem; line-height: 1.15; }
.sensitivity-copy { color: var(--muted); font-size: .72rem; margin: 16px 0; }
.heatmap { display: grid; grid-template-columns: 52px repeat(3, 1fr); gap: 5px; }
.heat-cell { min-height: 41px; border-radius: 7px; display: grid; place-items: center; padding: 4px; text-align: center; font-size: .67rem; font-weight: 800; }
.heat-label { color: var(--muted); font-weight: 700; background: transparent; }
.heat-good { background: #dff5ee; color: #177864; }
.heat-mid { background: #fff0c7; color: #8d6617; }
.heat-low { background: #fee4dd; color: #ad4d36; }
.model-table-panel { margin-top: 14px; }
.model-table td:first-child, .model-table th:first-child { position: sticky; left: 0; background: inherit; font-weight: 800; }
.model-table tr.highlight td { background: #eff8f6; font-weight: 850; }
.model-table tr.highlight td:first-child { background: #eff8f6; }

footer { max-width: 1580px; margin: 0 auto; padding: 14px clamp(20px, 4vw, 64px) 36px; color: #83939d; display: flex; justify-content: space-between; font-size: .7rem; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 10px 15px; color: white; background: var(--navy); border-radius: 9px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s ease; font-size: .78rem; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr auto; }
  .header-meta { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-grid { grid-template-columns: 1fr; }
  .model-layout { grid-template-columns: 1fr; }
  .assumptions-panel { position: static; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 28px; }
  .assumptions-title, .assumption-note { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .topbar { height: auto; min-height: 72px; padding: 12px 18px; gap: 10px; }
  .brand-copy { display: none; }
  .view-switch { justify-self: end; }
  .view-tab { padding: 8px 10px; font-size: .72rem; }
  main { padding-top: 26px; }
  .workspace-head { align-items: flex-start; flex-direction: column; }
  .head-actions, .scenario-switch { width: 100%; }
  .select-wrap { flex: 1; }
  .select-wrap select { width: 100%; }
  .scenario-switch button { flex: 1; }
  .filter-row { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .kpi-grid, .forecast-kpis, .forecast-lower-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 165px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .legend { align-self: flex-start; }
  .spend-panel, .agency-panel, .runway-panel, .risk-map-panel { min-height: 0; }
  .donut-wrap { grid-template-columns: 130px 1fr; gap: 15px; }
  .donut { width: 130px; }
  .assumptions-panel { display: block; }
  footer { flex-direction: column; gap: 4px; }
}

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