:root {
  --ink: #18312d;
  --muted: #536964;
  --paper: #fffdf8;
  --page: #f3f0e8;
  --line: #cbd7d2;
  --pine: #145c4d;
  --pine-dark: #0c4439;
  --sun: #f2b84b;
  --sun-soft: #fff3d6;
  --red: #a3342c;
  --red-soft: #fff0ee;
  --blue: #315e84;
  --blue-soft: #edf5fb;
  --shadow: 0 18px 42px rgba(24, 49, 45, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }

html {
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

body { margin: 0; }

button, input, select { font: inherit; }
button, input, select, summary { min-height: 44px; }

button, select, summary, input[type="checkbox"], input[type="radio"] { cursor: pointer; }

input:not([type="checkbox"]):not([type="radio"]), select {
  width: 100%;
  border: 1px solid #9fb1ab;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

input[readonly] { background: #f2f4f3; cursor: text; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid #126cda;
  outline-offset: 3px;
}

[aria-invalid="true"] { border-color: var(--red) !important; box-shadow: 0 0 0 2px rgba(163, 52, 44, 0.14); }

.selector-shell { width: min(100%, 1080px); margin: 0 auto; padding: clamp(18px, 4vw, 52px); }

.tool-header { padding: clamp(12px, 3vw, 28px) 0 26px; }
.tool-header h1 { max-width: 760px; margin: 4px 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.3rem, 6vw, 4.6rem); line-height: 0.98; letter-spacing: -0.04em; }
.lede { max-width: 760px; margin: 0; color: var(--muted); font-size: clamp(1.05rem, 2.4vw, 1.28rem); }
.eyebrow, .step-label { margin: 0 0 5px; color: var(--pine); font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.boundary-banner, .import-banner, .validation-summary, .result-exit {
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.boundary-banner { border-left: 5px solid var(--sun); background: var(--sun-soft); }
.import-banner { border-left: 5px solid var(--blue); background: var(--blue-soft); }
.validation-summary { border: 2px solid var(--red); background: var(--red-soft); }
.boundary-banner h2, .import-banner h2, .validation-summary h2 { margin: 0 0 7px; font-size: 1.15rem; }
.boundary-banner p, .import-banner p, .validation-summary p { margin: 0; }

.panel {
  background: var(--paper);
  border: 1px solid rgba(20, 92, 77, .16);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 22px 0;
  padding: clamp(18px, 4vw, 30px);
}

.panel h2, .results h2, .affiliate-module h2 { margin: 0 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.55rem, 3vw, 2.05rem); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-intro { color: var(--muted); margin: 5px 0 18px; }

.button {
  min-height: 46px;
  border-radius: 999px;
  border: 2px solid transparent;
  padding: 10px 19px;
  font-weight: 800;
  text-align: center;
}
.button-primary { background: var(--pine); color: #fff; }
.button-primary:hover { background: var(--pine-dark); }
.button-secondary { border-color: var(--pine); background: #fff; color: var(--pine); }
.button-secondary:hover { background: #eaf4f1; }
.button-quiet { background: transparent; border-color: #849a93; color: var(--ink); }
.button-danger { border-color: var(--red); background: #fff; color: var(--red); }

.help-block { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 16px 0 20px; }
.help-block summary { display: flex; align-items: center; font-weight: 800; color: var(--pine); }
.help-block p { color: var(--muted); margin: 0 0 16px; }

.empty-state { border: 1px dashed #9fb1ab; border-radius: 13px; color: var(--muted); padding: 22px; text-align: center; }
.appliance-list { display: grid; gap: 16px; }
.appliance-card { border: 1px solid var(--line); border-radius: 15px; background: #fff; padding: 18px; }
.appliance-card legend { font-weight: 900; padding: 0 6px; }
.row-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.row-heading h3 { margin: 0; font-size: 1.12rem; }
.row-number { color: var(--muted); font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.row-actions { display: flex; gap: 8px; }
.row-grid, .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.span-two { grid-column: 1 / -1; }
.field label, .field-label { display: block; font-weight: 800; margin-bottom: 5px; }
.field-help, .note { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
.optional { color: var(--muted); font-weight: 500; }
.input-with-unit { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.input-with-unit span { font-weight: 800; }
.check-row { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; font-weight: 700; }
.check-row input, .choice-group input { width: 22px; height: 22px; flex: 0 0 22px; margin: 1px 0 0; }
.danger-check { color: var(--red); }
.choice-group { border: 0; padding: 16px 0 4px; margin: 0; }
.choice-group legend { font-weight: 900; }
.choice-group label { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 0; }
.preference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin-top: 18px; }
.field-error { color: var(--red); font-weight: 750; font-size: .9rem; margin: 6px 0 0; }
.field-error:empty { display: none; }

.aggregate-card { border: 2px solid var(--blue); background: var(--blue-soft); }
.aggregate-chip { display: inline-block; border-radius: 999px; background: var(--blue); color: #fff; font-size: .74rem; font-weight: 850; padding: 4px 9px; }
.aggregate-value { font-size: 1.16rem; font-weight: 900; }

.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 34px; }
.validation-summary ul { margin-bottom: 0; padding-left: 22px; }
.validation-summary a { color: var(--red); font-weight: 800; }
.status-line { min-height: 1.4em; color: var(--blue); font-weight: 750; }
.stale-banner { border: 2px solid var(--sun); border-radius: 12px; background: var(--sun-soft); padding: 13px 16px; font-weight: 850; }
.clock-banner { border: 2px solid var(--blue); border-radius: 12px; background: var(--blue-soft); padding: 13px 16px; font-weight: 850; }

.results { margin: 42px 0 22px; }
.results-heading { border-bottom: 2px solid var(--pine); padding-bottom: 12px; margin-bottom: 18px; }
.requirements-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.requirement { min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 15px; }
.requirement dt { color: var(--muted); font-size: .82rem; font-weight: 800; }
.requirement dd { margin: 3px 0 0; font-size: clamp(1.2rem, 3vw, 1.65rem); font-weight: 900; overflow-wrap: anywhere; }

.product-groups { display: grid; gap: 25px; margin-top: 28px; }
.verdict-group > h3, .verdict-group summary { font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; font-weight: 800; }
.verdict-group summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin-top: 12px; }
.product-card { border: 1px solid var(--line); border-top: 5px solid var(--blue); border-radius: 14px; background: #fff; padding: 17px; break-inside: avoid; }
.product-card[data-verdict="FITS"] { border-top-color: var(--pine); }
.product-card[data-verdict="FITS_WITH_CAUTIONS"] { border-top-color: var(--sun); }
.product-card[data-verdict="DOES_NOT_FIT"] { border-top-color: var(--red); }
.product-card h4 { margin: 0; font-size: 1.16rem; }
.product-meta { color: var(--muted); margin: 2px 0 12px; }
.verdict-badge { display: inline-flex; align-items: center; border-radius: 999px; margin: 9px 0; padding: 5px 10px; font-size: .78rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
[data-verdict="FITS"] .verdict-badge { background: #dbf1ea; color: var(--pine-dark); }
[data-verdict="FITS_WITH_CAUTIONS"] .verdict-badge { background: var(--sun-soft); color: #6f4b00; }
[data-verdict="UNKNOWN"] .verdict-badge { background: var(--blue-soft); color: #244967; }
[data-verdict="DOES_NOT_FIT"] .verdict-badge { background: var(--red-soft); color: var(--red); }
.check-list { list-style: none; padding: 0; margin: 12px 0 0; }
.check-list li { border-top: 1px solid #e2e8e5; padding: 10px 0; }
.check-status { font-weight: 900; }
.check-pass { color: var(--pine); }
.check-fail { color: var(--red); }
.check-unknown { color: var(--blue); }
.evidence-date { display: block; color: var(--muted); font-size: .82rem; }
.card-note { border-radius: 9px; margin: 10px 0 0; padding: 9px 11px; background: #f4f6f5; font-size: .9rem; }
.result-exit { margin-top: 22px; background: var(--red-soft); border-left: 5px solid var(--red); }

.assumptions p { max-width: 850px; }
.share-area { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 18px; }
.share-fallback { margin-top: 10px; }

.affiliate-module { border-top: 4px solid var(--ink); margin: 42px 0 12px; padding: 26px 0; }
.associate-statement { font-weight: 900; }
.affiliate-boundary { color: var(--muted); }
.affiliate-module ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; padding-left: 20px; }
.affiliate-module a { color: var(--pine-dark); font-weight: 800; }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
[hidden] { display: none !important; }

.results-stale .verdict-badge { visibility: hidden; }
.results-stale .product-card { opacity: .68; }

@media (max-width: 819px) {
  .row-grid, .settings-grid, .requirements-grid, .card-grid, .affiliate-module ul { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
}

@media (max-width: 520px) {
  .selector-shell { padding: 16px 12px 30px; }
  .panel { padding: 17px 14px; border-radius: 14px; }
  .section-heading, .row-heading { align-items: stretch; flex-direction: column; }
  .section-heading .button, .row-actions .button { width: 100%; }
  .row-actions { width: 100%; }
  .preference-grid { grid-template-columns: 1fr; }
  .form-actions { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

@page { size: auto; margin: 13mm; }

@media print {
  :root { --shadow: none; }
  html, body { background: #fff; color: #000; font-size: 10pt; line-height: 1.4; }
  .selector-shell { width: 100%; max-width: none; padding: 0; }
  #calculator-form, .no-print, .affiliate-module, .import-banner, #import-status, .stale-banner { display: none !important; }
  .tool-header { padding-top: 0; }
  .panel, .product-card, .requirement { box-shadow: none; background: #fff; border-color: #777; }
  .requirement { break-inside: avoid; page-break-inside: avoid; }
  .results, .assumptions { display: block !important; }
  .card-grid { display: block; }
  .product-card { margin: 0 0 10mm; break-inside: avoid; }
  .product-card { page-break-inside: avoid; }
  .verdict-group, .verdict-group h3, .verdict-group summary { break-after: avoid; break-inside: avoid; }
  details.verdict-group { break-before: page; page-break-before: always; }
  .assumptions { break-before: page; page-break-before: always; }
  details { display: block; }
  details > summary { list-style: none; }
  details > .card-grid { display: block !important; }
  a { color: #000; text-decoration: none; }
}
