/* SolarPortCheck — field multimeter: warm sand ground, graphite bands, PV amber
   marks, monospaced readouts, PASS / MARGINAL / DANGER badges. Flat surfaces,
   tight corners, no gradients, no webfonts. Light and dark are both first-class. */

:root {
  color-scheme: light dark;
  --bg: #f3f2ee;
  --surface: #ffffff;
  --panel: #eae8e1;
  --ink: #16181b;
  --ink-soft: #3b4046;
  --muted: #5c636a;
  --line: #cfccc2;
  --line-soft: #e2dfd6;
  --slate: #181c20;
  --slate-2: #23292f;
  --on-slate: #eef0f2;
  --on-slate-soft: #a2acb6;
  --accent: #d97706;
  --accent-ink: #b45309;
  --accent-bg: #fef3c7;
  --ok-ink: #15803d;
  --ok-bg: #dcfce7;
  --ok-line: #16a34a;
  --warn-ink: #b45309;
  --warn-bg: #fef3c7;
  --warn-line: #d97706;
  --err-ink: #b91c1c;
  --err-bg: #fee2e2;
  --err-line: #dc2626;
  --radius: 4px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1215;
  --surface: #161a1f;
  --panel: #1d2229;
  --ink: #ebedf0;
  --ink-soft: #b4bac2;
  --muted: #88919b;
  --line: #2d343e;
  --line-soft: #232a32;
  --slate: #0a0d0f;
  --slate-2: #171d23;
  --on-slate: #eef0f2;
  --on-slate-soft: #98a2ac;
  --accent: #f59e0b;
  --accent-ink: #fbbf24;
  --accent-bg: #2b2110;
  --ok-ink: #7ee2a8;
  --ok-bg: #10261a;
  --ok-line: #22c55e;
  --warn-ink: #fbbf24;
  --warn-bg: #2b2110;
  --warn-line: #f59e0b;
  --err-ink: #fca5a5;
  --err-bg: #2c1414;
  --err-line: #ef4444;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1215;
    --surface: #161a1f;
    --panel: #1d2229;
    --ink: #ebedf0;
    --ink-soft: #b4bac2;
    --muted: #88919b;
    --line: #2d343e;
    --line-soft: #232a32;
    --slate: #0a0d0f;
    --slate-2: #171d23;
    --on-slate: #eef0f2;
    --on-slate-soft: #98a2ac;
    --accent: #f59e0b;
    --accent-ink: #fbbf24;
    --accent-bg: #2b2110;
    --ok-ink: #7ee2a8;
    --ok-bg: #10261a;
    --ok-line: #22c55e;
    --warn-ink: #fbbf24;
    --warn-bg: #2b2110;
    --warn-line: #f59e0b;
    --err-ink: #fca5a5;
    --err-bg: #2c1414;
    --err-line: #ef4444;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

a {
  color: var(--ink); text-decoration: underline;
  text-decoration-color: var(--accent); text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--accent-ink); }

.skip {
  position: absolute; left: 0.75rem; top: -10rem; z-index: 30;
  background: var(--surface); color: var(--ink); padding: 0.5rem 0.9rem;
  border: 2px solid var(--accent); border-radius: var(--radius);
}
.skip:focus { top: 0.75rem; }

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

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.5rem; padding-top: 0.6rem; padding-bottom: 0.6rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none;
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em;
}
.brand svg { border-radius: 5px; flex: none; }
.brand b { color: var(--accent-ink); font-weight: 700; }
.site-header nav { display: flex; gap: 0.15rem; flex-wrap: wrap; font-size: 0.92rem; }
.site-header nav a {
  color: var(--ink-soft); text-decoration: none;
  padding: 0.4rem 0.7rem; border-radius: var(--radius); font-weight: 500;
  border: 1px solid transparent;
}
.site-header nav a:hover { color: var(--ink); background: var(--panel); }
.site-header nav a[aria-current] {
  color: var(--ink); font-weight: 650;
  border-color: var(--line); background: var(--panel);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; margin-left: 0.25rem; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--ink); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.site-header .nav-row { display: flex; align-items: center; gap: 0.15rem; flex-wrap: wrap; }

