:root {
  --bg: #fff1e0;                /* light orange page */
  --surface: #ffffff;
  --input-bg: #fff1e0;
  --text: #17202b;
  --muted: #5a6573;
  --rule: #dde2e8;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --accent-soft: #e6f0fa;
  --good: #11663a;
  --warn-bg: #fff4d6;
  --warn-text: #6a4a00;
  --est-bg: #eceff3;
  --est-text: #3d4651;
  --tag-bg: #f1ecfa;
  --tag-text: #4b2f86;
  --error: #a3221b;
  --new: #6a2fb0;               /* "Added on" plan notes */
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --header-bg: #ff9b3d;          /* bright orange header */
  --header-text: #1c1206;
  --header-muted: #3d2a12;
  --thead-bg: #ffe0bd;           /* plan table's column headings */
  --tip-bg: #1c2733;
  --tip-text: #ffffff;
  --arrow-top: #d9731c;            /* usage modal's Easiest / Most Accurate arrow */
  --arrow-bottom: #0b5cad;
  --arrow-text: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {   /* dark oranges */
    --bg: #180901;
    --surface: #3a1802;
    --input-bg: #2a1000;
    --text: #fbeee2;
    --muted: #e0b994;
    --rule: #68300a;
    --accent: #8ac2f8;
    --accent-text: #0b1520;
    --accent-soft: #163049;
    --good: #7ee0a8;
    --warn-bg: #5a3a08;
    --warn-text: #ffdf8a;
    --est-bg: #5a2a0c;
    --est-text: #f0d8c2;
    --tag-bg: #4a2448;
    --tag-text: #f0c8ec;
    --error: #ff9a8f;
    --new: #d3b2ff;
    --shadow: none;
    --header-bg: #a8500f;
    --header-text: #fff5ea;
    --header-muted: #ffe0bf;
    --thead-bg: #73330a;
    --tip-bg: #fbeee2;
    --tip-text: #2b1405;
    --arrow-top: #a8500f;
    --arrow-bottom: #2f6fae;
    --arrow-text: #ffffff;
  }
}
:root[data-theme="dark"] {
  --bg: #180901; --surface: #3a1802; --input-bg: #2a1000; --text: #fbeee2; --muted: #e0b994; --rule: #68300a; --accent: #8ac2f8; --accent-text: #0b1520; --accent-soft: #163049; --good: #7ee0a8; --warn-bg: #5a3a08; --warn-text: #ffdf8a; --est-bg: #5a2a0c; --est-text: #f0d8c2; --tag-bg: #4a2448; --tag-text: #f0c8ec; --error: #ff9a8f; --new: #d3b2ff; --shadow: none; --header-bg: #a8500f; --header-text: #fff5ea; --header-muted: #ffe0bf; --thead-bg: #73330a; --tip-bg: #fbeee2; --tip-text: #2b1405;
  --arrow-top: #a8500f; --arrow-bottom: #2f6fae; --arrow-text: #ffffff;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { background: var(--header-bg); color: var(--header-text); border-bottom: 1px solid rgba(0, 0, 0, 0.12); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-top: 12px; padding-bottom: 12px; }
/* The logo carries the site name (alt text for screen readers). */
.top h1 { margin: 0; line-height: 0; }
.top h1 img { display: block; width: auto; height: 120px; }
.tagline { flex: 1 1 16rem; margin: 0; font-size: 1.15rem; font-weight: 500; color: var(--header-muted); }
@media (max-width: 600px) { .top h1 img { height: 88px; } .tagline { font-size: 1rem; } }
/* Shown only to a signed-in admin (app.js asks /_auth/me). */
.admin-link { margin-left: auto; font-weight: 600; font-size: 0.9rem; padding: 7px 14px; border: 1px solid var(--header-text); border-radius: 8px;
  color: var(--header-text); text-decoration: none; white-space: nowrap; }
.admin-link:hover { background: rgba(0, 0, 0, 0.08); }

/* Lookup form */
.lookup { display: grid; grid-template-columns: 10rem 1fr; gap: 16px 28px; align-items: start;
  margin: 22px 0 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow); }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field output { font-variant-numeric: tabular-nums; }
