:root {
  color-scheme: light;
  --ink: #163c36;
  --body: #233c37;
  --muted: #5c6b64;
  --line: #d8ded6;
  --paper: #f3f5ee;
  --accent: #c6ec8a;
  --green: #306b56;
  --orange: #c47736;
  --slate: #687e82;
  --gap: 20px;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--body);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
a,
summary,
select,
input[type="checkbox"] {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible,
select:focus-visible {
  outline: 3px solid #70a965;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.sr-only,
.skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 3;
  background: white;
  padding: 10px;
  color: var(--ink);
}
.frame {
  width: min(1300px, calc(100% - 80px));
  margin: 0 auto;
}
.topbar {
  background: #fbfcf7;
  border-bottom: 1px solid var(--line);
}
.bar-inner,
.bar-actions,
.brand,
.unit-switch,
.page-heading,
.panel-title,
.duty-header,
.breakdown-row,
.chart-key,
.chart-key > span,
.card-heading,
.footer,
.dialog-head {
  display: flex;
  align-items: center;
}
.bar-inner {
  height: 69px;
  justify-content: space-between;
}
.brand {
  font-size: 23px;
  color: var(--ink);
  font-weight: 760;
  letter-spacing: -1.4px;
  text-decoration: none;
  line-height: 1;
}
.brand-light {
  font-weight: 500;
}
.brand-symbol {
  width: 33px;
  height: 33px;
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--ink);
  margin-right: 10px;
  overflow: hidden;
}
.brand-symbol i {
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 3px;
  transform: skew(-15deg);
}
.brand-symbol i:first-child {
  height: 12px;
  margin-top: 6px;
}
.brand-symbol i:last-child {
  height: 12px;
  margin-bottom: 6px;
}
.bar-actions {
  gap: 18px;
}
.bar-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}
.method-button,
.subtle {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
}
.method-button span,
.subtle span {
  font-size: 17px;
  vertical-align: -1px;
  margin-right: 3px;
}
.method-button:hover,
.subtle:hover {
  text-decoration: underline;
  color: var(--ink);
}
.unit-switch {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eff2e9;
  gap: 2px;
}
.unit-switch button {
  border: none;
  padding: 3px 10px;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  min-height: 26px;
}
.unit-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}
.page-heading {
  justify-content: space-between;
  align-items: flex-end;
  padding: 33px 0 25px;
  gap: 16px;
}
h1,
h2,
h3,
p,
dl {
  margin: 0;
}
h1 {
  font-size: clamp(30px, 3.1vw, 44px);
  font-weight: 610;
  letter-spacing: -0.057em;
  line-height: 1.1;
  color: var(--ink);
}
.page-heading p,
.card-heading p {
  color: var(--muted);
  margin-top: 8px;
}
.page-heading p {
  font-size: 14px;
}
.page-heading .subtle {
  padding: 8px 0;
}
h2 {
  font-size: 18px;
  line-height: 1.24;
  font-weight: 630;
  letter-spacing: -0.035em;
  color: var(--ink);
}
h3 {
  font-size: 14px;
  font-weight: 660;
  letter-spacing: -0.016em;
  color: var(--ink);
}
.mobile-jump {
  display: none;
}
.workspace {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(286px, 0.85fr) minmax(0, 1.95fr);
  gap: var(--gap);
}
.surface {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.panel-title {
  justify-content: space-between;
  padding: 19px 21px 16px;
  border-bottom: 1px solid var(--line);
}
.section-icon {
  font-size: 17px;
  line-height: 19px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  width: 24px;
  height: 23px;
  color: #456652;
  background: #ecf1e5;
}
.form-section {
  padding: 15px 21px 17px;
  border-bottom: 1px solid var(--line);
}
.form-section h3 {
  margin-bottom: 11px;
}
form label,
.sensitivity-controls label {
  display: block;
  color: #43554c;
  font-weight: 550;
  font-size: 12px;
}
form label + label,
form label + .field-row,
.field-row + label,
.field-row + .field-row,
form label + div:not(.field-row),
.fold > div + label {
  margin-top: 11px;
}
form input:not([type="checkbox"]),
form select,
.sensitivity-controls input,
.sensitivity-controls select {
  display: block;
  width: 100%;
  min-width: 0;
  border-radius: 5px;
  border: 1px solid #c8d0c6;
  background: #fcfdfa;
  font-size: 13px;
  color: #1f372e;
  min-height: 37px;
  padding: 7px 10px;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23596d60' stroke-width='1.5' d='m2 2 4 4 4-4'/%3E%3C/svg%3E") !important;
  background-position: right 10px center !important;
  background-repeat: no-repeat !important;
  padding-right: 30px !important;
}
form select,
.control,
.sensitivity-controls input,
.sensitivity-controls select {
  margin-top: 5px;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.control {
  display: flex;
  align-items: center;
  border: 1px solid #c8d0c6;
  border-radius: 5px;
  background: #fcfdfa;
}
.control:focus-within {
  outline: 2px solid #72a16e;
  outline-offset: 1px;
}
.control input:not([type="checkbox"]) {
  border: 0;
  outline: 0;
  flex: 1;
  background: transparent;
  min-height: 35px;
  padding-right: 1px;
  font-weight: 570;
}
.control span {
  color: #69796d;
  font-size: 11px;
  font-weight: 480;
  padding: 0 9px 0 3px;
  white-space: nowrap;
}
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
form [data-show="adp"]:not([hidden]) {
  margin-top: 11px;
}
.form-disclosure {
  border-bottom: 1px solid var(--line);
}
summary {
  list-style: none;
  position: relative;
}
summary::-webkit-details-marker {
  display: none;
}
.form-disclosure > summary,
.notes > summary {
  font-weight: 620;
  font-size: 13px;
  padding: 15px 41px 15px 21px;
  color: var(--ink);
}
summary:after {
  content: "+";
  position: absolute;
  right: 21px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 450;
  color: #667b6d;
}
details[open] > summary:after {
  content: "−";
}
.fold {
  padding: 0 21px 17px;
}
.fold > .field-row,
.fold > label,
.fold > [data-field] {
  margin-top: 9px;
}
.check {
  display: flex !important;
  gap: 7px;
  align-items: center;
}
input[type="checkbox"] {
  accent-color: var(--green);
  margin: 0;
}
.fold [data-show="heating"] {
  margin-top: 10px;
}
.form-bottom {
  padding: 13px 21px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5f8859;
}
.results {
  min-width: 0;
}
#output {
  display: grid;
  gap: 15px;
}
.result-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
}
.result-heading h2 { font-size: 20px; }
#result-state, .export-help { color: var(--muted); font-size: 13px; }
#output[data-stale="true"] #result-state { color: var(--ink); font-weight: 650; }
.export-help { grid-column: 1 / -1; }
.export-help:empty { display: none; }
.export-button {
  padding: 8px 14px;
  min-height: 40px;
  border: 1px solid var(--field-border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}
.export-button:not(:disabled):hover { background: var(--surface-soft); }
.export-button:disabled { color: var(--muted); cursor: not-allowed; }
.duty-card {
  padding: 20px 24px 23px;
  border-radius: 12px;
  color: #f4f9ee;
  background: #153f36;
}
.duty-header,
.card-heading,
.breakdown-row,
.dialog-head {
  justify-content: space-between;
  gap: 12px;
}
.duty-header h2 {
  color: #f0f7ec;
  font-size: 17px;
}
.duty-state,
.plain-tag {
  font-size: 11px;
  line-height: 1.3;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 570;
  white-space: nowrap;
}
.duty-state {
  border: 1px solid #638479;
  background: #285046;
  color: #d5efd6;
}
.duty-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(160px, 1fr);
  gap: 25px;
  margin-top: 14px;
  align-items: end;
}
.duty-primary {
  line-height: 1.04;
  color: #e6f4de;
}
.duty-primary strong {
  font-size: clamp(39px, 4.4vw, 64px);
  letter-spacing: -0.065em;
  font-weight: 530;
}
.duty-primary > span {
  font-size: 20px;
  letter-spacing: -0.03em;
  color: #bbd1c6;
}
.duty-primary > div {
  font-size: 12px;
  color: #c2d5c9;
  margin-top: 5px;
}
.breakdown {
  padding-bottom: 3px;
}
.breakdown-row {
  font-size: 13px;
  line-height: 1.9;
}
.breakdown-row > span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #dde8dc;
}
.breakdown-row strong {
  font-weight: 600;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
}
.dot.sensible,
#split-bar {
  background: #c6e991;
}
.dot.latent,
.split-track {
  background: #70b7aa;
}
.split-track {
  margin-top: 5px;
  height: 5px;
  border-radius: 5px;
  overflow: hidden;
}
#split-bar {
  height: 100%;
  width: 0;
  border-right: 2px solid #153f36;
}
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 15px 6px;
}
.kpi-row > div {
  padding: 0 16px;
  min-width: 0;
}
.kpi-row > div + div {
  border-left: 1px solid var(--line);
}
.kpi-row span,
.kpi-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.kpi-row strong {
  font-size: clamp(17px, 1.9vw, 26px);
  font-weight: 600;
  letter-spacing: -0.045em;
  color: var(--ink);
  line-height: 1.45;
}
.kpi-row small {
  font-size: 11px;
}
.chart-card {
  padding: 20px 21px 13px;
}
.card-heading {
  align-items: flex-start;
}
.card-heading p,
.footnote {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.card-heading p {
  margin-top: 4px;
}
.plain-tag {
  color: #4d6757;
  background: #f1f4ed;
  border: 1px solid #e1e6dc;
}
.chart-wrap {
  margin-top: 12px;
  position: relative;
}
#chart {
  width: 100%;
  height: auto;
  display: block;
}
.chart-key {
  gap: 17px;
  flex-wrap: wrap;
  border-top: 1px solid #e3e9e0;
  padding-top: 10px;
  margin-top: 3px;
}
.chart-key > span {
  gap: 6px;
  color: #536759;
  font-size: 11px;
}
.dot.entering {
  background: var(--orange);
}
.dot.leaving {
  background: #307d69;
}
.dot.adp {
  background: var(--slate);
  border-radius: 2px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}