/* ---------- page head: instrument faceplate ---------- */
main { padding-top: 1.5rem; padding-bottom: 2rem; }

.page-head {
  position: relative; overflow: hidden;
  margin: 0 0 1.75rem; padding: 2.3rem 2.2rem 2rem;
  border-radius: var(--radius);
  background-color: var(--slate);
  color: var(--on-slate);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 130'%3E%3Crect x='26' y='30' width='248' height='72' rx='4' fill='none' stroke='%23f59e0b' stroke-width='2.4'/%3E%3Ccircle cx='118' cy='66' r='9' fill='none' stroke='%23f59e0b' stroke-width='2.4'/%3E%3Ccircle cx='182' cy='66' r='9' fill='none' stroke='%23f59e0b' stroke-width='2.4'/%3E%3Cpath d='M118 57v-7M182 57v-7' stroke='%23eef0f2' stroke-width='2'/%3E%3Cpath d='M92 102h116' stroke='%23eef0f2' stroke-width='2'/%3E%3Ctext x='196' y='26' font-family='monospace' font-size='11' fill='%23a2acb6'%3EVOC%3C/text%3E%3C/svg%3E"),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-repeat: no-repeat, repeat, repeat;
  background-size: 280px auto, 24px 24px, 24px 24px;
  background-position: right 1.6rem bottom 1.1rem, 0 0, 0 0;
}
.page-head h1 {
  margin: 0 0 0.75rem; max-width: 22ch;
  font-size: clamp(1.85rem, 1.15rem + 2.5vw, 2.75rem); line-height: 1.07;
  letter-spacing: -0.035em; font-weight: 750; color: var(--on-slate);
}
.page-head .lead {
  margin: 0; max-width: 62ch; color: var(--on-slate-soft); font-size: 1.04rem;
}
.page-head .lead a { color: var(--on-slate); }

h2 {
  margin: 2.5rem 0 0.75rem; font-size: 1.46rem; line-height: 1.26;
  letter-spacing: -0.025em; font-weight: 720;
}
h3 { margin: 1.4rem 0 0.35rem; font-size: 1.06rem; font-weight: 680; letter-spacing: -0.01em; }

/* The prose column is wide enough for a seven-column readout table but the text
   inside it is capped at a comfortable measure, so a long paragraph does not run
   the full width of a desktop screen. */
.prose { max-width: 1000px; }
.prose p, .prose ul, .prose ol, .prose li, .prose h3 { max-width: 76ch; }
.prose > h2:first-child { margin-top: 2.1rem; }
.prose h2 { padding-top: 0.9rem; border-top: 1px solid var(--line); }
.prose h2::before {
  content: ""; display: block; width: 2.25rem; height: 3px;
  margin: -0.95rem 0 0.8rem; background: var(--accent);
}
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1.15rem; padding-left: 1.3rem; }
.prose li { margin: 0.35rem 0; }
.prose li::marker { color: var(--accent-ink); }
.prose b { font-weight: 680; }
.prose .table-scroll { max-width: none; }
.prose code, .prose kbd {
  font-family: var(--mono); font-size: 0.9em;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 3px; padding: 0.05em 0.32em;
}

.disclaimer {
  margin: 2.2rem 0 0; padding: 1rem 1.15rem;
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--surface); border-radius: var(--radius);
  font-size: 0.94rem; color: var(--ink-soft);
}

