/* AffiliateEngine base design system. Sites override the custom properties in their theme. Each block of light
   colours (here, the charts' below and the theme's, engine/build.mjs) also names :root.embed: embeds (layout 'embed',
   shown inside other sites' pages) keep them over the dark-mode colours, which name :root alone. */
:root, :root.embed {
  --accent: #0b6e4f;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3ec;
  --cta: #d9480f;
  --cta-ink: #ffffff;
  --bg: #fbfbf9;
  --surface: #ffffff;
  --surface-2: #f2f3f0;
  --text: #1c2321;
  --muted: #5b6662;
  --border: #dde1dc;
  --good: #1e7b34;
  --warn: #9a6100;
  --bad: #b42318;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --max: 1120px;
  --prose: 720px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --link: var(--accent);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615; --surface: #1a1f1e; --surface-2: #222827; --text: #e7ecea; --muted: #a2aeaa;
    --border: #313937; --accent-soft: #17332a; --shadow: 0 1px 2px rgba(0,0,0,.4);
    --good: #5cc278; --warn: #e0a84a; --bad: #f07a6e; --link: #6fd3ad;
  }
}
:root.embed { color-scheme: light; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--text); background: var(--bg); }
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-top: .4em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); }
h3 { font-size: 1.15rem; }
p, ul, ol { margin: 0 0 1em; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
[hidden] { display: none !important; } /* also over a class's own display (a .btn shown only once a script runs) */
.skip { position: absolute; left: -999px; }
.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:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.prose { max-width: var(--prose); }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-top: 10px; padding-bottom: 10px; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: .9rem; }
.site-nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: .95rem; }
.site-nav a { color: var(--text); text-decoration: none; padding: 4px 0; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--link); text-decoration: underline; }
main { padding: 8px 0 48px; }
.crumbs { font-size: .85rem; color: var(--muted); margin: 14px 0 0; }
.crumbs a { color: var(--muted); }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: var(--prose); }
.disclosure { font-size: .82rem; color: var(--muted); border-left: 3px solid var(--border); padding: 2px 10px; margin: 0 0 20px; max-width: var(--prose); }
.updated { font-size: .85rem; color: var(--muted); }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); font-size: .9rem; color: var(--muted); padding: 28px 0 40px; }
.site-footer a { color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 0 0 12px; }

/* Buttons & calls to action */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 44px; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-cta { background: var(--cta); color: var(--cta-ink); border-color: var(--cta); }
.btn-cta:hover { filter: brightness(1.08); border-color: var(--cta); }
.btn-sm { padding: 6px 10px; min-height: 36px; font-size: .9rem; }
.btn-block { width: 100%; }
.ext::after { content: "↗"; font-size: .8em; opacity: .8; }

