/* ---------- Tokens ---------- */
:root {
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --ink-secondary: #43536B;
  --ink-muted: #7C8AA0;
  --border: #E3E9F1;
  --brand: #1E40AF;
  --brand-dark: #172F86;
  --accent: #2563EB;
  --danger-bg: #FEF2F2;
  --danger-ink: #B91C1C;
  --note-bg: #FFFBEB;
  --note-border: #FDE68A;
  --note-ink: #92400E;
  /* validated categorical palette: tax, late-filing, late-payment, accuracy, interest */
  --c-tax: #2563EB;
  --c-ftf: #D97706;
  --c-ftp: #0D9488;
  --c-accuracy: #E11D48;
  --c-interest: #7C3AED;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3 { line-height: 1.2; font-weight: 700; }

a { color: var(--accent); }

/* ---------- Header ---------- */
.site-header {
  background: var(--brand);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand span { color: #A5C0FF; }

.site-nav { display: flex; gap: 22px; }

.site-nav a {
  color: #DBE5FF;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}

.site-nav a:hover { color: #fff; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 56px 0 120px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.hero-sub {
  max-width: 620px;
  margin: 0 auto;
  color: #C7D6F7;
  font-size: 1.02rem;
}

/* ---------- Calculator ---------- */
.calc-section { margin-top: -72px; padding-bottom: 40px; }

.calc-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.form-card { padding: 26px; }

.form-card h2 { font-size: 1.2rem; margin-bottom: 18px; }

.field { margin-bottom: 16px; }

/* Entity segmented control */
.entity-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.entity-picker button {
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-secondary);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 6px;
  cursor: pointer;
  transition: all 0.12s;
}

.entity-picker button:hover { border-color: var(--accent); color: var(--accent); }

.entity-picker button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Mode tabs */
.mode-tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.mode-tabs button {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 2px 10px;
  margin-bottom: -1px;
  cursor: pointer;
}

.mode-tabs button:hover { color: var(--accent); }

.mode-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.label-optional { font-weight: 400; color: var(--ink-muted); font-size: 0.82rem; }

.field > input[type="number"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
}

.field > input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.field select,
.field input[type="date"],
.input-currency {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
}

.field select,
.field input[type="date"] {
  padding: 10px 12px;
  font-family: inherit;
  color: var(--ink);
}

.input-currency {
  display: flex;
  align-items: center;
  padding: 0 12px;
}

.input-currency span { color: var(--ink-muted); font-weight: 600; }

.input-currency input {
  border: 0;
  outline: 0;
  flex: 1;
  padding: 10px 8px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: transparent;
}

.field select:focus,
.field input[type="date"]:focus,
.input-currency:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-top: 5px;
  line-height: 1.45;
}

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
}

.field-checkbox label { margin: 0; font-weight: 500; }

.field-checkbox input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.form-error {
  background: var(--danger-bg);
  color: var(--danger-ink);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 600;
  border: 0;
  border-radius: 9px;
  padding: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--brand); }

/* ---------- Results ---------- */
.results-empty {
  padding: 48px 32px;
  text-align: center;
  color: var(--ink-secondary);
  border-style: dashed;
  box-shadow: none;
}

.results-empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 13px;
  background: #EAF0FE;
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.results-card { padding: 28px; }

.results-kicker {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.hero-figure {
  font-size: 52px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 4px 0 2px;
}

.results-asof { font-size: 0.86rem; color: var(--ink-muted); margin-bottom: 20px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.est-table-title { font-size: 0.95rem; margin: 14px 0 8px; }

.payments-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.payments-grid .input-currency { padding: 0 8px; }

.payments-grid .input-currency input { padding: 8px 4px; font-size: 0.92rem; }

/* Four-quarter result cards */
.quarter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.quarter-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.quarter-card .q-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.quarter-card .q-name { font-weight: 700; font-size: 0.9rem; }

.quarter-card .q-due { font-size: 0.76rem; color: var(--ink-muted); }

.quarter-card .q-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--ink-secondary);
  padding: 2px 0;
}

.quarter-card .q-row .num { font-variant-numeric: tabular-nums; }

.quarter-card .q-penalty {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
  font-size: 0.9rem;
}

.quarter-card .q-penalty .num { font-size: 1.05rem; font-weight: 650; }

.quarter-card.q-ok { background: #F7FDF9; border-color: #C9EAD5; }

.quarter-card.q-ok .q-penalty { color: #16794C; border-top-color: #C9EAD5; }

@media (max-width: 560px) {
  .quarter-grid { grid-template-columns: 1fr; }
  .payments-grid { grid-template-columns: repeat(2, 1fr); }
}

#est-results table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }

#est-results th {
  text-align: left;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

#est-results td { padding: 7px 8px; border-bottom: 1px solid var(--border); color: var(--ink-secondary); }

#est-results .num { text-align: right; font-variant-numeric: tabular-nums; }

.stat-tile {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-secondary); }

.stat-value { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.01em; margin: 2px 0; }

.stat-detail { font-size: 0.76rem; color: var(--ink-muted); line-height: 1.4; }

/* Composition bar: 2px surface gaps between segments, rounded outer ends */
.composition { margin-bottom: 6px; }

.composition-bar {
  display: flex;
  gap: 2px;
  height: 20px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
}

.composition-bar .seg { min-width: 3px; }

.composition-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--ink-secondary);
}

.composition-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: baseline;
}

.notes { display: grid; gap: 8px; }

.note {
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  color: var(--note-ink);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.85rem;
  margin-top: 8px;
}

/* ---------- Breakdown tables ---------- */
.breakdown { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }

.breakdown summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent);
}

.breakdown h3 { font-size: 0.95rem; margin: 16px 0 2px; }

.table-caption { font-size: 0.78rem; color: var(--ink-muted); margin-bottom: 8px; }

.how-cite {
  margin-top: 10px;
  font-size: 0.74rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.breakdown table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }

.breakdown th {
  text-align: left;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.breakdown td { padding: 7px 8px; border-bottom: 1px solid var(--border); color: var(--ink-secondary); }

.breakdown .num { text-align: right; font-variant-numeric: tabular-nums; }

.breakdown .row-badge {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 7px;
}

.results-disclaimer {
  margin-top: 18px;
  font-size: 0.78rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

/* ---------- How it works ---------- */
.how-section { padding: 48px 0 8px; }

.how-section h2, .faq-section h2 {
  text-align: center;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
  margin-bottom: 26px;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.how-card { padding: 24px; }

.how-card p:not([class]) { font-size: 0.92rem; color: var(--ink-secondary); }

.how-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--badge-color);
  margin-bottom: 6px;
}

.how-badge::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--badge-color);
  margin-right: 7px;
}

.how-rate { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }

.how-rate span { font-size: 0.95rem; font-weight: 500; color: var(--ink-muted); letter-spacing: 0; }

/* ---------- FAQ ---------- */
.faq-section { padding: 40px 20px 56px; max-width: 760px; }

.faq-section details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
}

.faq-section summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.98rem;
}

.faq-section details p { margin-top: 10px; color: var(--ink-secondary); font-size: 0.93rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: #0F1B33;
  color: #8FA3C4;
  padding: 34px 0;
  font-size: 0.82rem;
  line-height: 1.6;
}

.footer-disclaimer { max-width: 860px; margin-bottom: 18px; }

.footer-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; color: #64789C; }

.footer-meta a { color: #A5C0FF; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .calc-grid { grid-template-columns: 1fr; }
  .how-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .hero { padding-bottom: 104px; }
  .hero-figure { font-size: 42px; }
  .site-nav { display: none; }
}
