/* ═══════════════════════════════════════════════════════════
   Section 217 Tax Calculator — Stylesheet
   ═══════════════════════════════════════════════════════════ */

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

/* ── Theme variables ─────────────────────────────────────── */
:root,
[data-theme="light"] {
  --bg:            #F0F4F8;
  --surface:       #FFFFFF;
  --surface-2:     #F7F9FC;
  --border:        #D8E0EA;
  --text:          #111827;
  --text-muted:    #6B7280;
  --text-faint:    #9CA3AF;
  --accent:        #1E40AF;
  --accent-light:  #DBEAFE;
  --accent-dark:   #1e3380;
  --green:         #15803D;
  --green-light:   #DCFCE7;
  --amber:         #92400E;
  --amber-light:   #FEF3C7;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
  --radius:        12px;
  --radius-sm:     8px;
}

[data-theme="dark"] {
  --bg:            #0F172A;
  --surface:       #1E293B;
  --surface-2:     #162032;
  --border:        #334155;
  --text:          #F1F5F9;
  --text-muted:    #94A3B8;
  --text-faint:    #64748B;
  --accent:        #60A5FA;
  --accent-light:  #1e3a5f;
  --accent-dark:   #93C5FD;
  --green:         #4ADE80;
  --green-light:   #14532D;
  --amber:         #FCD34D;
  --amber-light:   #451a03;
  --shadow:        0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
}

/* ── Base ────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Site header ─────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

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

.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700;
  color: var(--text); letter-spacing: -.2px;
}
.logo svg { color: var(--accent); }

[data-theme-toggle] {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center;
  transition: background .15s, color .15s;
}
[data-theme-toggle]:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  padding: 36px 0 28px;
}

.hero h1 {
  font-size: 28px; font-weight: 700;
  letter-spacing: -.4px; line-height: 1.2;
  color: var(--text);
}

.subtitle {
  margin-top: 8px;
  font-size: 15px; color: var(--text-muted);
  max-width: 680px; line-height: 1.6;
}

/* ── Calculator grid ─────────────────────────────────────── */
.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding-bottom: 60px;
}

@media (max-width: 800px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 22px; }
}

/* ── Panel ───────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel + .panel { margin-top: 16px; }

.panel-title {
  font-size: 13px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── Input group ─────────────────────────────────────────── */
.input-group {
  margin-bottom: 18px;
}
.input-group:last-child { margin-bottom: 0; }

.input-group label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.section-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase;
  color: var(--accent);
  margin: 22px 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent-light);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.prefix {
  padding: 0 10px;
  font-size: 14px; font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border-right: 1px solid var(--border);
  height: 40px; display: flex; align-items: center;
  flex-shrink: 0;
}

.input-wrapper input[type="number"] {
  flex: 1;
  border: none; background: none;
  padding: 0 12px;
  height: 40px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  min-width: 0;
}

select {
  width: 100%;
  padding: 9px 12px;
  font-family: inherit; font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.help-text {
  display: block;
  font-size: 12px; color: var(--text-muted);
  margin-top: 5px; line-height: 1.5;
}

/* ── Checkboxes ──────────────────────────────────────────── */
.checkbox-group {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 14px;
}

.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 14px; color: var(--text);
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background .15s, border-color .15s;
}
.checkbox-label:hover { border-color: var(--accent); background: var(--accent-light); }
.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer; flex-shrink: 0;
}

/* ── Results column ──────────────────────────────────────── */
.results-column { display: flex; flex-direction: column; gap: 0; }

/* ── Result cards ────────────────────────────────────────── */
.result-cards {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.result-card {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  text-align: center;
  transition: border-color .2s, background .2s;
}

.result-card.better { border-color: var(--green); background: var(--green-light); }
.result-card.worse  { opacity: .65; }

.card-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 8px;
}

.card-amount {
  font-size: 26px; font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.card-detail {
  font-size: 12px; color: var(--text-muted);
  margin-top: 4px; line-height: 1.4;
}

.vs-badge {
  font-size: 12px; font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .5px;
  text-align: center;
}

/* ── Verdict ─────────────────────────────────────────────── */
.verdict {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-height: 52px;
}
.verdict.positive { background: var(--green-light); border-color: var(--green); }
.verdict.negative { background: var(--amber-light); border-color: var(--amber); }
.verdict.neutral  { background: var(--accent-light); border-color: var(--accent); }

.verdict-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.verdict-text { flex: 1; font-size: 13px; line-height: 1.55; color: var(--text); }

/* ── Breakdown table ─────────────────────────────────────── */
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.breakdown-table td {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.breakdown-table tr:last-child td { border-bottom: none; }

.breakdown-table td:first-child { color: var(--text-muted); padding-right: 12px; }
.breakdown-table td.amount {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}

.breakdown-table tr.indent td:first-child { padding-left: 16px; font-size: 12px; }
.breakdown-table tr.separator td { border-bottom: 2px solid var(--border); padding: 2px 0; }
.breakdown-table tr.total-row td {
  padding-top: 10px;
  font-weight: 700;
  font-size: 14px;
  border-top: 2px solid var(--border);
  border-bottom: none;
}
.breakdown-table tr.total-row td.amount { color: var(--accent); }

/* ── Notes ───────────────────────────────────────────────── */
.notes-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 10px;
}

.notes-list li {
  font-size: 13px; color: var(--text-muted);
  line-height: 1.6;
  padding-left: 16px;
  position: relative;
}
.notes-list li::before {
  content: '•';
  position: absolute; left: 0;
  color: var(--accent);
  font-weight: 700;
}
.notes-list li strong { color: var(--text); font-weight: 600; }
.notes-list li a { color: var(--accent); }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}
.site-footer p + p { margin-top: 4px; }
.site-footer a { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 500px) {
  .input-row { grid-template-columns: 1fr; }
  .result-cards { grid-template-columns: 1fr; }
  .vs-badge { display: none; }
  .card-amount { font-size: 22px; }
  .container { padding: 0 16px; }
}