.detail-card {
  padding: 17px 20px;
}
.detail-card h2 {
  font-size: 16px;
}
dl {
  margin-top: 10px;
}
dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #e8ece5;
  padding: 7px 0;
  font-size: 12px;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  text-align: right;
  color: var(--ink);
  font-weight: 620;
}
.footnote {
  margin-top: 10px;
}
.footnote:empty,
#warnings:empty {
  display: none;
}
.sensitivity-controls {
  display: grid;
  grid-template-columns: minmax(115px, 2fr) minmax(54px, 1fr) minmax(
      54px,
      1fr
    ) auto;
  align-items: end;
  gap: 9px;
  margin: 14px 0;
}
.run {
  border: 1px solid #2b5e49;
  background: #e8efdf;
  border-radius: 5px;
  color: #284e3f;
  min-height: 37px;
  padding: 7px 12px;
  font-weight: 620;
  font-size: 12px;
}
.run:hover {
  background: #dbe7cd;
}
.sens-table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
th {
  text-align: right;
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
}
th:first-child,
td:first-child {
  text-align: left;
}
td,
th {
  padding: 8px 6px;
  border-top: 1px solid #e0e6db;
}
td:first-child,
th:first-child {
  padding-left: 0;
}
.sens-base {
  background: #f1f5eb;
}
.sens-bad {
  text-align: left;
  white-space: normal;
  color: #855622;
}
.notes ul {
  padding: 0 37px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}
