:root {
  --bg: #fbf7f8;
  --surface: #ffffff;
  --surface-2: #fff5f7;
  --ink: #2b1d23;
  --ink-2: #5d4b53;
  --muted: #8b7a81;
  --line: #eee2e6;
  --line-strong: #dccbd1;
  --accent: #c94361;
  --accent-ink: #9e2f4b;
  --accent-soft: #ffe2e8;
  --logo: #ffaebc;
  --rm: #2a78d6;
  --ml: #eb6834;
  --mc: #1baf7a;
  --zone: rgba(255, 174, 188, 0.28);
  --shadow: 0 1px 2px rgba(122, 32, 56, 0.06), 0 8px 24px rgba(122, 32, 56, 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171214;
    --surface: #211a1d;
    --surface-2: #2a1f24;
    --ink: #f3eaed;
    --ink-2: #cdbcc3;
    --muted: #9c8b92;
    --line: #3a2e33;
    --line-strong: #4d3d44;
    --accent: #ff8fa5;
    --accent-ink: #ffb3c2;
    --accent-soft: #4a2531;
    --rm: #3987e5;
    --ml: #d95926;
    --mc: #199e70;
    --zone: rgba(255, 143, 165, 0.16);
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* Header */

.masthead {
  padding: 40px 0 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--logo);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

h1 {
  margin: 14px 0 10px;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 46rem;
  margin: 0;
  color: var(--ink-2);
  font-size: 1.05rem;
}

.meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 24px 0 8px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tabs a {
  padding: 7px 16px;
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
}

.tabs a[aria-current="page"] {
  background: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tabs a[aria-current="page"] { color: #2b1d23; }
}

/* Sections */

section {
  margin-top: 40px;
}

h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.section-intro {
  margin: 0 0 18px;
  color: var(--ink-2);
  max-width: 46rem;
}

p { margin: 0 0 10px; }

ul { margin: 0; padding-left: 1.2rem; }

li { margin: 4px 0; }

li::marker { color: var(--accent); }

a { color: var(--accent-ink); }

strong { font-weight: 700; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

/* Price bands */

.grid-bands {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.band {
  position: relative;
  padding-top: 18px;
}

.band-price {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.85rem;
}

.band--ours {
  border: 2px solid var(--accent);
}

.band--ours .band-price {
  background: var(--accent);
  color: #fff;
}

.band--over {
  background: var(--surface-2);
}

.offer {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.offer:first-of-type { border-top: 0; padding-top: 0; }

.offer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 4px;
}

.offer-price {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.offer p, .offer li { color: var(--ink-2); font-size: 0.95rem; }

/* Network chips: color marks identity, the text names it */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c, var(--muted));
}

.chip.rm { --c: var(--rm); }
.chip.ml { --c: var(--ml); }
.chip.mc { --c: var(--mc); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Range chart: one row per offer, bar from lowest to highest price */

.range-chart {
  --lw: 17rem;
  position: relative;
  padding: 8px 0 4px;
}

.rc-row {
  display: grid;
  grid-template-columns: var(--lw) 1fr;
  align-items: center;
  min-height: 38px;
}

.rc-label {
  padding-right: 14px;
  font-size: 0.86rem;
  line-height: 1.3;
  color: var(--ink-2);
}

.rc-label .chip { font-size: 0.8rem; display: flex; }

.rc-track {
  position: relative;
  height: 38px;
  border-left: 1px solid var(--line-strong);
}

.rc-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed var(--line);
}

.rc-bar {
  position: absolute;
  top: 50%;
  left: calc(var(--a) / var(--max) * 100%);
  width: max(10px, calc((var(--b) - var(--a)) / var(--max) * 100%));
  height: 12px;
  transform: translateY(-50%);
  border-radius: 4px;
  background: var(--c);
  box-shadow: 0 0 0 2px var(--surface);
  cursor: default;
  z-index: 2;
}

.rc-bar.point { width: 12px; margin-left: -6px; border-radius: 50%; }

.rc-bar.dental {
  background: repeating-linear-gradient(45deg, var(--c) 0 3px, transparent 3px 6px);
  outline: 1.5px solid var(--c);
  outline-offset: -1.5px;
}

.rc-row.rm { --c: var(--rm); }
.rc-row.ml { --c: var(--ml); }
.rc-row.mc { --c: var(--mc); }

.rc-val {
  position: absolute;
  top: 50%;
  left: calc(var(--b) / var(--max) * 100% + 10px);
  transform: translateY(-50%);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--surface);
  z-index: 2;
}

.rc-val.left {
  left: auto;
  right: calc(100% - var(--a) / var(--max) * 100% + 10px);
}

/* Tooltip */

.rc-bar[data-tip]:hover::after,
.rc-bar[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 260px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  pointer-events: none;
  z-index: 5;
}

.rc-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Overlays share the plot column */

.rc-overlay {
  position: absolute;
  top: 0;
  bottom: 28px;
  left: var(--lw);
  right: 0;
  pointer-events: none;
}

.rc-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--a) / var(--max) * 100%);
  width: calc((var(--b) - var(--a)) / var(--max) * 100%);
  background: var(--zone);
  border-radius: 6px;
}