/* ---------- presets ---------- */
.presets {
  margin: 0 0 1.25rem; padding: 1.15rem 1.3rem 1.2rem;
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); background: var(--surface);
}
.presets-kicker {
  margin: 0 0 0.85rem; font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink);
}
.preset-grid {
  display: grid; gap: 1rem 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.preset label {
  display: block; font-size: 0.86rem; font-weight: 650; margin-bottom: 0.35rem;
}
.preset select {
  width: 100%; font: 600 0.92rem/1.3 var(--mono); color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.62rem 0.7rem; cursor: pointer;
}
.preset select:hover { border-color: var(--muted); }
.preset select:focus-visible { border-color: var(--accent); }
.preset-hint {
  margin: 0.45rem 0 0; font: 400 0.78rem/1.5 var(--sans); color: var(--muted);
}

/* ---------- calculator ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.calc { margin: 0 0 2rem; padding: 1.5rem 1.6rem 1.35rem; }
.calc h2 {
  margin: 0 0 1.1rem; font-size: 0.78rem; font-weight: 700;
  font-family: var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 0.6rem;
}
.calc h2::before {
  content: ""; width: 0.6rem; height: 0.6rem; flex: none;
  background: var(--accent); border-radius: 1px;
}
.calc-grid {
  display: grid; gap: 1rem 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
}
.calc-grid label {
  display: flex; flex-direction: column; gap: 0.32rem;
  font-size: 0.88rem; font-weight: 600; color: var(--ink);
}
.calc-grid .field {
  display: flex; align-items: stretch; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel); overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.calc-grid .field:hover { border-color: var(--muted); }
.calc-grid .field:focus-within {
  border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.calc-grid input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: 600 1.1rem/1 var(--mono); padding: 0.72rem 0.78rem;
  font-variant-numeric: tabular-nums;
}
.calc-grid input:focus { outline: none; }
.calc-grid .unit {
  display: flex; align-items: center; padding: 0 0.7rem;
  font: 500 0.76rem/1 var(--mono); color: var(--muted);
  border-left: 1px solid var(--line);
}
.calc-grid .hint {
  font-size: 0.77rem; font-weight: 400; color: var(--muted); line-height: 1.45;
}

/* ---------- status banner: the readout that decides everything ---------- */
.status {
  display: grid; grid-template-columns: auto 1fr; gap: 0.85rem;
  align-items: start;
  margin: 1.5rem 0 0; padding: 0.95rem 1.1rem;
  border: 1px solid var(--line); border-left: 4px solid var(--muted);
  border-radius: var(--radius); background: var(--panel);
  transition: background-color 0.15s, border-color 0.15s;
}
.status-led {
  width: 0.72rem; height: 0.72rem; border-radius: 50%; margin-top: 0.42rem;
  background: var(--muted); box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted) 22%, transparent);
  flex: none;
}
.status-headline {
  margin: 0; font: 650 0.98rem/1.4 var(--mono);
  letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.status-detail {
  margin: 0.4rem 0 0; font-size: 0.87rem; line-height: 1.6; color: var(--ink-soft);
}
.status-detail:empty { display: none; }

.status[data-state="SAFE"],
.status[data-state="UNLOCKED"] {
  background: var(--ok-bg); border-color: var(--ok-line); border-left-color: var(--ok-line);
}
.status[data-state="SAFE"] .status-led,
.status[data-state="UNLOCKED"] .status-led {
  background: var(--ok-line); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok-line) 24%, transparent);
}
.status[data-state="SAFE"] .status-headline,
.status[data-state="UNLOCKED"] .status-headline { color: var(--ok-ink); }

.status[data-state="WARNING"],
.status[data-state="MARGINAL"],
.status[data-state="CLIPPED"],
.status[data-state="LIMITED"] {
  background: var(--warn-bg); border-color: var(--warn-line); border-left-color: var(--warn-line);
}
.status[data-state="WARNING"] .status-led,
.status[data-state="MARGINAL"] .status-led,
.status[data-state="CLIPPED"] .status-led,
.status[data-state="LIMITED"] .status-led {
  background: var(--warn-line); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn-line) 26%, transparent);
}
.status[data-state="WARNING"] .status-headline,
.status[data-state="MARGINAL"] .status-headline,
.status[data-state="CLIPPED"] .status-headline,
.status[data-state="LIMITED"] .status-headline { color: var(--warn-ink); }

.status[data-state="DANGER"] {
  background: var(--err-bg); border-color: var(--err-line); border-left-color: var(--err-line);
}
.status[data-state="DANGER"] .status-led {
  background: var(--err-line); box-shadow: 0 0 0 4px color-mix(in srgb, var(--err-line) 26%, transparent);
}
.status[data-state="DANGER"] .status-headline { color: var(--err-ink); }

