:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef4fb;
  --text: #162033;
  --muted: #5d6a7c;
  --line: #dce4ef;
  --primary: #174ea6;
  --primary-dark: #123d81;
  --success: #1f7a4d;
  --warning: #9a6700;
  --danger: #b42318;
  --radius: 18px;
  --shadow: 0 12px 32px rgba(22, 32, 51, 0.08);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

button, input { font: inherit; }

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: linear-gradient(135deg, #112c59, #174ea6);
  color: #fff;
  padding: 42px 0 32px;
}

.site-header .shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: end;
}

.eyebrow,
.step-kicker {
  margin: 0 0 6px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.site-header h1,
.results-card h2,
.step-card h2,
.scenario-card h3,
.explanation-card h3 {
  margin: 0;
  line-height: 1.15;
}

.site-header h1 { font-size: clamp(2rem, 6vw, 3.2rem); }

.intro {
  max-width: 760px;
  margin: 14px 0 0;
  color: rgba(255,255,255,.86);
  font-size: 1.06rem;
}

.privacy-note {
  padding: 18px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  display: grid;
  gap: 5px;
}

.privacy-note span { color: rgba(255,255,255,.78); font-size: .9rem; }

.app-shell { padding: 28px 0 56px; }

.notice,
.step-card,
.advanced-card,
.results-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.notice {
  padding: 16px 18px;
  display: grid;
  gap: 4px;
  margin-bottom: 20px;
  border-left: 5px solid var(--primary);
}

.notice span { color: var(--muted); }

.step-card { padding: 26px; margin-bottom: 20px; }

.step-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
}

.step-number {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.step-kicker { color: var(--primary); }

.field-grid,
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

label { display: grid; gap: 7px; }

.label { font-weight: 750; }

.label small { font-weight: 500; color: var(--muted); }

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #bdc9d9;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

input:focus {
  outline: 3px solid rgba(23,78,166,.18);
  border-color: var(--primary);
}

.input-with-prefix,
.input-with-suffix {
  display: flex;
  align-items: center;
  min-height: 48px;
  border: 1px solid #bdc9d9;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.input-with-prefix:focus-within,
.input-with-suffix:focus-within {
  outline: 3px solid rgba(23,78,166,.18);
  border-color: var(--primary);
}

.input-with-prefix > span,
.input-with-suffix > span {
  padding: 0 12px;
  color: var(--muted);
  font-weight: 700;
}

.input-with-prefix input,
.input-with-suffix input {
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
}

.input-with-prefix input { padding-left: 0; }
.input-with-suffix input { padding-right: 0; }

.help {
  color: var(--muted);
  font-size: .86rem;
}

.advanced-card { margin-bottom: 20px; overflow: hidden; }

.advanced-card summary {
  cursor: pointer;
  padding: 18px 22px;
  font-weight: 800;
}

.advanced-card summary span {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: .9rem;
  margin-top: 4px;
}

.advanced-grid { padding: 0 22px 22px; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 46px;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
}

.primary-button:hover { background: var(--primary-dark); }

.secondary-button {
  background: #fff;
  border: 1px solid #aebbd0;
  color: var(--text);
}

.text-button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--primary);
}

.error-message {
  padding: 14px 16px;
  border-radius: 10px;
  color: var(--danger);
  background: #fff1f0;
  border: 1px solid #ffd0cc;
}

.results-card { padding: 28px; margin-top: 28px; }

.results-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.health-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 850;
  background: var(--surface-soft);
}

.health-badge.healthy { background: #e8f5ee; color: var(--success); }
.health-badge.review { background: #fff4d6; color: var(--warning); }
.health-badge.reprice { background: #ffe9e7; color: var(--danger); }

.result-summary {
  font-size: 1.08rem;
  color: var(--muted);
  margin: 14px 0 22px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}

.metric-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  display: grid;
  gap: 6px;
}

.metric-card strong { font-size: clamp(1.6rem, 4vw, 2.35rem); }
.metric-card small, .metric-label { color: var(--muted); }
.metric-label { font-weight: 700; }
.accent-card { background: var(--surface-soft); }

.explanation-card,
.scenario-card,
.results-warning {
  margin-top: 20px;
  padding: 20px;
  border-radius: 14px;
}

.explanation-card {
  background: #fafcff;
  border: 1px solid var(--line);
}

.explanation-card ul {
  margin: 12px 0 0;
  padding-left: 22px;
}

.scenario-card {
  background: #f8fbff;
  border: 1px solid #cfdced;
}

.scenario-grid { margin: 18px 0; }

.scenario-results {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.scenario-results > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.scenario-results p {
  margin: 6px 0 0;
  color: var(--muted);
}

.results-warning {
  background: #fff8e6;
  border: 1px solid #f0d28a;
  display: grid;
  gap: 4px;
}

.results-warning span { color: #6a5320; }

.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
}

.site-footer .shell {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: .9rem;
}

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .site-header .shell,
  .field-grid,
  .scenario-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .site-header { padding-top: 30px; }
  .privacy-note { margin-top: 4px; }
  .step-card, .results-card { padding: 20px; }
  .results-topline { flex-direction: column; }
  .form-actions > * { flex: 1 1 100%; }
  .scenario-results > div { flex-direction: column; gap: 3px; }
  .site-footer .shell { flex-direction: column; justify-content: center; align-items: flex-start; padding: 18px 0; }
}
