:root {
  color-scheme: light;
  --ink: #102a43;
  --muted: #526678;
  --paper: #f7f4ed;
  --surface: #ffffff;
  --soft: #eaf0f3;
  --line: #c8d2da;
  --teal: #087f72;
  --teal-dark: #075e56;
  --mint: #b8efe4;
  --amber: #a85200;
  --amber-soft: #ffe3bd;
  --red: #9f2f2f;
  --blue: #265f9e;
  --focus: #a85200;
  --shadow: 0 18px 46px rgba(16, 42, 67, 0.10);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(85, 214, 190, 0.22), transparent 32rem),
    linear-gradient(180deg, #fbfaf6 0, var(--paper) 34rem);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(16, 42, 67, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(16, 42, 67, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 42rem);
}

a { color: inherit; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

button, input, select { font: inherit; }

button, a, input, select, [tabindex="0"] { scroll-margin: 6rem; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 50;
  left: 1rem;
  top: 1rem;
  transform: translateY(-180%);
  padding: .75rem 1rem;
  border-radius: .5rem;
  background: var(--ink);
  color: white;
}

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

.site-header,
.demo-navigation,
.dashboard-shell,
.feedback-guide,
.site-footer,
.noscript-panel {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
  position: relative;
}

.site-header { padding: 2rem 0 1.5rem; }

.back-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-bottom: 1.25rem;
  border-radius: 999px;
  padding: .65rem .85rem;
  color: var(--teal-dark);
  font-size: .86rem;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover { background: rgba(8, 127, 114, .1); }

.header-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: start;
}

.eyebrow,
.card-kicker {
  margin: 0 0 .45rem;
  color: var(--teal-dark);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: anywhere; }