/* ---------- readouts ---------- */
.calc-result {
  display: grid; gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
  margin: 1.35rem 0 0; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.out {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.72rem 0.9rem; background: var(--surface);
  box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line);
}
.out-primary {
  grid-column: span 2; background: var(--slate); color: var(--on-slate);
  box-shadow: inset 4px 0 0 var(--accent), 1px 0 0 var(--line), 0 1px 0 var(--line);
}
.out-label {
  font: 600 0.68rem/1.3 var(--mono); letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.out-primary .out-label { color: var(--on-slate-soft); }
.out-value { display: flex; align-items: baseline; gap: 0.32rem; }
.out-value b {
  font: 650 1.28rem/1.2 var(--mono); color: var(--ink);
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.out-primary .out-value b { font-size: 2.2rem; color: var(--on-slate); }
.out-value i { font: 500 0.76rem/1 var(--mono); color: var(--muted); font-style: normal; }
.out-primary .out-value i { color: var(--accent); }

.calc-error {
  margin: 0.9rem 0 0; padding: 0.65rem 0.8rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--err-line) 12%, transparent);
  border-left: 3px solid var(--err-line);
  color: var(--err-ink); font-size: 0.9rem; font-weight: 600;
}
.calc-note {
  margin: 1rem 0 0; font-size: 0.85rem; line-height: 1.58; color: var(--muted);
  max-width: 82ch;
}
.calc-note b { color: var(--ink-soft); }

/* ---------- tables ---------- */
.table-scroll {
  margin: 1.3rem 0; overflow-x: auto; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
caption {
  caption-side: top; text-align: left; padding: 0.8rem 0.95rem;
  font-size: 0.85rem; line-height: 1.55; color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}
th, td {
  padding: 0.52rem 0.9rem; text-align: right;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 0.885rem;
}
thead th {
  background: var(--slate); color: var(--on-slate-soft);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; white-space: nowrap; border-bottom: 0;
}
thead th:first-child, tbody th { text-align: left; }
tbody th { font-weight: 650; color: var(--ink); white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--accent-bg); }

