:root {
  color-scheme: light;
  --navy: #09243b;
  --blue: #0b5cab;
  --teal: #087f8c;
  --ink: #152334;
  --muted: #5d6b7b;
  --line: #d7e0e8;
  --soft: #f3f7fa;
  --white: #fff;
  --green: #147a48;
  --amber: #9a5a00;
  --red: #b42318;
  --shadow: 0 16px 42px rgba(9, 36, 59, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, #eaf4f7 0, #f7fafc 420px, #f7fafc 100%);
  color: var(--ink);
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid #f4b942;
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.site-header {
  background: radial-gradient(circle at 85% -20%, #1ba5a8 0, transparent 43%), linear-gradient(135deg, #071f35, #0b4b73 72%);
  color: #fff;
}
.header-inner, .app-shell, .footer-inner { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }
.header-inner { padding: 36px 0 32px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { color: #fff; text-decoration: none; font-weight: 900; letter-spacing: -.02em; font-size: 21px; }
.header-links { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.header-link { color: #e6f8ff; text-decoration: none; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 8px 12px; font-weight: 700; font-size: 13px; }
.eyebrow { margin: 42px 0 9px; color: #85e6e7; text-transform: uppercase; letter-spacing: .11em; font-size: 12px; font-weight: 900; }
h1 { margin: 0; max-width: 800px; font-size: clamp(38px, 7vw, 72px); line-height: .98; letter-spacing: -.055em; }
.lede { max-width: 720px; margin: 17px 0 0; color: #dcecf6; font-size: 18px; }
.status-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.pill { display: inline-flex; align-items: center; min-height: 30px; border-radius: 999px; padding: 5px 10px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.26); color: #fff; font-size: 12px; font-weight: 800; }
.pill.ok { background: #dff8e8; color: #135f39; border-color: #a9dfbd; }
.pill.warn { background: #fff4d8; color: #744400; border-color: #efd28c; }
.pill.bad { background: #fee4e2; color: #8e1d15; border-color: #f1aaa4; }

.app-shell { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 24px; padding: 30px 0 56px; align-items: start; }
.progress-card { position: sticky; top: 18px; background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 17px; box-shadow: var(--shadow); }
.progress-card h2 { margin: 0 0 12px; font-size: 16px; }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.step-button { width: 100%; border: 0; background: transparent; color: var(--muted); display: grid; grid-template-columns: 30px 1fr; gap: 9px; align-items: center; text-align: left; padding: 9px; border-radius: 11px; cursor: pointer; }
.step-button span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--soft); border: 1px solid var(--line); color: var(--navy); font-weight: 900; }
.step-button[aria-current="step"] { background: #e9f4ff; color: var(--navy); font-weight: 850; }
.step-button[aria-current="step"] span { background: var(--blue); border-color: var(--blue); color: #fff; }
.progress-note { margin: 15px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.workspace { min-width: 0; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: clamp(18px, 4vw, 30px); box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.step-kicker { margin: 0 0 5px; color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.card h2 { margin: 0; font-size: clamp(25px, 4vw, 36px); letter-spacing: -.035em; line-height: 1.08; }
.card-intro { margin: 9px 0 22px; color: var(--muted); max-width: 680px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
label, .field-label { font-weight: 800; font-size: 14px; }
.help { color: var(--muted); font-size: 12px; }
input, select {
  width: 100%; min-width: 0; min-height: 48px; border: 1px solid #adbdca; border-radius: 11px; background: #fff; color: var(--ink); padding: 10px 12px;
}
input[readonly] { background: var(--soft); color: #405165; }
.notice { border-left: 4px solid var(--blue); background: #eef6ff; border-radius: 8px; padding: 11px 13px; color: #25405a; font-size: 13px; }
.notice.warn { border-color: var(--amber); background: #fff8e8; }
.notice.bad { border-color: var(--red); background: #fff0ef; color: #7c211a; }
.notice.ok { border-color: var(--green); background: #ebf8f0; color: #205d3d; }

.search-shell { position: relative; }
.search-input { padding-left: 42px; }
.search-icon { position: absolute; top: 13px; left: 14px; color: var(--muted); pointer-events: none; }
.search-results { display: grid; gap: 7px; margin-top: 8px; max-height: 310px; overflow: auto; padding-right: 3px; }
.search-result { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); padding: 11px 12px; text-align: left; cursor: pointer; }
.search-result:hover { border-color: var(--blue); background: #f4f9ff; }
.search-result strong, .search-result small { display: block; }
.search-result strong { line-height: 1.25; }
.search-result small { margin-top: 4px; color: var(--muted); }
.selected-product { margin-top: 10px; border: 1px solid #8fc5a7; background: #effaf4; border-radius: 12px; padding: 13px; }
.selected-product strong { display: block; color: #145b38; }
.selected-product span { color: #36594a; font-size: 13px; }

.advanced { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfd; }
.advanced summary { cursor: pointer; padding: 14px; font-weight: 850; }
.advanced-grid { padding: 0 14px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.rule-summary { grid-column: 1 / -1; padding: 12px; border-radius: 11px; background: var(--navy); color: #e9f6ff; font-size: 13px; }

.step-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; }
.action-right { display: flex; gap: 10px; margin-left: auto; }
.btn { border: 0; border-radius: 11px; min-height: 46px; padding: 10px 16px; background: var(--blue); color: #fff; font-weight: 850; cursor: pointer; }
.btn:hover { filter: brightness(.95); }
.btn.secondary { background: #e9eff4; color: var(--navy); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--navy); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.review-grid { display: grid; gap: 9px; margin: 16px 0; }
.review-row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.review-row span:first-child { color: var(--muted); font-size: 13px; font-weight: 750; }
.disclosure { margin: 16px 0 0; font-size: 13px; color: var(--muted); }

.result-card { scroll-margin-top: 20px; }
.result-empty { color: var(--muted); padding: 10px 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; margin: 16px 0; }
.metric { border: 1px solid var(--line); background: var(--soft); border-radius: 12px; padding: 12px; min-width: 0; }
.metric small { display: block; color: var(--muted); font-weight: 750; }
.metric strong { display: block; margin-top: 4px; font-size: 18px; overflow-wrap: anywhere; }
.line-item { border: 1px solid var(--line); border-left: 5px solid var(--green); border-radius: 14px; margin-top: 12px; padding: 15px; }
.line-item.blocked { border-left-color: var(--red); }
.line-item.warn { border-left-color: var(--amber); }
.line-item h3 { margin: 0 0 10px; }
.line-item table { width: 100%; border-collapse: collapse; font-size: 14px; }
.line-item td { border-top: 1px solid var(--line); padding: 7px 2px; vertical-align: top; }
.line-item td:last-child { text-align: right; font-weight: 750; }
.issue-list { margin-top: 10px; border-radius: 9px; padding: 10px 12px; background: #fff6f5; color: #73241e; font-size: 13px; }
.issue-list.warning { background: #fff8e8; color: #674511; }
.issue-list ul { margin: 6px 0 0; padding-left: 20px; }

.operator-only { display: none; }
body.operator-mode .operator-only { display: block; }
.operator-card { border: 2px dashed #7d5ba6; background: #faf7ff; }
.operator-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
pre { margin: 0; max-height: 420px; overflow: auto; background: #071421; color: #d9f0ff; padding: 14px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }

.site-footer { border-top: 1px solid var(--line); background: #fff; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; padding: 24px 0 34px; color: var(--muted); font-size: 13px; }
.footer-inner a { color: var(--blue); font-weight: 800; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .progress-card { position: static; padding: 10px; overflow-x: auto; }
  .progress-card h2, .progress-note { display: none; }
  .step-list { display: flex; min-width: 610px; }
  .step-button { grid-template-columns: 28px 1fr; }
  .form-grid, .advanced-grid, .operator-grid { grid-template-columns: 1fr; }
  .field.full, .advanced, .rule-summary { grid-column: auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 560px) {
  .header-inner, .app-shell, .footer-inner { width: min(100% - 22px, 1160px); }
  .header-inner { padding-top: 20px; }
  .brand-row { align-items: flex-start; }
  .header-links .header-link:first-child { display: none; }
  .eyebrow { margin-top: 34px; }
  h1 { font-size: 42px; }
  .lede { font-size: 16px; }
  .app-shell { padding-top: 16px; gap: 14px; }
  .progress-card { overflow: visible; }
  .step-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 0; width: 100%; gap: 4px; }
  .step-button { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 3px; padding: 6px 2px; font-size: 10px; line-height: 1.15; }
  .step-button span { width: 27px; height: 27px; }
  .card { border-radius: 15px; padding: 17px; }
  .step-actions { flex-wrap: wrap; }
  .step-actions .btn, .action-right, .action-right .btn { width: 100%; }
  .action-right { margin-left: 0; flex-wrap: wrap; }
  .review-row { grid-template-columns: 1fr; gap: 2px; }
  .metrics { grid-template-columns: 1fr; }
  .footer-inner { display: grid; }
}

@media print {
  .site-header, .progress-card, #quoteForm, .operator-only, .site-footer { display: none !important; }
  body { background: #fff; }
  .app-shell { display: block; width: 100%; padding: 0; }
  .result-card { box-shadow: none; border: 0; padding: 0; }
}