/* Cards & grids */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover { border-color: var(--accent); }
.kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; font-weight: 700; color: var(--link); }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 14px 18px; margin: 18px 0; max-width: var(--prose); }
.callout.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.good { color: var(--good); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 12px 0 20px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }
tbody th { font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
table.sticky-first tbody th, table.sticky-first thead th:first-child { position: sticky; left: 0; z-index: 1; }
table.sticky-first tbody th { background: var(--surface); }
table.sticky-first thead th:first-child { background: var(--surface-2); z-index: 2; }
.table-wrap caption { caption-side: bottom; padding: 8px 12px; text-align: left; font-size: .82rem; color: var(--muted); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]::after { content: " ↕"; opacity: .35; }
th[aria-sort="ascending"]::after { content: " ↑"; opacity: 1; }
th[aria-sort="descending"]::after { content: " ↓"; opacity: 1; }
tr[hidden] { display: none; }
tbody tr:target, table.sticky-first tbody tr:target th { background: var(--accent-soft); }

/* Tools / forms */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin: 18px 0; }
.tool-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .tool-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label, .field .label { font-weight: 600; font-size: .92rem; }
.field .hint { font-size: .8rem; color: var(--muted); }
input[type="number"], input[type="text"], input[type="search"], select { font: inherit; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); min-height: 44px; width: 100%; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.inline-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; align-items: end; }
.result-big { font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; min-width: 120px; }
.stat b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--muted); }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.pill-list button { font: inherit; font-size: .88rem; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; min-height: 36px; }
.pill-list button:hover { border-color: var(--accent); }
.pill-list button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Product rows (tool results) */
.match { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.match:last-child { border-bottom: 0; }
.match h3 { margin: 0; font-size: 1rem; }
.match .meta { font-size: .85rem; color: var(--muted); }
@media (max-width: 560px) { .match { grid-template-columns: 1fr; } }

/* FAQ (answers always visible) */
.faq { border-bottom: 1px solid var(--border); padding: 10px 0; max-width: var(--prose); }
.faq h3 { margin: 0; font-size: 1rem; }
.faq p { margin: 6px 0 0; }

.sources { font-size: .82rem; color: var(--muted); }
.sources a { color: var(--muted); overflow-wrap: anywhere; }
.spec-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.spec-list dt { font-weight: 600; }
.spec-list dd { margin: 0; font-variant-numeric: tabular-nums; }
.two-col { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .two-col { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.hero { padding: 28px 0 8px; }
.hero .lede { font-size: 1.2rem; }
.noscript { background: color-mix(in srgb, var(--warn) 14%, transparent); padding: 10px 14px; border-radius: 8px; }
textarea { font: .85rem/1.45 var(--mono); padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; resize: vertical; }

/* Printing: the page's own content on light paper, with the site's name and plain address (the header's brand and
   .print-host), the disclosure line, the dates and the footer's notes. Navigation, buttons (every call to action,
   including the A/B-tested ones), embed code boxes and anything marked .no-print stay off the paper; .print-only
   elements appear only there. (html:root outranks the theme's dark-mode colours, which come later.) */
.print-only { display: none; }
@media print {
  html:root { --bg: #fff; --surface: #fff; --surface-2: #f2f2f2; --text: #111; --muted: #444; --border: #bbb; --link: #111; --accent-soft: #fff; --shadow: none; color-scheme: light; }
  @page { margin: 10mm; }
  html { font-size: 12px; } /* rem-sized text (.small, .meta, .disclosure) shrinks with it */
  body { font-size: 9.5pt; line-height: 1.35; }
  .print-only { display: revert; }
  .skip, .site-nav, .crumbs, .footer-links, .btn, button, .no-print, .embed-box, .ae-table-view { display: none !important; }
  .site-header, .site-footer { background: none; border: 0; padding: 0; }
  .site-header .wrap { padding: 0 0 4px; border-bottom: 1px solid var(--border); justify-content: space-between; }
  .brand-mark { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-host { font-weight: 600; }
  .wrap { max-width: none; padding: 0; }
  main { padding: 0; }
  .site-footer { font-size: 8pt; padding-top: 6px; }
  .site-footer p { margin: 0 0 2px; }
  h1 { font-size: 15pt; margin: 6px 0 4px; }
  .tool, .card, .callout { box-shadow: none; }
  .disclosure { margin-bottom: 6px; }
  a { text-decoration: none; }
}

/* Embeds (layout 'embed'): a page shown inside another site's iframe, so no page chrome: a plain surface, small
   margins, and a one-line disclosure with a Privacy link at the bottom */
body.embed { background: var(--surface); }
body.embed main { padding: 12px 14px 10px; }
body.embed h1 { font-size: 1.35rem; margin: 0 0 6px; }
.embed-foot { font-size: .78rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; margin: 12px 0 0; }
.embed-foot a { color: var(--muted); }

/* Charts (engine/assets/charts.js). Categorical slots validated with the dataviz
   validator against the site surfaces (#ffffff light, #1a1f1e dark): all checks pass;
   light slots 3-4 are under 3:1 contrast, so charts always ship direct labels or a table view. */
:root, :root.embed { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --chart-grid: #e1e0d9; --chart-base: #c3c2b7; --chart-muted: #6b6a65; }
@media (prefers-color-scheme: dark) {
  :root { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --chart-grid: #2c2c2a; --chart-base: #383835; --chart-muted: #a19f97; }
}
.ae-chart { margin: 12px 0 20px; }
.ae-plot { position: relative; }
.ae-plot svg { display: block; overflow: visible; }
.ae-grid { stroke: var(--chart-grid); stroke-width: 1; }
.ae-base { stroke: var(--chart-base); stroke-width: 1; }
.ae-tick { fill: var(--chart-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ae-axis-label { fill: var(--chart-muted); font-size: 12px; }
.ae-end-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.ae-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ae-dot { stroke: var(--surface); stroke-width: 2; }
.ae-line.s1 { stroke: var(--series-1); } .ae-dot.s1 { fill: var(--series-1); }
.ae-line.s2 { stroke: var(--series-2); } .ae-dot.s2 { fill: var(--series-2); }
.ae-line.s3 { stroke: var(--series-3); } .ae-dot.s3 { fill: var(--series-3); }
.ae-line.s4 { stroke: var(--series-4); } .ae-dot.s4 { fill: var(--series-4); }
.ae-cross { stroke: var(--chart-base); stroke-width: 1; }
.ae-legend { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; color: var(--muted); }
.ae-legend li { display: flex; align-items: center; gap: 6px; }
.ae-key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; vertical-align: middle; }
.ae-key.s1 { background: var(--series-1); } .ae-key.s2 { background: var(--series-2); }
.ae-key.s3 { background: var(--series-3); } .ae-key.s4 { background: var(--series-4); }
.ae-tip { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px; font-size: .85rem; pointer-events: none; min-width: 150px; z-index: 3; }
.ae-tip-head { color: var(--muted); margin-bottom: 4px; }
.ae-tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ae-tip-row strong { font-variant-numeric: tabular-nums; }
.ae-table-view summary { cursor: pointer; font-size: .88rem; color: var(--muted); }

:root,:root.embed{--accent:#9a3412;--accent-soft:#fbeee6;--cta:#1d4ed8}
@media (prefers-color-scheme: dark){:root{--accent:#e07a3f;--accent-soft:#3a2214;--cta:#3b6fe0;--link:#f2a374}}

/* Backup Power Check: the planner's form and results (engine/assets/base.css does the rest) */
.planner-form { display: grid; gap: 14px; }
.pl-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 6px; margin: 0; }
.pl-group legend { font-weight: 700; padding: 0 6px; }
.pl-row { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem 7.5rem; gap: 4px 12px; align-items: end; padding: 6px 0; border-top: 1px solid var(--border); }
.pl-group legend + .pl-row, .pl-group .pl-row:first-of-type { border-top: 0; }
.pl-row .check { align-items: flex-start; }
.pl-row .check input { margin-top: 4px; flex: none; }
.pl-row .hint, .pl-custom .hint, .planner .hint { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }
.pl-row .field, .pl-custom .field { margin-bottom: 0; font-size: .85rem; }
.pl-row .pl-cycle { align-self: center; grid-column: span 1; }
.field.sm input { width: 100%; }
.pl-options { max-width: 34rem; }
.planner-results { margin-top: 18px; }
.planner-results h3 { margin-top: 22px; }
.planner-results details { margin: 14px 0; }
.planner-results summary { cursor: pointer; font-weight: 600; }
.planner-results td .hint { display: block; }
a.src { font-size: .75rem; color: var(--muted); margin-left: 4px; }
@media (max-width: 640px) {
  .pl-row { grid-template-columns: 1fr 1fr; }
  .pl-row .check { grid-column: 1 / -1; }
  .result-big { font-size: 1.5rem; }
}
@media print {
  .planner-form, .btn-cta { display: none !important; }
}
.pl-more > summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.pl-more[open] > summary { margin-bottom: 10px; }
.pl-more .pl-group + .pl-group { margin-top: 12px; }
/* how many / hours only for ticked appliances (browsers without :has show them all) */
.pl-row:not(:has(> .check input:checked)) > .field, .pl-row:not(:has(> .check input:checked)) > .pl-cycle { display: none; }
.pl-row:not(:has(> .check input:checked)) { padding: 2px 0; }