.notes li + li {
  margin-top: 5px;
}
.error,
.warning {
  padding: 12px 16px;
  border-radius: 7px;
  background: #fff4dc;
  color: #604b21;
  font-size: 13px;
  border: 1px solid #dfca92;
}
.error {
  background: #fff0e8;
  color: #803d24;
  border-color: #e5bcab;
  margin-bottom: 13px;
  font-weight: 560;
}
.warning + .warning {
  margin-top: 5px;
}
.footer {
  justify-content: space-between;
  gap: 14px;
  padding: 24px 0 30px;
  color: var(--muted);
  font-size: 11px;
}
.footer > span:first-child {
  font-weight: 700;
  color: var(--green);
  font-size: 13px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  max-width: min(530px, calc(100% - 32px));
  color: var(--body);
  padding: 24px;
  background: #fbfcf7;
}
dialog::backdrop {
  background: #0e281d77;
}
.dialog-head {
  margin-bottom: 15px;
}
.dialog-head button {
  border: 1px solid var(--line);
  border-radius: 5px;
  line-height: 1;
  width: 30px;
  height: 28px;
  font-size: 20px;
  background: white;
}
dialog h3 {
  margin: 13px 0 4px;
}
dialog p {
  font-size: 13px;
  margin: 8px 0;
  color: #45564c;
}
@media (min-width: 1500px) {
  .frame {
    width: min(1390px, calc(100% - 110px));
  }
}
@media (max-width: 1050px) {
  .frame {
    width: calc(100% - 40px);
  }
  .workspace {
    grid-template-columns: minmax(277px, 0.9fr) minmax(0, 1.55fr);
    gap: 15px;
  }
  .kpi-row > div {
    padding: 0 11px;
  }
  .duty-body {
    gap: 13px;
  }
  .form-section,
  .panel-title {
    padding-left: 16px;
    padding-right: 16px;
  }
  .detail-card,
  .chart-card {
    padding-left: 15px;
    padding-right: 15px;
  }
}
@media (max-width: 760px) {
  .frame {
    width: calc(100% - 32px);
  }
  .bar-inner {
    height: 58px;
  }
  .bar-actions {
    gap: 10px;
  }
  .page-heading {
    padding: 24px 0 12px;
    align-items: center;
  }
  .page-heading p {
    font-size: 13px;
    margin-top: 6px;
  }
  .page-heading .subtle {
    white-space: nowrap;
    font-size: 12px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .mobile-jump {
    display: flex;
    gap: 15px;
    margin: 0 0 14px;
    font-size: 12px;
  }
  .mobile-jump a {
    color: #376b50;
  }
  .form-section {
    padding: 12px 16px;
  }
  .form-section h3 {
    margin-bottom: 9px;
  }
  .bar-divider {
    display: none;
  }
  .input-panel {
    scroll-margin: 12px;
  }
  .results {
    scroll-margin: 12px;
  }
  .duty-primary strong {
    font-size: 45px;
  }
  .kpi-row strong {
    font-size: 22px;
  }
  .chart-card {
    padding: 16px 13px 12px;
  }
}
@media (max-width: 460px) {
  .frame {
    width: calc(100% - 24px);
  }
  .brand {
    font-size: 20px;
  }
  .brand-symbol {
    width: 28px;
    height: 28px;
    margin-right: 7px;
  }
  .bar-actions {
    gap: 6px;
  }
  .method-button {
    font-size: 12px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .subtle span {
    display: none;
  }
  .page-heading .subtle {
    font-size: 11px;
  }
  .duty-card {
    padding: 17px;
  }
  .duty-body {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .duty-primary strong {
    font-size: 41px;
  }
  .duty-primary > span {
    font-size: 15px;
  }
  .kpi-row {
    padding: 12px 1px;
  }
  .kpi-row > div {
    padding: 0 8px;
  }
  .kpi-row strong {
    font-size: 17px;
  }
  .kpi-row small {
    font-size: 10px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .sensitivity-controls {
    grid-template-columns: 1fr 1fr;
  }
  .card-heading {
    gap: 6px;
  }
  .plain-tag {
    font-size: 10px;
  }
  .chart-key {
    gap: 8px;
  }
  .footer {
    align-items: baseline;
  }
  .footer > span + span {
    text-align: right;
  }
}
.compare-button {
  font-size: 12px;
  border: 0;
  background: transparent;
  color: #376a50;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 7px 0 0;
}
button:disabled {
  cursor: wait;
  opacity: 0.65;
}


/* --------------------------------------------------------------------------
   Theme tokens and dark-mode overrides. The original light design is retained.
   -------------------------------------------------------------------------- */
:root {
  --surface: #fff;
  --surface-soft: #f1f5eb;
  --topbar-bg: #fbfcf7;
  --form-bg: #fcfdfa;
  --field-border: #c8d0c6;
  --field-ink: #1f372e;
  --field-label: #43554c;
  --tag-bg: #f1f4ed;
  --tag-ink: #4d6757;
  --tag-line: #e1e6dc;
  --chart-bg: #f8faf4;
  --chart-grid: #e0e7da;
  --chart-text: #657569;
  --chart-rh: #abbda6;
  --chart-rh-label: #667f68;
  --chart-saturation: #819b7b;
  --chart-adp: #537b70;
  --chart-adp-marker: #687e82;
  --chart-path: #28715c;
  --chart-inlet: #c47736;
  --chart-outlet: #307d69;
  --chart-axis: #99ab9a;
  --chart-marker-stroke: #fff;
  --theme-button-bg: #f0f3ea;
  --theme-button-hover: #e3eadd;
  --theme-button-text: #24473a;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0b1715;
  --surface: #14241f;
  --surface-soft: #1e342a;
  --topbar-bg: #101f1b;
  --form-bg: #192d25;
  --field-border: #456155;
  --field-ink: #e8f3e9;
  --field-label: #c1d4c8;
  --ink: #e9f4ed;
  --body: #d3e2d7;
  --muted: #a1b8a9;
  --line: #344b3f;
  --green: #a5ceac;
  --orange: #edaa71;
  --slate: #94b7ba;
  --tag-bg: #253c30;
  --tag-ink: #c3dbc9;
  --tag-line: #3a5848;
  --chart-bg: #132720;
  --chart-grid: #2c483a;
  --chart-text: #b4cbbb;
  --chart-rh: #5c8069;
  --chart-rh-label: #a4c7ae;
  --chart-saturation: #b8d1a3;
  --chart-adp: #95cbb4;
  --chart-adp-marker: #8cb5ba;
  --chart-path: #80e0b1;
  --chart-inlet: #f2ad78;
  --chart-outlet: #84dcba;
  --chart-axis: #85ad96;
  --chart-marker-stroke: #0b1a15;
  --theme-button-bg: #233a2e;
  --theme-button-hover: #2c4939;
  --theme-button-text: #e0f0e1;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  min-height: 34px;
  background: var(--theme-button-bg);
  color: var(--theme-button-text);
  font-weight: 600;
  font-size: 12px;
}
.theme-toggle:hover { background: var(--theme-button-hover); }
.theme-toggle [data-theme-icon] { font-size: 17px; line-height: 1; }
:root[data-theme="dark"] .topbar { background: var(--topbar-bg); }
:root[data-theme="dark"] .surface { background: var(--surface); }
:root[data-theme="dark"] .section-icon { background: #254333; color: #c7dfc5; }
:root[data-theme="dark"] .brand-symbol { background: #e2efde; }
:root[data-theme="dark"] .brand-symbol i { background: #376f55; }
:root[data-theme="dark"] .unit-switch { background: #1c3027; }
:root[data-theme="dark"] .unit-switch button[aria-pressed="true"] { background: #c1e69d; color: #152c1e; }
:root[data-theme="dark"] form label,
:root[data-theme="dark"] .sensitivity-controls label { color: var(--field-label); }
:root[data-theme="dark"] form input:not([type="checkbox"]),
:root[data-theme="dark"] form select,
:root[data-theme="dark"] .sensitivity-controls input,
:root[data-theme="dark"] .sensitivity-controls select,
:root[data-theme="dark"] .control {
  background-color: var(--form-bg);
  color: var(--field-ink);
  border-color: var(--field-border);
}
:root[data-theme="dark"] .control input:not([type="checkbox"]) { background-color: transparent; }
:root[data-theme="dark"] .control span { color: #b8cabb; }
:root[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23b8d1bc' stroke-width='1.5' d='m2 2 4 4 4-4'/%3E%3C/svg%3E") !important;
}
:root[data-theme="dark"] summary:after { color: var(--muted); }
:root[data-theme="dark"] .plain-tag {
  background: var(--tag-bg);
  color: var(--tag-ink);
  border-color: var(--tag-line);
}
:root[data-theme="dark"] .chart-key,
:root[data-theme="dark"] dl > div,
:root[data-theme="dark"] td,
:root[data-theme="dark"] th { border-color: var(--line); }
:root[data-theme="dark"] .chart-key > span { color: var(--muted); }
:root[data-theme="dark"] .dot.leaving { background: var(--chart-outlet); }
:root[data-theme="dark"] .sens-base { background: #223b2d; }
:root[data-theme="dark"] .sens-bad { color: #f1c78d; }
:root[data-theme="dark"] .run {
  background: #2d4836;
  color: #d8efce;
  border-color: #648b6a;
}
:root[data-theme="dark"] .run:hover { background: #385842; }
:root[data-theme="dark"] .compare-button,
:root[data-theme="dark"] .mobile-jump a { color: #b9e8bf; }
:root[data-theme="dark"] .warning {
  background: #362d1e;
  color: #f4d6a2;
  border-color: #806741;
}
:root[data-theme="dark"] .error {
  background: #3b251f;
  color: #f7c5b3;
  border-color: #96614d;
}
:root[data-theme="dark"] .skip:focus { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] dialog { background: var(--surface); color: var(--body); }
:root[data-theme="dark"] dialog p { color: var(--muted); }
:root[data-theme="dark"] .dialog-head button { background: var(--form-bg); }
:root[data-theme="dark"] .status-dot { background: #a5d1a4; }

/* Legal acknowledgment / results gate */
.acceptance {
  border-top: 1px solid var(--line);
  padding: 17px 21px 20px;
  background: var(--surface-soft);
  border-radius: 0 0 12px 12px;
}
.acceptance h3 { font-size: 14px; margin-bottom: 7px; }
.acceptance p { font-size: 12px; color: var(--muted); line-height: 1.6; }
.acceptance a, .consent-prompt a, .footer-links a, .legal-page a {
  color: var(--green); text-decoration: underline; text-underline-offset: 2px;
}
.acceptance a:hover, .legal-page a:hover { color: var(--ink); }
.terms-check { display: flex !important; gap: 9px; align-items: flex-start; margin-top: 14px; font-size: 12px !important; }
.terms-check input { margin-top: 3px; flex: none; height: 16px; width: 16px; }
.terms-check span { line-height: 1.45; font-weight: 600; }
.legal-links { display: flex; gap: 16px; padding-top: 7px; font-size: 12px; }
.calculate-action {
  width: 100%; min-height: 41px; margin-top: 12px;
  border: 0; border-radius: 7px;
  background: #245b44; color: #f1f9ed;
  font-size: 13px; font-weight: 650;
  transition: background 120ms;
}
.calculate-action:not(:disabled):hover { background: #337556; }
.calculate-action:disabled { opacity: .5; cursor: not-allowed; }
:root[data-theme="dark"] .calculate-action { background: #bce4a1; color: #122919; }
:root[data-theme="dark"] .calculate-action:not(:disabled):hover { background: #d0f0b2; }
.acceptance .accept-help { margin-top: 9px; font-size: 11px; }
.consent-prompt {
  padding: clamp(28px, 6vw, 64px) 24px;
  min-height: 300px;
  text-align: center;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
.consent-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-soft); color: var(--green); font-size: 25px; }
.consent-prompt h2 { font-size: 22px; }
.consent-prompt p { max-width: 390px; color: var(--muted); }
.consent-prompt a { font-weight: 600; font-size: 12px; }
.footer { flex-wrap: wrap; }
.footer-links { display: flex; flex-wrap: wrap; gap: 13px; margin-left: auto; }
.footer-links a { font-size: 11px; }

/* Dedicated privacy and terms pages; the same design language and theme. */
.legal-page { width: min(840px, calc(100% - 36px)); margin: 44px auto 65px; }
.legal-breadcrumb { color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.legal-breadcrumb a { margin-right: 6px; }
.legal-hero { padding: 26px 30px; margin-bottom: 18px; }
.legal-eyebrow { color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.legal-hero h1 { margin: 7px 0 12px; font-size: clamp(28px, 4.5vw, 39px); }
.legal-hero p { color: var(--muted); line-height: 1.65; }
.legal-updated { font-size: 12px; color: var(--muted); margin-top: 14px; }
.legal-content { padding: 11px 30px 30px; }
.legal-content section { padding: 19px 0; border-bottom: 1px solid var(--line); }
.legal-content section:last-child { border-bottom: none; }
.legal-content h2 { font-size: 18px; margin-bottom: 9px; }
.legal-content p, .legal-content li { line-height: 1.75; font-size: 14px; color: var(--body); }
.legal-content p + p { margin-top: 9px; }
.legal-content ul { padding-left: 22px; margin: 8px 0; }
.legal-content li + li { margin-top: 6px; }
.legal-content a { overflow-wrap: anywhere; }
.legal-callout { border-left: 3px solid var(--green); padding-left: 14px; }
@media (max-width: 760px) {
  .theme-toggle { min-height: 30px; padding: 5px 7px; }
  .acceptance { padding-left: 16px; padding-right: 16px; }
  .legal-page { margin: 24px auto 35px; }
  .legal-hero { padding: 22px 20px; }
  .legal-content { padding: 6px 20px 19px; }
}
@media (max-width: 460px) {
  .theme-toggle [data-theme-label] { display: none; }
  .theme-toggle { width: 35px; justify-content: center; }
  .footer-links { width: 100%; margin-left: 0; }
}
