:root {
  color-scheme: light;
  --bg: #f2f5ef;
  --surface: #ffffff;
  --surface-muted: #edf3e8;
  --ink: #172019;
  --ink-muted: #5c685e;
  --line: #cbd5c8;
  --line-strong: #8d9b8d;
  --green: #63a92f;
  --green-deep: #274916;
  --green-soft: #dcebcf;
  --amber: #d88b18;
  --amber-soft: #fff0d6;
  --red: #ba3131;
  --blue: #2f8fa8;
  --focus: #0f6ad8;
  --shadow: 0 8px 24px rgb(27 50 22 / 10%);
  --radius-section: 16px;
  --radius-control: 8px;
  --page-max: 1480px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111612;
  --surface: #182019;
  --surface-muted: #202c21;
  --ink: #eef5ec;
  --ink-muted: #aebaad;
  --line: #3b493c;
  --line-strong: #6c7d6e;
  --green: #86c94d;
  --green-deep: #b9e197;
  --green-soft: #263b25;
  --amber: #f1ae4c;
  --amber-soft: #3d3020;
  --red: #ff7777;
  --blue: #6bc3d8;
  --focus: #78b7ff;
  --shadow: 0 12px 32px rgb(0 0 0 / 28%);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  transition: background-color 160ms ease, color 160ms ease;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  min-height: 44px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  transform: translateY(-140%);
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--surface);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 10px max(24px, calc((100vw - var(--page-max)) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  transform: skew(-8deg);
  border-radius: 7px 2px 7px 2px;
  background: var(--green);
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--line-strong);
}

.partner-name {
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
}