#zip { width: 100%; font: 600 1.15rem/1.2 inherit; padding: 9px 11px; border: 1px solid var(--rule); border-radius: 8px; background: var(--input-bg); color: var(--text); letter-spacing: 0.06em; }
/* Usage (assets/usage.js): the main-page block and the modal. */
/* "Just looking around?" zips under the no-plans message. */
.sample-zips-box { margin-top: 10px; color: var(--text); font-weight: 400; }
.sample-zips-box p { margin: 0 0 4px; }
.sample-zips { margin: 0; padding-left: 20px; columns: 2 16em; font-size: 0.9rem; }
.sample-zips li { margin: 2px 0; }
.sample-zips .reset { font-size: inherit; font-weight: 600; }
.usage-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 6px; }
.usage-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.usage-method { font-weight: 600; }
.usage-avg { font-weight: 400; color: var(--muted); }
.usage-avg strong { color: var(--text); }
.field .usage-label { font-weight: 400; margin-bottom: 4px; }
.avg-slider input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }
.kwh-box { width: 6.2em; font: inherit; font-variant-numeric: tabular-nums; padding: 5px 7px; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--input-bg); color: var(--text); }
.field .usage-hl label, .field .month-box { font-weight: 400; margin: 0; }
.usage-hl { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 4px 0; }
.usage-months, .um-months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.month-box { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; color: var(--muted); }
.month-box .kwh-box { width: 100%; padding: 5px 4px; }
@media (max-width: 1000px) { .usage-months { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 480px) { .usage-months { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Usage profile: three buttons that work like radio buttons. */
.profile { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 10px; font-size: 0.85rem; }
.profile-label { color: var(--muted); }
.profile-opts { display: inline-flex; border: 1px solid var(--accent); border-radius: 8px; overflow: hidden; }
.profile-opts button { font: inherit; font-size: 0.82rem; padding: 5px 11px; border: 0; border-left: 1px solid var(--accent); background: transparent;
  color: var(--accent); cursor: pointer; }
.profile-opts button:first-child { border-left: 0; }
.profile-opts button[aria-checked="true"] { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.profile-opts button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

.usage-modal { width: min(940px, calc(100vw - 16px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--rule); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
.usage-modal[open] { display: flex; flex-direction: column; }
.usage-modal::backdrop { background: rgba(0, 0, 0, 0.45); }
.um-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 10px; border-bottom: 1px solid var(--rule); }
.um-head h2 { flex: 1; margin: 0; font-size: 1.15rem; }
.um-x { background: none; border: 0; color: var(--muted); font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.um-body { position: relative; flex: 1; display: flex; gap: 10px; padding: 12px 0 12px 10px; overflow: hidden; min-height: 0; }
/* While more options are below: a fade over the bottom of the list and a "More below" button. */
.um-more { position: absolute; left: 84px; right: 18px; bottom: 0; height: 64px; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 8px; background: linear-gradient(to bottom, transparent, var(--surface) 70%); pointer-events: none; }
.um-more[hidden] { display: none; }
.um-more button { pointer-events: auto; font: inherit; font-size: 0.85rem; font-weight: 600; padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent); cursor: pointer; box-shadow: var(--shadow); }
.um-more button:hover { background: var(--accent-soft); }
/* Arrows down the left: 90% of the height, labels inside near the heads. */
.um-arrows { flex: 0 0 64px; display: flex; align-items: center; }

/* One two-headed arrow, nearly the full height: Easiest at the top, Most Accurate at the bottom. */
.um-arrow { height: 98%; width: 100%; display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: 44px 0; background: linear-gradient(to bottom, var(--arrow-top), var(--arrow-bottom)); color: var(--arrow-text);
  font-weight: 800; font-size: 1rem; letter-spacing: 0.06em; text-transform: uppercase;
  clip-path: polygon(50% 0, 100% 38px, 76% 38px, 76% calc(100% - 38px), 100% calc(100% - 38px), 50% 100%, 0 calc(100% - 38px),
    24% calc(100% - 38px), 24% 38px, 0 38px); }
.um-arrow span { writing-mode: vertical-rl; white-space: nowrap; }
.um-arrow .um-arrow-top { transform: rotate(180deg); }
/* Only the options scroll; the arrows stay the height of the visible area. */
.um-options { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; padding: 2px 18px 2px 2px; }
.um-opt { display: flex; gap: 14px; padding: 12px 14px; border: 2px solid transparent; border-radius: 12px; cursor: pointer; }
.um-opt:hover { background: var(--accent-soft); }
.um-opt.selected { border-color: var(--accent); background: var(--accent-soft); cursor: default; }
.um-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.um-opt.um-soon { cursor: default; }
.um-opt.um-soon:hover { background: none; }
.um-num { flex: 0 0 auto; width: 1.4em; font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--accent); text-align: center; }
.um-content { flex: 1; min-width: 0; }
.um-content h3 { margin: 2px 0 2px; font-size: 1.02rem; }
.um-desc { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); }
.um-value { margin: 6px 0; font-size: 0.9rem; }
.um-inline { display: block; margin-top: 4px; font-size: 0.85rem; }
.um-hl { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0; font-size: 0.9rem; }
.um-hl select { font: inherit; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 6px; background: var(--input-bg); color: var(--text); }
.um-months { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 560px) { .um-months { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.um-chart-wrap { touch-action: none; }
.um-chart { width: 100%; height: auto; display: block; user-select: none; }
.um-chart .grid { stroke: var(--rule); }
.um-chart .axis { fill: var(--muted); font-size: 11px; }
.um-chart .curve { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.um-chart .dot { fill: var(--accent); }
.um-chart .handle { cursor: grab; outline: none; }
.um-chart .handle circle { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }
.um-chart .handle:focus circle, .um-chart .handle:hover circle { fill: var(--accent-soft); stroke-width: 4; }
.um-chart .handle-label { fill: var(--text); font-size: 12px; font-weight: 700; }
.um-tag { font-size: 0.7rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--est-bg); color: var(--est-text); vertical-align: middle; }
.um-steps { margin: 4px 0 6px; padding-left: 20px; font-size: 0.88rem; }
.um-steps li { margin: 3px 0; }
.um-register { font-size: 0.85rem; }
.um-register summary { color: var(--accent); cursor: pointer; width: fit-content; }
.um-register ul, .um-register ol { padding-left: 20px; }
.um-status p { margin: 6px 0; font-size: 0.88rem; }
.um-note { color: var(--muted); }
.um-error { color: var(--error); font-weight: 600; }
.usage-meter { margin: 2px 0 0; font-size: 0.9rem; }
/* Meter data more than 30 days old: suggest loading a fresh copy. */
.usage-stale, .um-stale { margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-text); font-size: 0.85rem; }
.um-confirm { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 18px; background: var(--warn-bg); color: var(--warn-text); font-weight: 600; }
.um-confirm[hidden] { display: none; }
.um-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--rule); }
@media (max-width: 560px) {
  .um-options { padding-right: 10px; }
  .um-arrows { flex-basis: 44px; }
  .um-more { left: 58px; right: 10px; }
  .um-arrow { font-size: 0.78rem; letter-spacing: 0.03em; padding: 34px 0;
    clip-path: polygon(50% 0, 100% 28px, 76% 28px, 76% calc(100% - 28px), 100% calc(100% - 28px), 50% 100%, 0 calc(100% - 28px),
      24% calc(100% - 28px), 24% 28px, 0 28px); }
  .um-opt { gap: 8px; padding: 10px 8px; }
  .um-num { font-size: 1.9rem; }
}
.kwh-ticks { font-size: 0.75rem; margin-top: -2px; }
@media (max-width: 420px) { .kwh-ticks { font-size: 0.65rem; } .kwh-ticks button { padding: 2px 1px; } }
.hint { margin: 4px 0 0; font-size: 0.85rem; color: var(--muted); }
/* Estimated usage: every month on wide screens, winter/summer on narrow ones. */
.zip-col .btn { width: 100%; margin-top: 12px; }
/* Estimated usage sits in its own box, colored like the plan list's header. */
.est-usage { display: flex; align-items: flex-start; gap: 10px; margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--thead-bg); }
.est-label { line-height: 1.2; padding-top: 1px; }
.est-cells { flex: 1; display: flex; justify-content: space-between; gap: 4px; }
.est-cell { display: flex; flex-direction: column; align-items: center; line-height: 1.2; font-variant-numeric: tabular-nums; }
.est-cell b { font-weight: 600; color: var(--text); font-size: 0.8rem; }
.est-cell small { font-size: 0.72rem; }
.by-season { display: none; }
@media (max-width: 1000px) { .by-month { display: none; } .by-season { display: flex; } .est-usage { flex-wrap: wrap; gap: 2px 10px; } .est-label { flex-basis: 100%; } }
.plans thead th .unit { text-transform: none; }
.btn { display: inline-block; font: 600 0.95rem/1 inherit; padding: 11px 18px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.small { padding: 8px 12px; font-size: 0.9rem; }
.linkish { background: none; border: 0; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 4px; }

.status { min-height: 1.5em; margin: 6px 0 10px; color: var(--muted); }
.status:empty { min-height: 0; margin: 0; }   /* no message: no gap above the results */
.status.error { color: var(--error); font-weight: 600; }
.notice { background: var(--accent-soft); border-radius: 10px; padding: 14px 18px; margin: 0 0 14px; }
.notice p { margin: 0 0 10px; }
.tdu-options { display: flex; flex-wrap: wrap; gap: 8px; }

/* Results: filters on the left, plans on the right */
.results { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; margin-bottom: 40px; }
.filters { position: sticky; top: 12px; z-index: 10; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 10px 12px; box-shadow: var(--shadow); }
/* Same look as the plan table's column headings. */
.filters-head { display: flex; align-items: center; gap: 12px; margin: -10px -10px 0; padding: 10px 12px;
  background: var(--thead-bg); border-bottom: 1px solid var(--rule); border-radius: 11px 11px 0 0; }
.filters-head .filters-close { margin-left: auto; }
.reset { font: inherit; font-size: 0.85rem; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
.filters h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 0; }
/* Each section gets a line all the way around so the groups stand apart. */
.filters fieldset { border: 1px solid var(--rule); margin: 12px 0 0; padding: 0 8px 8px;
  background: color-mix(in srgb, var(--bg) 40%, var(--surface)); }  /* faint tint of the page colour */
.filters legend { font-weight: 600; font-size: 0.9rem; padding: 0 5px; margin: 0 0 0 -5px; }
/* Options start right under their heading; the space goes above the next heading. */
.filters fieldset > legend + *, .filters fieldset > legend + * > :first-child { margin-top: 0; }
.filters label { display: block; font-size: 0.9rem; margin: 4px 0; }
.filters input[type=range] { width: 100%; accent-color: var(--accent); }
.range-label { margin: 0 0 2px; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

/* Two-handle slider: two range inputs stacked on one drawn track */
.dual { position: relative; height: 26px; }
.dual-track { position: absolute; left: 9px; right: 9px; top: 11px; height: 4px; border-radius: 2px; background: var(--rule); }
.dual-fill { position: absolute; top: 11px; height: 4px; border-radius: 2px; background: var(--accent); }
.dual input[type=range] { position: absolute; inset: 0; width: 100%; height: 26px; margin: 0; background: none;
  -webkit-appearance: none; appearance: none; pointer-events: none; }
.dual input[type=range]::-webkit-slider-runnable-track { background: none; border: 0; height: 26px; }
.dual input[type=range]::-moz-range-track { background: none; border: 0; }
.dual input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; pointer-events: auto; cursor: pointer;
  width: 18px; height: 18px; margin-top: 4px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.dual input[type=range]::-moz-range-thumb { pointer-events: auto; cursor: pointer;
  width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.dual input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.ticks { position: relative; height: 1.5em; font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ticks button { position: absolute; transform: translateX(-50%); font: inherit; color: inherit; background: none; border: 0;
  padding: 2px 3px; border-radius: 4px; cursor: pointer; }
.ticks button:hover, .ticks button:focus-visible { color: var(--accent); background: var(--accent-soft); outline: none; }
.filters select { width: 100%; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--input-bg); color: var(--text); font: inherit; }
.filters-open, .filters-close { display: none; }

.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list-head h2 { margin: 0; font-size: 1.2rem; }
/* The utility on the count line: its name opens the utility modal; the arrow box after it
   (an invisible select over a drawn chevron) switches utility where several serve the zip. */
.tdu-link { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.tdu-menu { position: relative; display: inline-block; width: 1.4em; height: 1.2em; margin-left: 4px; vertical-align: -0.15em;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--input-bg); }
.tdu-menu::after { content: ''; position: absolute; left: 50%; top: 42%; width: 0.36em; height: 0.36em; pointer-events: none;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: translate(-50%, -50%) rotate(45deg); }
.tdu-menu select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 1rem; }
.tdu-menu:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Utility modal's charge history */
.tdu-hist-wrap { overflow-x: auto; }
.tdu-hist { border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.tdu-hist th, .tdu-hist td { padding: 3px 14px 3px 0; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--rule); }
.tdu-hist th { font-weight: 600; color: var(--muted); }
.tdu-hist .num { text-align: right; }
.tdu-hist .up { color: var(--error); }
.tdu-hist .down { color: var(--good); }
.sort { font-size: 0.9rem; color: var(--muted); }
.sort select { margin-left: 6px; padding: 5px 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
.explain { font-size: 0.85rem; color: var(--muted); margin: 6px 0 12px; max-width: 70ch; }

table.plans { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow); }
/* Column headings stay on screen while scrolling the list. */
.plans thead th { position: sticky; top: 0; z-index: 3; background: var(--thead-bg); color: var(--text);
  text-align: center; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.plans thead th.num { text-align: center; }
/* Sortable headings: look like the others, underline on hover, arrow on the current sort. */
.sort-head { font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.sort-head:hover, .sort-head:focus-visible { text-decoration: underline; }
.plans thead th[aria-sort] .sort-head { color: var(--accent); }
.plans thead th[aria-sort="ascending"] .sort-head::after { content: " ▲"; }
.plans thead th[aria-sort="descending"] .sort-head::after { content: " ▼"; }
.plans thead th:first-child { border-top-left-radius: 11px; }
.plans thead th:last-child { border-top-right-radius: 11px; }
.plans tbody:last-child td.extra { border-bottom-left-radius: 11px; }
.plans tbody:last-child td.go { border-bottom-right-radius: 11px; }
.plans td { padding: 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
/* Each plan is two rows: the figures, then its catches and details across the columns. */
.plans tr.main td:not(.go) { border-bottom: 0; padding-bottom: 4px; }
.plans td.extra { padding-top: 0; }
.plans tbody:last-child td { border-bottom: 0; }
/* "Monthly estimates" on the left, what changed lately on the right of the same line. */
.detail-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 4px 16px; flex-wrap: wrap; }
.short-avg { cursor: help; color: var(--muted); margin-left: 1px; }
.dated { margin-top: 6px; font-size: 0.8rem; color: var(--muted); cursor: help; }
.dated-new { color: var(--new); }
.dated-down { color: var(--good); }
.dated-up { color: var(--error); }
.plans .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plans td.mid { text-align: center; }    /* Avg bill, Contract, Cancel fee, Renewable (phones: left, below) */
.plans td small { display: block; color: var(--muted); font-size: 0.8rem; }
.plans .cost strong { font-size: 1.35rem; line-height: 1.1; }
.who { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 0.85rem; color: var(--muted); }
.provider { font-weight: 600; color: var(--text); }
.stars { color: #c98a00; letter-spacing: 1px; }
.name { font-weight: 600; font-size: 1.02rem; margin: 2px 0 6px; }
.term { font-size: 0.9rem; white-space: nowrap; }
.etf { font-size: 0.9rem; min-width: 6em; }
.go { text-align: right; white-space: nowrap; }
.go .efl { display: block; font-size: 0.8rem; margin-top: 6px; }

/* Plan name: opens the plan modal (app.js openPlan). */
.name-link { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.name-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.plan-modal { width: min(760px, calc(100vw - 16px)); }
.pm-titles { flex: 1; min-width: 0; }
.pm-titles .provider { margin: 0; font-size: 0.85rem; }
.plan-modal h2 { margin: 0; font-size: 1.2rem; }
.pm-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 18px 18px; }
.pm-body h3 { margin: 18px 0 6px; font-size: 1rem; }
.pm-facts { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: 5px 14px; margin: 0; font-size: 0.9rem; }
.pm-facts dt { color: var(--muted); }
.pm-facts dd { margin: 0; }
.pm-note { margin: 6px 0; color: var(--muted); font-size: 0.85rem; }
.pm-months { border-collapse: collapse; margin-top: 4px; }
.pm-months th, .pm-months td { padding: 1px 10px 1px 0; font-weight: 400; text-align: left; }
.pm-months td.num { text-align: right; }
.pm-changes { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.pm-changes > li { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.pm-changes > li:last-child { border-bottom: 0; }
.pm-changes ul { margin: 2px 0 0; padding-left: 20px; color: var(--text); }
.plan-modal .um-foot .btn { text-decoration: none; }
@media (max-width: 560px) { .pm-facts { grid-template-columns: 1fr; gap: 0; } .pm-facts dd { margin-bottom: 6px; } }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { font-size: 0.75rem; line-height: 1.4; padding: 1px 7px; border-radius: 999px; cursor: help; }
.badge.tag { background: var(--tag-bg); color: var(--tag-text); }
.badge.est { background: var(--est-bg); color: var(--est-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.breakdown { margin-top: 6px; font-size: 0.85rem; }
.breakdown summary { color: var(--accent); cursor: pointer; width: fit-content; }
.breakdown table { border-collapse: collapse; margin-top: 4px; }
.breakdown th, .breakdown td { padding: 1px 10px 1px 0; font-weight: 400; text-align: left; }
.breakdown td.num { text-align: right; }
.more { text-align: center; margin: 16px 0; }

.bottom { border-top: 1px solid var(--rule); background: var(--surface); color: var(--muted); font-size: 0.85rem; }
.bottom .wrap { padding-top: 18px; padding-bottom: 28px; }
.bottom p { margin: 0; max-width: 90ch; }

/* Tablets: narrower filter column */
@media (max-width: 1000px) {
  .results { grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
  .plans th:nth-child(6), .plans td:nth-child(6) { display: none; }
}

/* Phones: cards, and filters in a slide-out panel */
@media (max-width: 760px) {
  .lookup { grid-template-columns: 1fr; }
  .lookup .btn { width: 100%; }
  .results { grid-template-columns: 1fr; }
  .filters-open { display: inline-block; justify-self: start; }
  .filters { position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); z-index: 20; overflow-y: auto; border-radius: 0;
    transform: translateX(-105%); transition: transform 0.2s ease; }
  .filters-shown .filters { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35); }
  .filters-close { display: block; }
  .filters-head { border-radius: 0; }
  table.plans, .plans thead, .plans td { display: block; width: 100%; }
  table.plans { background: none; border: 0; box-shadow: none; }
  .plans thead { display: none; }
  .plans tbody { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; margin-bottom: 12px; padding: 4px 0; display: grid; grid-template-columns: 1fr 1fr; }
  .plans tr { display: contents; }
  .plans td, .plans tr.main td:not(.go), .plans td.extra { border: 0; padding: 6px 14px; border-radius: 0; }
  .plans td.plan, .plans td.go, .plans td.extra { grid-column: 1 / -1; }
  /* Card order: plan, its catches and details, the figures, then Sign up. */
  .plans td.plan { order: 0; } .plans td.extra { order: 1; } .plans td { order: 2; } .plans td.go { order: 3; }
  .plans td.num, .plans td.term, .plans td.etf { text-align: left; }
  .plans td.cost::before { text-transform: none !important; }
  .plans td[data-label]::before { content: attr(data-label); display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
  .plans th:nth-child(6), .plans td:nth-child(6) { display: block; }
  .go { text-align: left; display: flex; align-items: center; gap: 14px; }
  .go .efl { display: inline; margin: 0; }
}

/* Explanations: shown on hover, tap or keyboard focus */
.tip { position: relative; cursor: help; }
.filters .tip { border-bottom: 1px dotted var(--muted); }
.tip:hover::after, .tip:focus::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 30;
  width: max-content; max-width: min(280px, 80vw); padding: 8px 10px; border-radius: 8px;
  background: var(--tip-bg); color: var(--tip-text); font: 400 0.8rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-transform: none; letter-spacing: normal; white-space: normal; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); pointer-events: none; }
.tip:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tip-right:hover::after, .tip-right:focus::after { left: auto; right: 0; }    /* at the right edge: open leftward */
