:root {
  --brand: #0757b7;
  --brand-deep: #063f8f;
  --brand-bright: #0b74de;
  --ink: #17233c;
  --muted: #5f6f86;
  --soft: #eef5ff;
  --line: #d8e2ef;
  --good: #166534;
  --good-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fff7ed;
  --danger: #991b1b;
  --danger-bg: #fef2f2;
  --card: #ffffff;
  --bg: #f6f9fd;
  --shadow: 0 14px 35px rgba(18, 44, 77, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
}
button, input, select { font: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

.site-shell { max-width: 1240px; margin: auto; padding: 22px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 30px;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand-bright));
  color: #fff;
  border-radius: 24px;
  padding: 36px;
  margin: 12px 0 16px;
  box-shadow: 0 18px 42px rgba(4, 63, 143, 0.2);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.08; margin: .3rem 0; }
.hero p { max-width: 820px; font-size: 1.08rem; margin-bottom: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .09em; font-weight: 800; font-size: .76rem; }
.hero-proof { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; min-width: 390px; }
.hero-proof div { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 16px; padding: 14px; }
.hero-proof strong, .hero-proof span { display: block; }
.hero-proof strong { font-size: 1.05rem; }
.hero-proof span { font-size: .76rem; opacity: .86; margin-top: 2px; }

.quality-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  background: #eaf3ff;
  border: 1px solid #bfd9fb;
  border-radius: 14px;
  margin-bottom: 20px;
  color: #153b68;
}
.quality-banner span { font-size: .92rem; }

