:root {
  --sea: #005553;
  --sea-deep: #073f42;
  --sea-soft: #dcece7;
  --tide: #9bc9bf;
  --ink: #173b40;
  --muted: #63797c;
  --paper: #fffefa;
  --wash: #edf4f1;
  --line: #d7e3de;
  --coral: #df635f;
  --coral-soft: #f8e7e3;
  --sand: #f7f0df;
  --warn: #845b20;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(19, 62, 62, .07);
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--wash);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--wash); }
button, input, select { font: inherit; }
button, a, input, select { touch-action: manipulation; }
button, select { cursor: pointer; }
a { color: var(--sea); text-underline-offset: 3px; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.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; }
.skip { position: absolute; top: -60px; left: 12px; padding: 12px; z-index: 100; background: white; }
.skip:focus { top: 12px; }

.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; min-width: 0; height: 100vh; padding: 30px 22px; display: flex; flex-direction: column; gap: 38px; background: #f9fcfa; border-right: 1px solid var(--line); }
.brand { display: flex; gap: 11px; align-items: center; }
.brand img { box-shadow: 0 9px 24px rgba(0, 85, 83, .18); border-radius: 13px; }
.brand strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 22px; letter-spacing: -.8px; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1.7px; }
.nav { display: grid; gap: 6px; }
.nav a { position: relative; padding: 12px 14px; border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 650; text-decoration: none; }
.nav a::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: transparent; }
.nav a[aria-current="page"] { color: var(--sea); background: var(--sea-soft); }
.nav a[aria-current="page"]::before { background: var(--sea); }
.nav a:hover { background: #e8f1ed; color: var(--sea-deep); }
.side-note { margin-top: auto; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.8; }
.side-note b { color: var(--ink); font-weight: 700; }

.main { width: 100%; min-width: 0; max-width: 1600px; margin: auto; padding: 30px clamp(24px, 3.3vw, 54px) 46px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 31px; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 1.9px; text-transform: uppercase; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 28px; padding: 6px 11px; border-radius: 999px; color: var(--sea); background: var(--sea-soft); font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge.warn { color: var(--warn); background: #f4e8c9; }
.badge.historical { color: #924a44; background: var(--coral-soft); }
.button { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--paper); box-shadow: 0 4px 12px rgba(26, 67, 67, .04); font-size: 12px; font-weight: 700; text-decoration: none; }
.button:hover { border-color: var(--tide); background: #fbfdfc; }
.button.primary { color: white; background: var(--sea); border-color: var(--sea); }
.button.subtle { background: transparent; box-shadow: none; }

.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 7px 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(31px, 3.2vw, 48px); font-weight: 500; line-height: 1.05; letter-spacing: -1.7px; }
.page-head p { max-width: 760px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.overview-head { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: end; margin-bottom: 26px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.overview-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 88px; height: 2px; background: var(--coral); }
.overview-copy { min-width: 0; }
.overview-copy h1 { max-width: 800px; }
.source-key { display: grid; grid-template-columns: repeat(2, minmax(126px, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: rgba(255, 254, 250, .72); }
.source-key div { padding: 13px 16px; }
.source-key div + div { border-left: 1px solid var(--line); }
.source-key span, .source-key small { display: block; color: var(--muted); font-size: 9px; letter-spacing: .7px; text-transform: uppercase; }
.source-key strong { display: block; margin: 2px 0 5px; color: var(--sea-deep); font-family: Georgia, "Times New Roman", serif; font-size: 19px; font-weight: 500; }

.scope { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 17px; padding: 11px 15px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(255, 254, 250, .66); font-size: 11px; line-height: 1.5; }
.scope b { color: var(--ink); }
.scope .warn-text { color: var(--warn); text-align: right; }
.scope-error { border-color: #ebceca; background: #fbefed; }
.metrics { display: grid; grid-template-columns: 1.45fr repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.metric { min-width: 0; padding: 16px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.metric .label { min-height: 28px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.metric .value { display: block; margin: 5px 0 7px; font-size: clamp(18px, 1.6vw, 25px); font-weight: 700; letter-spacing: -.7px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric:first-child { color: white; border-color: var(--sea); background: var(--sea); box-shadow: 0 12px 28px rgba(0, 85, 83, .16); }
.metric:first-child .label, .metric:first-child small { color: #cfe5df; }
.metric small { color: var(--muted); font-size: 9px; line-height: 1.4; }

.panel { min-width: 0; margin-bottom: 22px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.panel h2 { margin: 0 0 6px; font-size: 20px; font-weight: 680; letter-spacing: -.5px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.controls { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 11px; }
.controls label { color: var(--muted); }
.controls select, .controls input { max-width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; }
.notice { margin: 12px 0 20px; padding: 12px 15px; border-radius: 10px; color: var(--warn); background: var(--sand); font-size: 11px; line-height: 1.6; }
.notice p { margin: 3px 0; }
.notice.error { color: #873c37; background: #fbefed; }

.funnel-panel { position: relative; padding: 0; overflow: hidden; border-color: #cdded8; box-shadow: var(--shadow); }
.funnel-panel::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--sea) 0 60%, var(--tide) 60% 82%, var(--coral) 82%); }
.funnel-head { margin: 0; padding: 28px 28px 20px; background: linear-gradient(110deg, rgba(220, 236, 231, .66), rgba(255, 254, 250, .2) 54%); }
.funnel-title-wrap { display: flex; gap: 17px; align-items: flex-start; }
.funnel-index { flex: 0 0 auto; padding-top: 3px; color: var(--coral); font-family: Georgia, "Times New Roman", serif; font-size: 13px; font-style: italic; letter-spacing: -.5px; }
.funnel-head h2 { margin-top: 5px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(24px, 2.1vw, 31px); font-weight: 500; letter-spacing: -1px; }
.funnel-controls { justify-content: flex-end; }
.funnel-status { display: flex; align-items: center; gap: 11px; padding: 0 28px 17px; color: var(--muted); font-size: 10px; background: linear-gradient(110deg, rgba(220, 236, 231, .66), rgba(255, 254, 250, .2) 54%); }
.funnel-notice { margin: 0 28px 22px; border-left: 3px solid #d9b970; }
.funnel-counts { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 0; padding: 6px 28px 25px; list-style: none; }
.funnel-counts::before { content: ""; position: absolute; top: 23px; left: 45px; right: 45px; height: 1px; background: var(--tide); }
.count-step { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding-right: 14px; }
.step-index { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--tide); border-radius: 50%; color: var(--sea); background: var(--paper); font-family: Georgia, "Times New Roman", serif; font-size: 10px; font-weight: 700; }
.count-step:first-child .step-index, .count-step:last-child .step-index { color: white; border-color: var(--sea); background: var(--sea); }
.count-step small { display: block; min-height: 28px; padding-top: 1px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.count-step strong { display: block; margin-top: 4px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 500; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.count-step em { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-style: normal; line-height: 1.4; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 0; padding: 13px 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); background: #fbfdfc; font-size: 9px; }
.legend span { display: inline-flex; gap: 7px; align-items: center; }
.swatch { display: inline-block; width: 18px; height: 4px; border-radius: 2px; background: var(--sea); }
.swatch.history { background: var(--coral); }
.swatch.market { height: 2px; border-top: 2px dashed var(--ink); border-radius: 0; background: none; }
.transitions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 28px; }
.transition { min-width: 0; padding: 24px 21px 22px; border-right: 1px solid var(--line); }
.transition:first-child { padding-left: 0; }
.transition:last-child { padding-right: 0; border-right: 0; }
.transition header { display: flex; gap: 8px; align-items: baseline; min-height: 30px; }
.transition-index { color: var(--coral); font-family: Georgia, "Times New Roman", serif; font-size: 10px; font-style: italic; }
.transition h3 { margin: 0; font-size: 11px; font-weight: 750; line-height: 1.4; }
.rate-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-top: 8px; }
.rate { font-family: Georgia, "Times New Roman", serif; font-size: 31px; font-weight: 500; letter-spacing: -1.2px; font-variant-numeric: tabular-nums; }
.rate small { display: block; margin-top: 5px; color: var(--muted); font-family: Aptos, "Segoe UI", Arial, sans-serif; font-size: 9px; font-weight: 400; letter-spacing: 0; line-height: 1.35; }
.history-chip { margin-top: 3px; padding: 4px 6px; border-radius: 6px; color: #96534d; background: var(--coral-soft); font-size: 8px; white-space: nowrap; }
.track { position: relative; height: 12px; margin: 13px 0 4px; overflow: visible; border-radius: 3px; background: #e8f0ed; }
.track svg { display: block; width: 100%; height: 12px; }
.rate-bar { fill: var(--sea); }
.rate-bar.historical { fill: var(--coral); }
.market-line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 1; }
.history-track { display: block; width: 100%; height: 3px; }
.history-track rect { fill: var(--coral); }
.axis { display: flex; justify-content: space-between; margin: 6px 0 13px; color: #87999a; font-size: 8px; }
.reference-text { min-height: 92px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.reference-text > span { display: block; margin-bottom: 4px; color: #87999a; font-size: 8px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.reference-text b, .reference-text small, .reference-text a { display: block; }
.reference-text b { margin-bottom: 3px; color: var(--ink); font-size: 10px; font-weight: 700; }
.reference-text small { color: var(--muted); font-size: 9px; }
.reference-text a { width: fit-content; margin-top: 5px; font-size: 9px; }
.funnel-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; padding: 1px 28px 0; background: var(--line); }
.comparison { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 3px 18px; align-items: center; padding: 19px 21px; background: var(--sea-deep); color: white; }
.comparison:first-child { padding-left: 22px; }
.comparison:last-child { background: var(--sea); }
.comparison-label { grid-column: 1 / -1; color: #acd0c7; font-size: 8px; font-weight: 750; letter-spacing: 1.2px; text-transform: uppercase; }
.comparison .big { grid-row: 2 / 4; font-family: Georgia, "Times New Roman", serif; font-size: 31px; font-weight: 500; font-variant-numeric: tabular-nums; }
.comparison p { margin: 0; color: #c8dfda; font-size: 9px; line-height: 1.6; }
.comparison b { color: white; }
.funnel-panel > .footnote { margin: 0; padding: 15px 28px 20px; background: #fbfdfc; }

.footnote { margin: 14px 0 0; color: var(--muted); font-size: 10px; line-height: 1.75; }
.split { display: grid; grid-template-columns: 1fr 1.05fr; gap: 22px; }
.support-panel { position: relative; overflow: hidden; }
.support-panel::before { content: ""; position: absolute; top: 0; left: 0; width: 72px; height: 3px; background: var(--sea); }
.campaign-panel::before { background: var(--coral); }
.support-panel .panel-head { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.support-panel .panel-head .eyebrow { margin-bottom: 6px; }
.support-panel h2 { font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 500; }
.campaign-panel tbody tr { transition: background-color .18s ease; }
.campaign-panel tbody tr:hover { background: #f7faf8; }
.line-chart { display: block; width: 100%; height: 185px; }
.line-chart text { fill: var(--muted); font-family: Aptos, "Segoe UI", Arial, sans-serif; font-size: 10px; }
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart .curve { fill: none; stroke: var(--sea); stroke-width: 2.5; }
.line-chart circle { fill: var(--paper); stroke: var(--sea); stroke-width: 2; }
.table-scroll { max-width: 100%; overflow: auto; scrollbar-color: var(--tide) transparent; scrollbar-width: thin; }
.table-scroll:focus-visible { outline-offset: 5px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
th { padding: 0 10px 14px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .25px; text-align: left; }
td { padding: 14px 10px 14px 0; border-bottom: 1px solid #edf2ef; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
.numeric { text-align: right; }
.table-name { font-weight: 700; }
.table-name small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 400; }
.wrap { min-width: 190px; line-height: 1.65; white-space: normal; }
.quality-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.quality-item { padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
.quality-item h3 { margin: 0 0 10px; font-size: 15px; }
.quality-item p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.quality-item .badge { white-space: normal; }
.filters { gap: 12px; margin-bottom: 20px; }
.empty { padding: 20px 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.source-list { display: grid; gap: 12px; }
.source { padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; }
.source h3 { margin: 0 0 5px; color: var(--ink); font-size: 14px; }
.source p { margin: 4px 0; }
.welcome { max-width: 510px; margin: 10vh auto; padding: 38px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: var(--shadow); }
.welcome h1 { font-family: Georgia, "Times New Roman", serif; font-size: 40px; font-weight: 500; letter-spacing: -1.4px; }
.welcome p { color: var(--muted); font-size: 14px; line-height: 1.8; }
.welcome .button { margin: 14px 0; font-size: 14px; }
.welcome .notice { margin-bottom: 0; }
.footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 10px; color: var(--muted); font-size: 9px; line-height: 1.7; }
.quiet { color: var(--muted); font-size: 11px; }

.cohort-panel { padding: 28px; }
.cohort-panel .panel-head { margin-bottom: 18px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.cohort-panel .panel-head .eyebrow { margin-bottom: 7px; }
.cohort-panel h2 { font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 500; }
.cohort-table tbody tr { transition: background-color .18s ease; }
.cohort-table tbody tr:hover { background: #f7faf8; }
.cohort-date { color: var(--sea-deep); font-weight: 700; }
.maturity-badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; color: var(--warn); background: var(--sand); font-size: 9px; font-weight: 700; }
.maturity-badge.mature { color: var(--sea); background: var(--sea-soft); }
.pending-label { color: var(--muted); font-size: 10px; }
.cohort-note { margin-top: 16px; padding: 12px 14px; border-left: 3px solid var(--coral); border-radius: 0 9px 9px 0; background: var(--coral-soft); color: #704b48; }

@media (min-width: 1600px) {
  .rate { font-size: 34px; }
}

@media (max-width: 1250px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .metric .label { min-height: 0; }
  .transitions { grid-template-columns: repeat(2, 1fr); }
  .transition:nth-child(2) { padding-right: 0; border-right: 0; }
  .transition:nth-child(3) { padding-left: 0; border-top: 1px solid var(--line); }
  .transition:nth-child(4) { border-top: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
  .panel-head { flex-wrap: wrap; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 15px 20px; gap: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { gap: 9px; }
  .brand img { width: 32px; height: 32px; }
  .brand strong { font-size: 18px; }
  .brand small { font-size: 8px; }
  .nav { display: flex; width: 100%; min-width: 0; max-width: 100%; gap: 4px; overflow: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 9px 11px; font-size: 11px; white-space: nowrap; }
  .nav a::before { display: none; }
  .side-note { display: none; }
  .main { padding: 22px 20px 36px; }
  .overview-head { grid-template-columns: 1fr; gap: 20px; }
  .source-key { width: fit-content; }
  .funnel-counts { grid-template-columns: repeat(5, 150px); overflow-x: auto; }
  .count-step { min-width: 0; }
  .quality-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .main { padding: 18px 14px 30px; }
  .topbar { align-items: flex-start; margin-bottom: 23px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .topbar > .eyebrow { max-width: 115px; font-size: 8px; line-height: 1.5; }
  .page-head h1 { font-size: 35px; }
  .overview-head { padding-bottom: 21px; }
  .source-key { width: 100%; grid-template-columns: 1fr 1fr; }
  .source-key div { padding: 11px 13px; }
  .scope { align-items: flex-start; flex-direction: column; gap: 7px; }
  .scope .warn-text { text-align: left; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 14px 12px; }
  .metric .value { font-size: 21px; }
  .panel { padding: 18px 14px; border-radius: 14px; }
  .panel h2 { font-size: 18px; }
  .funnel-panel { padding: 0; }
  .funnel-head { padding: 24px 18px 18px; }
  .funnel-title-wrap { gap: 10px; }
  .funnel-index { display: none; }
  .funnel-head h2 { font-size: 26px; }
  .funnel-controls { width: 100%; justify-content: flex-start; }
  .funnel-status { padding: 0 18px 14px; flex-wrap: wrap; }
  .funnel-notice { margin: 0 18px 18px; }
  .funnel-counts { padding: 5px 18px 21px; }
  .funnel-counts::before { left: 35px; right: 35px; }
  .funnel-counts { grid-template-columns: repeat(5, 138px); }
  .legend { padding: 12px 18px; }
  .transitions { grid-template-columns: 1fr; padding: 0 18px; }
  .transition, .transition:first-child, .transition:last-child, .transition:nth-child(2), .transition:nth-child(3), .transition:nth-child(4) { padding: 20px 0; border-right: 0; border-top: 1px solid var(--line); }
  .transition:first-child { border-top: 0; }
  .reference-text { min-height: 0; }
  .funnel-footer { grid-template-columns: 1fr; padding: 1px 18px 0; }
  .comparison, .comparison:first-child { padding: 17px 18px; }
  .funnel-panel > .footnote { padding: 14px 18px 18px; }
  .support-panel h2, .cohort-panel h2 { font-size: 22px; }
  .cohort-panel { padding: 20px 18px; }
  .quality-grid { grid-template-columns: 1fr; }
  .welcome { margin: 6vh 14px; padding: 25px; }
  .footer { flex-direction: column; }
  .source p { overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; animation: none !important; }
}