h1 {
  max-width: 15ch;
  margin: 0;
  font-size: clamp(2.35rem, 7vw, 5rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.lede {
  max-width: 48ch;
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.trust-chip {
  display: flex;
  gap: .75rem;
  align-items: center;
  min-width: 13.5rem;
  padding: .9rem 1rem;
  border: 1px solid #83cfc1;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  color: var(--teal-dark);
  box-shadow: 0 8px 28px rgba(16, 42, 67, .06);
  font-size: .84rem;
  line-height: 1.25;
}

.trust-banner {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: .5rem 1.5rem;
  margin-top: 2.4rem;
  padding: 1.25rem 1.35rem;
  border-left: 5px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #e8f7f3;
}

.trust-banner h2 { margin: 0; font-size: 1rem; }
.trust-banner p { margin: 0; color: #27485e; }
.trust-banner .technical-note,
.trust-banner .state-note { grid-column: 2; margin-top: .35rem; font-size: .85rem; }

.demo-navigation { padding: 1.25rem 0 2rem; }

.demo-group + .demo-group { margin-top: 2rem; }

.group-heading {
  display: flex;
  gap: .9rem;
  align-items: center;
  margin-bottom: .8rem;
}

.group-heading h2 { margin: 0; font-size: 1.2rem; }
.group-heading p { margin: .05rem 0 0; color: var(--muted); font-size: .9rem; }

.group-number {
  display: grid;
  place-items: center;
  width: 2.7rem;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--teal-dark);
  font-size: .72rem;
  font-weight: 900;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
}

.demo-card {
  position: relative;
  display: flex;
  min-height: 9.8rem;
  flex-direction: column;
  gap: .45rem;
  padding: 1.1rem;
  border: 2px solid transparent;
  border-radius: 16px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 8px 24px rgba(16, 42, 67, .07);
  text-decoration: none;
}

.demo-card::after {
  content: "↗";
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--muted);
  font-weight: 800;
}

.demo-card:hover { border-color: #84b9af; }
.demo-card strong { padding-right: 1.5rem; font-size: 1.05rem; line-height: 1.2; }
.demo-card > span:not(.card-kicker, .viewing-badge) { color: var(--muted); font-size: .88rem; }

.viewing-badge {
  display: none;
  align-self: flex-start;
  margin-top: auto;
  padding: .28rem .55rem;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: .72rem;
  font-weight: 800;
}

.demo-card[aria-current="page"] {
  border-color: var(--teal-dark);
  background: linear-gradient(145deg, white, #e5f7f3);
  box-shadow: 0 0 0 3px var(--mint), 0 14px 30px rgba(16, 42, 67, .12);
}

.demo-card[aria-current="page"]::after { content: "◆"; color: var(--teal-dark); }
.demo-card[aria-current="page"] .viewing-badge { display: inline-flex; gap: .25rem; }

.dashboard-shell {
  min-height: 26rem;
  padding: clamp(1rem, 2.5vw, 2rem);
  border: 1px solid #d9e0e5;
  border-radius: 26px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.fallback-panel {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  min-height: 19rem;
  justify-content: center;
  padding: 5rem 1rem;
}

.fallback-panel h2 { margin: 0 0 .35rem; }
.fallback-panel p { max-width: 52ch; margin: 0; color: var(--muted); }
.loading-mark { color: var(--teal); font-size: 2rem; line-height: 1; }

.error-panel {
  border: 2px solid #e2a4a4;
  border-radius: var(--radius);
  background: #fff5f3;
  padding: 1.5rem;
}

.error-panel ul { padding-left: 1.25rem; }

.dashboard-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.dashboard-header h2 {
  margin: .15rem 0 .4rem;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.04;
  letter-spacing: -.035em;
}

.dashboard-question { max-width: 62ch; margin: 0; color: var(--muted); font-size: 1.02rem; }

.dashboard-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }

.button,
.control-button,
.sort-button {
  min-height: 2.75rem;
  border: 1px solid #9fb0bd;
  border-radius: .65rem;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
}

.button, .control-button { padding: .62rem .85rem; }
.button:hover, .control-button:hover, .sort-button:hover { border-color: var(--teal-dark); background: #effaf7; }
.button.primary { border-color: var(--teal-dark); background: var(--teal-dark); color: white; }

.limitation {
  margin: 1.15rem 0;
  padding: .8rem 1rem;
  border-left: 4px solid var(--amber);
  background: #fff7e9;
  color: #643500;
  font-size: .9rem;
}

.view-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1rem;
  align-items: end;
  margin: 1.1rem 0;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fafb;
}

.control-group { min-width: min(100%, 16rem); }
.control-label { display: block; margin-bottom: .4rem; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.segmented { display: flex; flex-wrap: wrap; gap: .35rem; }
.control-button { min-height: 2.75rem; padding: .48rem .72rem; font-size: .88rem; }
.control-button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: white; box-shadow: inset 0 -3px 0 var(--mint); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin: 1.15rem 0;
}

.kpi-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.kpi-label { margin: 0 0 .3rem; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { margin: 0; font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 850; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.kpi-detail { margin: .35rem 0 0; color: var(--muted); font-size: .78rem; }

.insight-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .75rem;
  margin: 1.15rem 0;
  padding: 1rem;
  border-radius: 14px;
  background: var(--ink);
  color: white;
}

.insight-panel h3 { margin: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.insight-panel p { margin: 0; }

.visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(22rem, 1fr));
  gap: 1rem;
  align-items: start;
}

.visual-grid.single-support-table { grid-template-columns: 1fr; }

.chart-card,
.data-card,
.definitions-panel,
.customize-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.chart-card { padding: .9rem; }
.chart-card:focus-visible { outline-offset: 4px; }
.chart-heading { margin: 0; font-size: 1rem; }
.chart-context { margin: .2rem 0 .8rem; color: var(--muted); font-size: .82rem; }
.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { display: block; width: 100%; height: auto; min-height: 15rem; }
.chart-wrap text { fill: var(--ink); font-family: inherit; font-size: 11px; }
.chart-wrap .axis-label { fill: var(--muted); font-size: 10px; }
.chart-wrap .grid-line { stroke: #dfe7eb; stroke-width: 1; }
.chart-wrap .series-line { fill: none; stroke-width: 3; }
.chart-wrap .label-leader { stroke-width: 1.5; }
.chart-wrap .direct-label { font-size: 11px; font-weight: 800; }
.chart-wrap .bar-label { font-size: 10px; font-weight: 750; }
.chart-wrap .chart-strong { font-weight: 800; }
.chart-wrap .chart-inverse { fill: #fff; }
.aggregate-heading { padding: .9rem .9rem 0; }
.aggregate-context { padding: 0 .9rem; }

.table-details { margin-top: .65rem; }
.table-details summary { display: flex; min-height: 44px; align-items: center; cursor: pointer; color: var(--teal-dark); font-weight: 800; }
.table-hint { margin: .45rem 0 0; color: var(--muted); font-size: .76rem; font-weight: 700; }
.aggregate-table-hint { padding: 0 .9rem; }
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin-top: .6rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: white;
  scrollbar-color: var(--teal) var(--soft);
}
.table-scroll:focus { outline: 3px solid var(--focus); outline-offset: 2px; }

table { width: 100%; min-width: 29rem; border-collapse: collapse; font-size: .78rem; font-variant-numeric: tabular-nums; }
caption { padding: .65rem; text-align: left; color: var(--muted); font-weight: 700; }
th, td { padding: .55rem .65rem; border-bottom: 1px solid #e2e8ec; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: #edf3f5; color: #29485d; }
tbody tr:last-child td { border-bottom: 0; }
.sort-button { min-height: 2.75rem; width: 100%; padding: .25rem .35rem; text-align: inherit; border-color: transparent; background: transparent; font-size: inherit; }

.definitions-panel { margin-top: 1rem; padding: 1rem; }
.definitions-panel h3 { margin: 0 0 .65rem; }
.definition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem 1.25rem; }
.definition-grid dt { font-weight: 800; }
.definition-grid dd { margin: .1rem 0 0; color: var(--muted); font-size: .84rem; }

.customize-panel { margin: 1rem 0; padding: 1rem; background: #f5faf9; }
.customize-panel[hidden] { display: none; }
.customize-panel h3 { margin: 0 0 .25rem; }
.customize-panel > p { margin: 0 0 .9rem; color: var(--muted); }
.customize-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.customize-panel fieldset { min-width: 0; margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: .7rem; }
.customize-panel legend { padding: 0 .25rem; font-weight: 800; }
.check-list { display: grid; gap: .45rem; }
.check-row { display: flex; gap: .5rem; align-items: flex-start; }
.check-row input { width: 1.1rem; height: 1.1rem; margin-top: .16rem; accent-color: var(--teal-dark); }
.customize-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.customize-error { min-height: 1.5rem; margin: .5rem 0 0; color: var(--red); font-weight: 750; }

.layout-compact .kpi-card { padding: .72rem; }
.layout-compact .kpi-detail, .layout-compact .definitions-panel { display: none; }
.layout-compact .chart-context { margin-bottom: .35rem; }

.feedback-guide {
  margin-top: 2rem;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  border-radius: 24px;
  background: linear-gradient(135deg, var(--ink), #184f64);
  color: white;
  box-shadow: var(--shadow);
}
.feedback-guide .eyebrow { color: var(--mint); }
.feedback-guide h2 { max-width: 24ch; margin: 0; font-size: clamp(1.5rem, 4vw, 2.5rem); line-height: 1.08; }
.feedback-guide blockquote { max-width: 34ch; margin: 1.2rem 0; font-size: clamp(1.2rem, 3vw, 1.8rem); font-weight: 750; line-height: 1.3; }
.feedback-guide > p:last-child { max-width: 70ch; color: #dbe9ee; }

.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 2rem 0 3rem; color: var(--muted); font-size: .82rem; }
.site-footer p { margin: 0; }
.site-footer a { display: inline-flex; min-height: 44px; align-items: center; }
.noscript-panel { margin-block: 1rem; padding: 1rem; border: 2px solid var(--red); background: #fff5f3; }

@media (max-width: 900px) {
  .header-grid, .dashboard-header, .visual-grid, .visual-grid.single-support-table { grid-template-columns: 1fr; }
  .trust-chip { justify-self: start; }
  .dashboard-actions { justify-content: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customize-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .site-header, .demo-navigation, .dashboard-shell, .feedback-guide, .site-footer, .noscript-panel { width: min(100% - 24px, 1180px); }
  .site-header { padding-top: 2rem; }
  .header-grid { gap: 1.25rem; }
  .trust-banner { grid-template-columns: 1fr; }
  .trust-banner .technical-note, .trust-banner .state-note { grid-column: 1; }
  .card-grid { grid-template-columns: 1fr; }
  .demo-card { min-height: 8.2rem; }
  .dashboard-shell { padding: 1rem; border-radius: 18px; }
  .customize-grid, .definition-grid { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; }
}

@media (max-width: 430px) {
  .site-header, .demo-navigation, .dashboard-shell, .feedback-guide, .site-footer, .noscript-panel { width: min(100% - 20px, 1180px); }
  h1 { font-size: 2.45rem; }
  .trust-chip { width: 100%; border-radius: 14px; }
  .view-controls { align-items: stretch; }
  .control-group { width: 100%; }
  .segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: 1fr; }
  .insight-panel { grid-template-columns: 1fr; }
  .dashboard-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .dashboard-actions .button { width: 100%; }
  .chart-wrap text { font-size: 22px; }
  .chart-wrap .axis-label, .chart-wrap .bar-label { font-size: 18px; }
  .chart-wrap .direct-label { font-size: 21px; }
  .chart-wrap .heatmap-text { font-size: 17px; }
}

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

@media (forced-colors: active) {
  .demo-card[aria-current="page"], .control-button[aria-pressed="true"], .button.primary { border: 3px solid CanvasText; }
  .viewing-badge { forced-color-adjust: none; }
}