.icon-button,
.primary-button,
.secondary-button {
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-weight: 700;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.icon-button {
  padding: 8px 12px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.primary-button {
  padding: 10px 16px;
  background: var(--green-deep);
  color: var(--surface);
}

:root[data-theme="dark"] .primary-button {
  color: #10200d;
}

.secondary-button {
  padding: 10px 16px;
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.icon-button:hover,
.secondary-button:hover {
  border-color: var(--green);
  background: var(--surface-muted);
}

.primary-button:hover {
  background: var(--green);
}

.icon-button:active,
.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

main {
  width: min(var(--page-max), calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.page-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  padding-bottom: 28px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 840px;
  margin-bottom: 10px;
  font-size: clamp(32px, 4vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro-copy,
.section-context,
.sync-label,
.chart-heading span,
small {
  color: var(--ink-muted);
}

.intro-copy {
  max-width: 760px;
  margin-bottom: 0;
  font-size: 18px;
}

.sync-block {
  flex: 0 0 auto;
  min-width: 220px;
  text-align: right;
}

.sync-block span,
.sync-block strong {
  display: block;
}

.sync-block strong {
  margin-top: 4px;
  font-size: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(220px, 1.35fr) minmax(140px, 0.7fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-section);
  background: var(--surface);
}

.filter-bar label {
  display: grid;
  gap: 6px;
}

.filter-bar label span {
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
}

.status-message,
.error-state {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-section);
  background: var(--surface);
}

.status-message {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
}

.error-state h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.error-state p:last-child {
  margin-bottom: 0;
}

.section-block {
  margin-top: 32px;
  padding: clamp(22px, 3vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius-section);
  background: var(--surface);
}

.section-heading {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
}

.section-heading::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green) 0 22%, var(--line) 22% 100%);
  content: "";
}

.section-context {
  max-width: 360px;
  margin-bottom: 4px;
  text-align: right;
}

.combined-total {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1px;
  margin: 28px 0;
  overflow: hidden;
  border: 1px solid var(--green-deep);
  border-radius: 12px;
  background: var(--green-deep);
}

.combined-total > div {
  display: grid;
  grid-template-columns: auto minmax(100px, 0.6fr);
  align-items: center;
  gap: 8px 24px;
  padding: 22px 24px;
  background: var(--surface-muted);
}

.combined-total span {
  font-weight: 800;
}

.combined-total strong,
.fleet-primary strong,
.metric-strip dd,
.exclude-total strong {
  font-variant-numeric: tabular-nums;
}

.combined-total strong {
  grid-row: span 2;
  justify-self: end;
  color: var(--green-deep);
  font-size: clamp(40px, 5vw, 68px);
  line-height: 1;
}

.combined-total small {
  font-size: 13px;
}

.fleet-lanes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.fleet-lane {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.fleet-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.fleet-kicker {
  margin-bottom: 6px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fleet-title-row h3 {
  font-size: 34px;
}

.fleet-primary {
  text-align: right;
}

.fleet-primary strong,
.fleet-primary span {
  display: block;
}

.fleet-primary strong {
  color: var(--green-deep);
  font-size: 44px;
  line-height: 0.95;
}

.fleet-primary span {
  margin-top: 6px;
  color: var(--ink-muted);
  font-size: 13px;
  text-transform: uppercase;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 18px 0 0;
}

.metric-strip div {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-strip div:nth-child(3n) {
  border-right: 0;
}

.metric-strip div:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.metric-strip dt {
  color: var(--ink-muted);
  font-size: 12px;
}

.metric-strip dd {
  margin: 4px 0 0;
  font-size: 23px;
  font-weight: 800;
}

.table-wrap {
  margin-top: 28px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

caption {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  background: var(--green-deep);
  color: var(--surface);
  font-size: 13px;
}

:root[data-theme="dark"] th {
  color: #f6fff1;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--surface-muted);
}

.progress-comparison {
  display: grid;
  gap: 20px;
  margin: 30px 0;
}

.progress-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(150px, auto);
  gap: 18px;
  align-items: center;
}

.progress-row > strong {
  font-size: 20px;
}

.progress-track {
  position: relative;
  height: 36px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
}

.progress-fill {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 2px;
  height: 100%;
  padding-right: 10px;
  background: var(--green);
  color: #0e210a;
  font-weight: 800;
  transition: width 180ms ease;
}

.progress-detail {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.chart-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.chart-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.chart-heading h3 {
  font-size: 17px;
}

.chart-heading span {
  font-size: 12px;
  text-align: right;
}

.chart-host {
  min-height: 280px;
  overflow: hidden;
}

.compact-chart {
  min-height: 220px;
}

.chart-empty {
  display: grid;
  min-height: inherit;
  place-items: center;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--ink-muted);
  text-align: center;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: inherit;
  overflow: visible;
}

.chart-svg text {
  fill: var(--ink-muted);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 11px;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-target {
  stroke: var(--red);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
}

.series-evc {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
}

.series-bss {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
}

.series-site {
  fill: none;
  stroke-dasharray: 6 4;
}

.chart-dot-evc {
  fill: var(--green);
}

.chart-dot-bss {
  fill: var(--blue);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  color: var(--ink-muted);
  font-size: 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  width: 18px;
  height: 3px;
  background: var(--green);
}

.legend-swatch.bss {
  background: var(--blue);
}

.two-chart-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.ticket-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.6fr);
  gap: 28px;
  margin-top: 28px;
}

.ticket-copy {
  padding-top: 8px;
  color: var(--ink-muted);
}

.definition-note {
  margin-top: 22px;
  padding: 16px;
  border-left: 4px solid var(--green);
  background: var(--surface-muted);
  color: var(--ink);
}

.exclude-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.exclude-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--amber);
  border-radius: 10px;
  background: var(--amber-soft);
}

.exclude-total strong {
  color: var(--ink);
  font-size: 36px;
}

.exclude-total span,
.exclude-total small {
  display: block;
}

.coverage-panel {
  display: grid;
  grid-template-columns: 0.7fr 1.2fr 1.4fr;
  gap: 28px;
  margin-top: 32px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-section);
  background: var(--surface-muted);
}

.coverage-panel dl,
.coverage-panel ul {
  margin: 0;
}

.coverage-panel dl div {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.coverage-panel dl div:last-child {
  border-bottom: 0;
}

.coverage-panel dt {
  color: var(--ink-muted);
}

.coverage-panel dd {
  margin: 0;
  font-weight: 700;
}

.coverage-panel ul {
  padding-left: 20px;
  color: var(--ink-muted);
}

.coverage-panel li + li {
  margin-top: 8px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(var(--page-max), calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 13px;
}

footer p {
  margin: 0;
}

@media (max-width: 1050px) {
  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .period-field {
    grid-column: span 2;
  }

  .two-chart-layout,
  .ticket-layout,
  .coverage-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .topbar {
    padding-inline: 18px;
  }

  .partner-name,
  .brand-divider {
    display: none;
  }

  main,
  footer {
    width: min(100% - 28px, var(--page-max));
  }

  main {
    padding-top: 28px;
  }

  .page-intro,
  .section-heading,
  .error-state,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .sync-block,
  .section-context {
    min-width: 0;
    text-align: left;
  }

  .filter-bar,
  .fleet-lanes,
  .exclude-summary {
    grid-template-columns: 1fr;
  }

  .period-field {
    grid-column: auto;
  }

  .combined-total {
    grid-template-columns: 1fr;
  }

  .combined-total > div {
    grid-template-columns: 1fr auto;
  }

  .metric-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-strip div:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .metric-strip div:nth-child(2n) {
    border-right: 0;
  }

  .metric-strip div:nth-last-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .metric-strip div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .progress-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .progress-detail {
    grid-column: 2;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 14px;
  }

  .icon-button {
    padding-inline: 10px;
  }

  h1 {
    font-size: 34px;
  }

  .section-block {
    padding: 18px;
  }

  .fleet-lane {
    padding: 18px;
  }

  .fleet-primary strong {
    font-size: 36px;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .metric-strip div,
  .metric-strip div:nth-child(2n),
  .metric-strip div:nth-child(3n),
  .metric-strip div:nth-last-child(-n + 2),
  .metric-strip div:nth-last-child(-n + 3) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-strip div:last-child {
    border-bottom: 0;
  }

  .progress-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .progress-detail {
    grid-column: auto;
  }
}

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