/* ---------- faq ---------- */
.faq { margin: 3rem 0 0; max-width: 76ch; }
.faq details { border-bottom: 1px solid var(--line); padding: 0.9rem 0; }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
  cursor: pointer; font-weight: 650; font-size: 1.01rem;
  list-style: none; display: flex; gap: 0.75rem; align-items: baseline;
}
.faq summary:hover { color: var(--accent-ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+"; font-family: var(--mono); font-weight: 700;
  color: var(--accent-ink); flex: none; width: 1ch;
}
.faq details[open] summary::before { content: "\2212"; }
.faq-body { padding: 0.55rem 0 0.2rem 1.75ch; color: var(--ink-soft); }

/* ---------- index cards ---------- */
.tool-grid {
  list-style: none; padding: 0; margin: 1rem 0 2rem;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.tool-card {
  display: flex; flex-direction: column; gap: 0.45rem; height: 100%;
  padding: 1.25rem 1.3rem; border-radius: var(--radius); text-decoration: none;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-top: 3px solid var(--accent);
  transition: border-color 0.15s;
}
.tool-card:hover { border-color: var(--accent); color: var(--ink); }
.tool-kind {
  font: 600 0.68rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-ink);
}
.tool-card h3 { margin: 0.15rem 0; font-size: 1.14rem; letter-spacing: -0.02em; }
.tool-card p { margin: 0; font-size: 0.92rem; color: var(--ink-soft); flex: 1; }
.tool-go { font: 600 0.8rem/1 var(--mono); color: var(--ink); margin-top: 0.4rem; }
.tool-card:hover .tool-go { color: var(--accent-ink); }

/* ---------- wiring sheet ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sheet {
  margin: 0 0 2rem; padding: 1.5rem 1.6rem 1.35rem;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.sheet-head {
  display: flex; flex-wrap: wrap; gap: 1rem 1.5rem;
  align-items: flex-start; justify-content: space-between;
}
.sheet-head > div:first-child { min-width: 0; }
.sheet-kicker {
  margin: 0 0 0.35rem; font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink);
}
.sheet h2 { margin: 0; font-size: 1.3rem; letter-spacing: -0.02em; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn {
  font: 600 0.8rem/1 var(--mono); letter-spacing: 0.02em;
  padding: 0.62rem 0.92rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  cursor: pointer; transition: border-color 0.12s ease, color 0.12s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-solid { background: var(--slate); border-color: var(--slate); color: var(--on-slate); }
.btn-solid:hover { background: var(--slate-2); border-color: var(--accent); color: var(--on-slate); }
.sheet-meta {
  margin: 0.9rem 0 1rem; padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  font: 500 0.8rem/1.55 var(--mono); color: var(--muted);
}
.sheet .table-scroll { margin: 0 0 0.9rem; }
.sheet-table td.sheet-note-cell {
  text-align: left; font-family: var(--sans); font-size: 0.82rem;
  color: var(--muted); white-space: normal;
}
.sheet-note {
  margin: 0; max-width: 84ch; font-size: 0.84rem; line-height: 1.6; color: var(--ink-soft);
}

/* Printing is the point of the sheet: on paper only the sheet exists, with the
   site name as its letterhead, so 15 inputs print as one clean packing list. */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --panel: #fff; --ink: #000; --ink-soft: #222;
    --muted: #444; --line: #999; --line-soft: #ccc; --slate: #000;
  }
  .site-header, .site-footer, .page-head, .calc, .presets, .prose, .faq, .skip,
  .tool-grid, .sheet-actions, .disclaimer, .status { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .sheet { border: 0; border-radius: 0; padding: 0; margin: 0; }
  .sheet::before {
    content: "SolarPortCheck · solarportcheck.com";
    display: block; margin-bottom: 1rem; padding-bottom: 0.5rem;
    border-bottom: 2px solid #000;
    font: 700 0.8rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  }
  .sheet h2 { font-size: 1.12rem; }
  .sheet-meta { color: #222; }
  .sheet-table { font-size: 0.84rem; }
  .sheet-table thead th { background: #fff; color: #000; border-bottom: 1px solid #000; }
  .sheet-table th, .sheet-table td { border-bottom: 1px solid #ccc; }
  .sheet-table tbody tr:hover { background: transparent; }
  .sheet-note { color: #333; }
  a[href]::after { content: ""; }
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: 4rem; padding: 2.1rem 0 2.3rem;
  background: var(--slate); color: var(--on-slate-soft);
  border-top: 3px solid var(--accent);
  font-size: 0.89rem;
}
.site-footer p { margin: 0 0 0.7rem; max-width: 78ch; }
.site-footer .footer-brand { color: var(--on-slate); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; margin: 0 0 0.9rem; }
.site-footer nav a { color: var(--on-slate); text-decoration: none; }
.site-footer nav a:hover { color: var(--accent); text-decoration: underline; }
.site-footer .footer-note { font-size: 0.79rem; line-height: 1.62; }

@media (max-width: 780px) {
  .page-head {
    background-size: 180px auto, 24px 24px, 24px 24px;
    background-position: right 1rem bottom 0.9rem, 0 0, 0 0;
    padding-bottom: 6.4rem;
  }
}
@media (max-width: 660px) {
  .site-header .wrap { position: relative; }
  .theme-toggle { position: absolute; right: 1rem; top: 0.55rem; margin: 0; }
  body { font-size: 1rem; }
  .wrap { padding: 0 1rem; }
  .page-head { padding: 1.6rem 1.2rem 5.8rem; }
  .calc { padding: 1.2rem 1.05rem 1.05rem; }
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .calc-result { grid-template-columns: 1fr 1fr; }
  .out-primary { grid-column: 1 / -1; }
  .out-primary .out-value b { font-size: 1.85rem; }
  .site-header nav { font-size: 0.86rem; }
  .site-header nav a { padding: 0.34rem 0.5rem; }
  th, td { padding: 0.48rem 0.55rem; font-size: 0.82rem; }
  tbody th { white-space: normal; }
}
@media (max-width: 420px) {
  .calc-grid { grid-template-columns: 1fr; }
}

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