.layout { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr); gap: 20px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.calculator-form { padding: 24px; }
.result-card { padding: 24px; position: sticky; top: 16px; }
.state-info { background: var(--soft); border: 1px solid #cfe2fb; border-radius: 14px; padding: 14px; color: #23466f; margin-bottom: 22px; }
.state-info .meta-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 7px; font-size: .88rem; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.badge.verified_auto, .quality-verified { color: var(--good); background: var(--good-bg); }
.badge.guided_auto, .quality-guided { color: var(--warn); background: #ffedd5; }
.badge.portal_only, .quality-portal { color: var(--danger); background: #fee2e2; }
.grade { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 900; background: #fff; border: 1px solid var(--line); }

.section-heading { display: flex; gap: 12px; align-items: flex-start; margin: 24px 0 14px; border-top: 1px solid #edf1f6; padding-top: 22px; }
.section-heading:first-of-type { border-top: 0; padding-top: 0; }
.section-heading > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 900; flex: 0 0 auto; }
.section-heading h2 { margin: 0; font-size: 1.08rem; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: .87rem; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 750; font-size: .88rem; margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  border: 1px solid #cdd9e8;
  border-radius: 11px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  min-height: 46px;
}
.field input:focus, .field select:focus { outline: 3px solid rgba(11,116,222,.14); border-color: var(--brand-bright); }
.hint { display: block; color: var(--muted); font-size: .76rem; margin-top: 4px; }
.two-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex !important; align-items: flex-start; gap: 10px; padding: 12px; background: #fff8e8; border: 1px solid #f2d38a; border-radius: 12px; }
.check input { width: auto; min-height: 0; margin-top: 3px; }

.official-evidence { margin-top: 20px; border: 1px dashed #b8cce3; border-radius: 14px; padding: 13px 15px; background: #fbfdff; }
.official-evidence summary { cursor: pointer; font-weight: 800; color: #244c78; }
.official-evidence p { color: var(--muted); font-size: .86rem; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
button, .button-link { border: 0; border-radius: 11px; padding: 11px 15px; font-weight: 800; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.primary, .button-link { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-bright)); }
button.secondary { color: var(--brand-deep); background: #eaf3ff; border: 1px solid #c9def8; }
button.ghost { color: #53647a; background: #fff; border: 1px solid var(--line); }
button:hover, .button-link:hover { filter: brightness(.98); transform: translateY(-1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.result-head h2 { font-size: clamp(2rem, 5vw, 3rem); margin: .1rem 0; color: #0a3f82; }
.quality-card { border-radius: 13px; padding: 10px 12px; text-align: right; min-width: 126px; }
.quality-card strong, .quality-card span { display: block; }
.quality-card span { font-size: .72rem; margin-top: 2px; }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0; }
.result-grid > div { padding: 11px; background: #f7faff; border: 1px solid #e1eaf5; border-radius: 11px; }
.result-grid span, .result-grid strong { display: block; }
.result-grid span { color: var(--muted); font-size: .73rem; }
.result-grid strong { font-size: .94rem; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th, td { padding: 11px; border-bottom: 1px solid #e7edf4; text-align: left; vertical-align: top; }
th { background: #f1f6fc; color: #39536e; font-size: .78rem; }
td:last-child, th:last-child { text-align: right; }
td small { display: block; color: var(--muted); margin-top: 3px; max-width: 310px; }
tr.total td { font-weight: 900; background: #edf6ff; color: #083e7d; border-bottom: 0; }
.basis-chip { display: inline-flex; margin-top: 4px; border-radius: 999px; padding: 2px 7px; background: #eef2f7; color: #526174; font-size: .66rem; font-weight: 800; }

.alert { border-radius: 13px; padding: 13px 14px; margin-top: 14px; }
.alert p { margin: 5px 0; }
.alert.warn { background: var(--warn-bg); border: 1px solid #f0d4a9; color: #713f12; }
.alert.danger { background: var(--danger-bg); border: 1px solid #fecaca; color: var(--danger); }
.alert.good { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--good); }
.trace { margin-top: 14px; background: #f7f9fc; border-radius: 13px; padding: 12px 14px; border: 1px solid #e3e9f0; }
.trace ul { margin: 7px 0 0 18px; padding: 0; }

.source-card { margin-top: 16px; border: 1px solid #cdddec; border-radius: 14px; padding: 14px; background: #fbfdff; }
.source-card > p { color: var(--muted); font-size: .86rem; }
.source-list { list-style: none; padding: 0; margin: 10px 0 0; }
.source-list li { padding: 9px 0; border-top: 1px solid #e6edf5; }
.source-list li:first-child { border-top: 0; }
.source-list small { display: block; color: var(--muted); }
.source-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .68rem; color: #5b6d82; }
.comparison { margin-top: 18px; }
.comparison h3 { font-size: 1rem; }
.result-actions { border-top: 1px solid #edf1f6; padding-top: 16px; }

.details { margin-top: 20px; padding: 26px; }
.details h2 { margin-top: 25px; }
.details h2:first-child { margin-top: 0; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.facts div { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #f9fbfe; }
.facts strong, .facts span { display: block; }
.facts strong { color: #0a4b98; }
.facts span { font-size: .8rem; color: var(--muted); margin-top: 4px; }
footer { text-align: center; color: var(--muted); padding: 28px 10px 8px; font-size: .84rem; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-proof { min-width: 0; }
  .layout { grid-template-columns: 1fr; }
  .result-card { position: static; }
}
@media (max-width: 680px) {
  .site-shell { padding: 12px; }
  .hero { padding: 24px; border-radius: 18px; }
  .hero-proof { grid-template-columns: 1fr; }
  .quality-banner { align-items: flex-start; flex-direction: column; }
  .calculator-form, .result-card, .details { padding: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .result-grid, .facts { grid-template-columns: 1fr; }
  .result-head { flex-direction: column; }
  .quality-card { text-align: left; }
  .actions button { flex: 1 1 140px; }
}
@media print {
  body { background: #fff; }
  .hero, .quality-banner, .calculator-form, .details, footer, .result-actions, .comparison { display: none !important; }
  .layout { display: block; }
  .result-card { position: static; box-shadow: none; border: 0; }
}
