:root {
  color-scheme: light;
  font-family: "DM Sans", sans-serif;
  color: #233149;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #233149;
  --muted: #778398;
  --border: #e6eaf0;
  --blue: #3867d8;
  --green: #39a675;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #dfe7f3;
  --muted: #98a5b8;
  --border: #29354a;
  --blue: #78a0ff;
  --green: #67c49c;
  color: #dfe7f3;
  background: #111827;
}

:root[data-theme="dark"] body { background: #111827; }
:root[data-theme="dark"] .page-header,
:root[data-theme="dark"] .rate-section,
:root[data-theme="dark"] .plan-section,
:root[data-theme="dark"] .forecast-section,
:root[data-theme="dark"] .chart-dialog,
:root[data-theme="dark"] .application-row,
:root[data-theme="dark"] .plan-row,
:root[data-theme="dark"] .disclosure-button,
:root[data-theme="dark"] .button-expand,
:root[data-theme="dark"] .dialog-close,
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .button-download,
:root[data-theme="dark"] .button-add,
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select { background-color: #182235; color: #dfe7f3; }
:root[data-theme="dark"] .page-shell { color: #dfe7f3; }
:root[data-theme="dark"] .rate-section,
:root[data-theme="dark"] .plan-section,
:root[data-theme="dark"] .forecast-section,
:root[data-theme="dark"] .application-row,
:root[data-theme="dark"] .plan-row,
:root[data-theme="dark"] .chart-dialog,
:root[data-theme="dark"] .disclosure-button,
:root[data-theme="dark"] .button-expand,
:root[data-theme="dark"] .dialog-close,
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .button-download,
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select { border-color: #303d52; }
:root[data-theme="dark"] .aggregate-row { background: #1d2940; border-color: #344662; }
:root[data-theme="dark"] .tab-row,
:root[data-theme="dark"] .metrics-grid,
:root[data-theme="dark"] .metric-card + .metric-card,
:root[data-theme="dark"] .expanded-chart-scroll { border-color: #303d52; }
:root[data-theme="dark"] .application-total strong,
:root[data-theme="dark"] .metric-value,
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] .aggregate-row strong { color: #edf3fb; }
:root[data-theme="dark"] .completion-line,
:root[data-theme="dark"] .section-description,
:root[data-theme="dark"] .data-note,
:root[data-theme="dark"] .page-footer,
:root[data-theme="dark"] .field,
:root[data-theme="dark"] .metric-label,
:root[data-theme="dark"] .forecast-range { color: #a0aec1; }

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f5f7fb;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.page-shell {
  width: min(1190px, calc(100% - 64px));
  margin: 0 auto;
  padding: 38px 0 42px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 25px;
}

.eyebrow, .section-kicker {
  color: #8792a4;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.eyebrow-mark { width: 7px; height: 7px; border-radius: 2px; background: #557ce5; transform: rotate(45deg); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-family: "Manrope", sans-serif; font-size: clamp(26px, 3vw, 34px); font-weight: 800; letter-spacing: -.045em; }
h1 span { color: #496fcf; }
.completion-line { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.header-controls { display: flex; align-items: center; gap: 10px; }
.theme-toggle { display: inline-flex; height: 39px; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid #dfe5ef; border-radius: 7px; background: #fff; color: #68758a; }
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.theme-sun { opacity: .65; }
.theme-moon { opacity: 1; }
:root[data-theme="light"] .theme-sun { opacity: 1; }
:root[data-theme="light"] .theme-moon { opacity: .65; }
.theme-track { position: relative; width: 30px; height: 17px; border-radius: 99px; background: #7180a0; }
.theme-thumb { position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
:root[data-theme="light"] .theme-track { background: #aebbe0; }
:root[data-theme="light"] .theme-thumb { transform: translateX(-13px); }
.button { display: inline-flex; height: 39px; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid transparent; border-radius: 7px; font-size: 12px; font-weight: 600; transition: background .15s ease, box-shadow .15s ease; white-space: nowrap; }
.button:focus-visible, .tab:focus-visible, .remove-plan:focus-visible { outline: 3px solid rgba(56, 103, 216, .25); outline-offset: 2px; }
.button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.button-download { border-color: #b7c8f2; background: #fff; color: #3867d8; }
.button-download:hover { background: #f1f5ff; }
.button-add { flex: 0 0 auto; border-color: #d6e0fa; background: #f6f8ff; color: #3867d8; }
.button-add:hover { background: #ebf0ff; }
.section-controls { display: flex; align-items: center; gap: 8px; }
.disclosure-button { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 1px solid #e1e6ef; border-radius: 7px; background: #fff; color: #68758a; }
.disclosure-button:hover { background: #f7f9fc; }
.disclosure-button:focus-visible { outline: 3px solid rgba(56, 103, 216, .25); outline-offset: 2px; }
.disclosure-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; transition: transform .15s ease; }
.disclosure-button[aria-expanded="false"] svg { transform: rotate(-90deg); }
.button-expand { height: 32px; padding: 0 10px; border-color: #dfe5ef; background: #fff; color: #52617a; font-size: 10px; }
.button-expand:hover { background: #f7f9fc; }
.button-expand svg { width: 14px; height: 14px; }
.application-list { display: grid; gap: 10px; margin-top: 15px; }
.application-row { min-width: 0; margin: 0; padding: 11px 13px 10px; border: 1px solid #e8ecf2; border-radius: 8px; }
.application-row-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.application-name { width: min(320px, 60%); }
.application-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.usage-pattern-field { width: min(390px, 100%); margin-top: 10px; }
.application-total { display: flex; justify-content: flex-end; gap: 8px; margin: 9px 0 0; color: #79869a; font-size: 10px; }
.application-total strong { color: #27374f; font-size: 11px; font-variant-numeric: tabular-nums; }
.aggregate-row { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; padding: 10px 12px; border: 1px solid #dfe8fb; border-radius: 7px; background: #f7f9ff; color: #4a5e82; font-size: 11px; }
.aggregate-row strong { color: #365fc3; font-size: 13px; font-variant-numeric: tabular-nums; }

.rate-section, .plan-section, .forecast-section {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
}

.rate-section { padding: 19px 22px 14px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-kicker { margin-bottom: 5px; font-size: 9px; }
.section-heading h2, .forecast-header h2 { margin-bottom: 0; font-family: "Manrope", sans-serif; font-size: 16px; font-weight: 700; letter-spacing: -.025em; }
.section-unit { padding-bottom: 2px; color: #9aa3b0; font-size: 10px; }
.rate-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 15px; border: 1px solid #edf0f5; border-radius: 8px; background: #fcfdff; }
.rate-card { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 12px 14px; }
.rate-card + .rate-card { border-left: 1px solid #edf0f5; }
.service-mark { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 8px; font-size: 12px; font-weight: 700; }
.ec2 { background: #fff3e7; color: #df893c; }
.fargate { background: #eef2ff; color: #5a76d3; }
.lambda { background: #fff4e7; color: #d89239; }
.sagemaker { background: #edf8f3; color: #42a27c; }
.rate-copy { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.service-name { overflow: hidden; color: #758196; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.rate-copy strong { color: #26354d; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.data-note { margin: 10px 0 0; color: #9aa3b0; font-size: 10px; }

.plan-section { margin-top: 16px; padding: 20px 22px 14px; }
.plan-section-heading { align-items: center; margin-bottom: 14px; }
.section-description { margin: 5px 0 0; color: #8994a5; font-size: 11px; }
.existing-commitment { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #e4f2eb; border-radius: 7px; background: #f7fcf9; color: #607c70; font-size: 11px; }
.existing-marker { width: 8px; height: 8px; border-radius: 2px; background: #39a675; }
.existing-commitment strong { margin-left: auto; color: #328d66; font-size: 12px; font-variant-numeric: tabular-nums; }
.plan-list { display: grid; gap: 10px; margin-top: 10px; }
.plan-row { min-width: 0; margin: 0; padding: 12px 13px 13px; border: 1px solid #e8ecf2; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.plan-row-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.plan-row-heading h3 { margin: 0; color: #4a5870; font-size: 11px; font-weight: 700; }
.remove-plan { display: inline-flex; align-items: center; gap: 5px; padding: 3px 4px; border: 0; background: transparent; color: #8993a2; font-size: 10px; }
.remove-plan:hover { color: #c75163; }
.remove-plan svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.plan-fields { display: grid; grid-template-columns: 1.55fr 1.1fr .8fr 1fr 1fr; gap: 12px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: #7d889a; font-size: 10px; font-weight: 500; }
.field input, .field select { width: 100%; height: 34px; min-width: 0; padding: 0 9px; border: 1px solid #dfe4ec; border-radius: 5px; outline: none; background: #fff; color: #293851; font-size: 11px; font-variant-numeric: tabular-nums; }
.field input:focus, .field select:focus { border-color: #7c9ae8; box-shadow: 0 0 0 3px rgba(56, 103, 216, .1); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: #d86c7b; background: #fffafb; }
.plan-error { margin: 9px 0 0; color: #bd4d5e; font-size: 10px; }
.scenario-status { min-height: 14px; margin: 10px 0 0; color: #8c97a8; font-size: 10px; }

.forecast-section { overflow: hidden; margin-top: 16px; padding: 18px 22px 0; }
.forecast-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; }
.forecast-actions { display: flex; align-items: center; gap: 14px; }
.split-toggle { display: inline-flex; align-items: center; gap: 7px; color: #718096; font-size: 10px; cursor: pointer; white-space: nowrap; }
.split-toggle input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.split-track { position: relative; width: 32px; height: 18px; border-radius: 99px; background: #ccd5e4; transition: background .15s ease; }
.split-track span { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(26, 38, 62, .18); transition: transform .15s ease; }
.split-toggle input:checked + .split-track { background: #557ce5; }
.split-toggle input:checked + .split-track span { transform: translateX(14px); }
.split-toggle input:focus-visible + .split-track { outline: 3px solid rgba(85, 124, 229, .28); outline-offset: 2px; }
.forecast-range { display: flex; align-items: center; gap: 7px; color: #7f8a9b; font-size: 10px; }
.range-dot { width: 6px; height: 6px; border-radius: 50%; background: #718de1; }
.tab-row { display: flex; gap: 26px; min-height: 43px; border-bottom: 1px solid #edf0f4; }
.tab { position: relative; padding: 0 2px; border: 0; background: transparent; color: #8792a4; font-size: 12px; font-weight: 600; }
.tab::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; content: ""; }
.tab:hover { color: #506078; }
.tab.is-active { color: #3867d8; }
.tab.is-active::after { background: #3867d8; }
.chart-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; padding: 16px 0 2px; }
.chart-heading h3 { margin-bottom: 4px; font-family: "Manrope", sans-serif; font-size: 13px; font-weight: 700; }
.chart-heading p { margin-bottom: 0; color: #8b96a7; font-size: 10px; }
.chart-unit { padding-bottom: 1px; color: #929cad; font-size: 10px; }
.chart-wrap { position: relative; height: 306px; margin: 4px 0 0; }
.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 8px -22px 0; border-top: 1px solid #e8ecf2; }
.metric-card { display: flex; min-width: 0; flex-direction: column; padding: 14px 22px 17px; }
.metric-card + .metric-card { border-left: 1px solid #e8ecf2; }
.metric-label { width: fit-content; margin-bottom: 8px; padding-bottom: 2px; border-bottom: 1px solid #cbd4e2; color: #788498; font-size: 10px; }
.metric-value { color: #26354d; font-family: "Manrope", sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-value span { margin-left: 4px; color: #7b879a; font-family: "DM Sans", sans-serif; font-size: 11px; font-weight: 500; letter-spacing: 0; }
.page-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; color: #9aa3b0; font-size: 9px; }

.chart-dialog {
  width: min(1220px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow: hidden;
  border: 1px solid #dfe5ef;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 20px 70px rgba(22, 38, 64, .22);
}
.chart-dialog::backdrop { background: rgba(25, 37, 57, .38); backdrop-filter: blur(2px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-header h2 { margin: 0; font-family: "Manrope", sans-serif; font-size: 17px; }
.dialog-description { margin: 5px 0 14px; color: #8792a4; font-size: 11px; }
.dialog-close { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 1px solid #e4e8ef; border-radius: 7px; background: #fff; color: #627087; }
.dialog-close:hover { background: #f5f7fb; }
.dialog-close:focus-visible { outline: 3px solid rgba(56, 103, 216, .25); outline-offset: 2px; }
.dialog-close svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.7; }
.expanded-chart-scroll { max-width: 100%; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; border: 1px solid #edf0f5; border-radius: 8px; }
.expanded-chart-scroll:focus-visible { outline: 3px solid rgba(56, 103, 216, .22); outline-offset: 2px; }
.expanded-chart-inner { position: relative; height: min(54vh, 470px); min-width: 100%; }
.expanded-chart-inner canvas { display: block; }

@media (max-width: 850px) {
  .page-shell { width: min(100% - 36px, 720px); padding-top: 28px; }
  .application-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-name { grid-column: span 2; }
}

@media (max-width: 520px) {
  .page-shell { width: calc(100% - 24px); padding-top: 21px; }
  .page-header { align-items: flex-start; }
  .button-download { height: 36px; padding: 0 9px; font-size: 10px; }
  .button-download svg { width: 14px; }
  h1 { font-size: 25px; }
  .rate-section, .plan-section { padding-right: 14px; padding-left: 14px; }
  .application-row { padding-right: 9px; padding-left: 9px; }
  .application-fields { gap: 9px; }
  .application-fields .field { font-size: 9px; }
  .application-fields input { padding: 0 6px; font-size: 10px; }
  .application-name { width: min(250px, 70%); }
  .aggregate-row { font-size: 10px; }
  .plan-section-heading { align-items: flex-start; }
  .plan-section-heading .button { padding: 0 8px; font-size: 10px; }
  .section-controls { flex-wrap: wrap; justify-content: flex-end; }
  .section-description { max-width: 27ch; line-height: 1.45; }
  .existing-commitment { align-items: flex-start; flex-wrap: wrap; line-height: 1.35; }
  .existing-commitment strong { margin-left: 16px; }
  .plan-fields { grid-template-columns: 1fr 1fr; gap: 9px; }
  .field-name { grid-column: 1 / -1; }
  .forecast-section { padding: 15px 14px 0; }
  .forecast-actions { flex-direction: column; align-items: flex-end; gap: 7px; }
  .button-expand { height: 29px; }
  .chart-wrap { height: 255px; margin-right: -6px; margin-left: -6px; }
  .chart-heading p { max-width: 32ch; line-height: 1.4; }
  .metrics-grid { margin-right: -14px; margin-left: -14px; }
  .metric-card { padding: 12px 9px 14px; }
  .metric-label { min-height: 25px; font-size: 9px; }
  .metric-value { font-size: 17px; }
  .metric-value span { font-size: 9px; }
  .page-footer { flex-direction: column; gap: 5px; }
  .chart-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); padding: 13px; }
  .expanded-chart-inner { height: 52vh; }
}