.rc-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--v) / var(--max) * 100%);
  border-left: 2px solid var(--accent);
}

.rc-line span {
  position: absolute;
  top: -22px;
  left: 6px;
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.rc-axis {
  display: grid;
  grid-template-columns: var(--lw) 1fr;
  height: 28px;
}

.rc-ticks {
  position: relative;
  border-top: 1px solid var(--line-strong);
}

.rc-ticks span {
  position: absolute;
  top: 4px;
  left: calc(var(--v) / var(--max) * 100%);
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

/* Small dental benefit inside a general plan */

.dent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 1px;
}

.dent::before {
  content: "";
  width: 11px;
  height: 11px;
  background: currentColor;
  -webkit-mask: var(--tooth) center / contain no-repeat;
  mask: var(--tooth) center / contain no-repeat;
}

:root {
  --tooth: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M7 2C4.5 2 3 4 3 6.5c0 2 .8 3.4 1.3 5 .6 2 .7 4.2 1.2 6.5.4 1.8 1 4 2.3 4 1.4 0 1.6-2.5 2-4.3.3-1.2.9-2.2 2.2-2.2s1.9 1 2.2 2.2c.4 1.8.6 4.3 2 4.3 1.3 0 1.9-2.2 2.3-4 .5-2.3.6-4.5 1.2-6.5.5-1.6 1.3-3 1.3-5C21 4 19.5 2 17 2c-2 0-3 1-5 1S9 2 7 2z'/></svg>");
}

.rc-empty {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  padding: 0 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 14px 0 0;
  color: var(--ink-2);
  font-size: 0.82rem;
}

.legend .sw {
  display: inline-block;
  width: 18px;
  height: 10px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 3px;
  background: var(--muted);
}

.legend .sw.dental {
  background: repeating-linear-gradient(45deg, var(--muted) 0 3px, transparent 3px 6px);
  outline: 1.5px solid var(--muted);
  outline-offset: -1.5px;
}

.legend .sw.zone { background: var(--zone); }

.legend .sw.line { width: 2px; background: var(--accent); }

.chart-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .range-chart { --lw: 9.5rem; }
  .rc-label { font-size: 0.76rem; padding-right: 8px; }
  .rc-label .chip { font-size: 0.72rem; }
  .rc-val { font-size: 0.72rem; }
  .card { padding: 16px; }
  .tabs { flex-wrap: wrap; border-radius: 14px; }
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }

td.num { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Callouts */

.callout {
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 14px 14px 0;
  padding: 16px 18px;
}

.stat-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  margin-bottom: 14px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.stat-value {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label { color: var(--ink-2); font-size: 0.88rem; }

.unconfirmed { color: var(--muted); font-size: 0.9rem; }

footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}
