/* ─── Reset & Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --irs-blue:    #003087;
  --irs-dark:    #001a4d;
  --irs-accent:  #c8102e;
  --bg-page:     #f4f5f7;
  --bg-white:    #ffffff;
  --bg-section:  #fafbfc;
  --border:      #d0d4da;
  --border-light:#e8eaed;
  --text-main:   #1a1a2e;
  --text-sub:    #555770;
  --text-muted:  #888;
  --computed-bg: #f0f4ff;
  --total-bg:    #e8f0fe;
  --total-border:#1a73e8;
  --success:     #1e7e34;
  --danger:      #c8102e;
  --shadow:      0 2px 8px rgba(0,0,0,0.10);
  --radius:      6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-page);
  min-height: 100vh;
}

#app { max-width: 960px; margin: 0 auto; padding-bottom: 80px; }

/* ─── Header ──────────────────────────────────────────────────────────── */
.app-header {
  background: var(--irs-blue);
  color: #fff;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.irs-logo { display: flex; align-items: center; gap: 12px; }
.irs-seal { font-size: 32px; opacity: 0.85; }
.irs-title { font-size: 11px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.5px; }
.form-name { font-size: 18px; font-weight: 700; margin-top: 2px; }
.tax-year { font-size: 12px; opacity: 0.8; }
.header-warning {
  background: rgba(200,16,46,0.85);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 11px;
  text-align: center;
  line-height: 1.5;
  max-width: 200px;
}

/* ─── Progress Nav ────────────────────────────────────────────────────── */
.progress-nav {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 0;
  position: sticky;
  top: 73px;
  z-index: 90;
  box-shadow: var(--shadow);
}
.progress-steps {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--border-light);
  border-bottom: none;
  background: var(--bg-section);
  color: var(--text-muted);
  transition: all 0.2s;
}
.step.active {
  background: var(--bg-white);
  color: var(--irs-blue);
  font-weight: 600;
  border-color: var(--border);
}
.step.completed {
  background: #e8f5e9;
  color: #2e7d32;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.step.active .step-num { background: var(--irs-blue); }
.step.completed .step-num { background: #2e7d32; }
.step-label { font-size: 12px; }

.progress-bar-track { height: 3px; background: var(--border-light); margin-top: 0; }
.progress-bar-fill { height: 100%; background: var(--irs-blue); transition: width 0.4s ease; }

/* ─── Main Form ───────────────────────────────────────────────────────── */
.form-main { padding: 24px 16px; }

.form-step { display: none; }
.form-step.active { display: block; }

.step-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--irs-blue);
  margin-bottom: 6px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--irs-blue);
}
.step-desc { color: var(--text-sub); margin-bottom: 16px; font-size: 13px; }

/* ─── Sections & Rows ─────────────────────────────────────────────────── */
.form-section {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.section-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--irs-dark);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.form-row:last-child { margin-bottom: 0; }

.field-group {
  flex: 1;
  min-width: 160px;
}
.field-group.full { flex: 0 0 100%; }
.field-group.small { flex: 0 0 100px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
label.section-label { font-size: 13px; color: var(--irs-dark); margin-bottom: 8px; }
label.total-label { font-size: 13px; color: var(--irs-dark); font-weight: 700; }
label.computed-label { color: var(--irs-blue); }

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-white);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--irs-blue);
  box-shadow: 0 0 0 3px rgba(0,48,135,0.12);
}
input.money { text-align: right; font-variant-numeric: tabular-nums; }
input.computed {
  background: var(--computed-bg);
  color: var(--irs-blue);
  font-weight: 600;
  cursor: not-allowed;
}
input.total-field {
  background: var(--total-bg);
  color: var(--irs-dark);
  font-weight: 700;
  font-size: 16px;
  border-color: var(--total-border);
  border-width: 2px;
}

/* ─── Checkboxes & Radios ─────────────────────────────────────────────── */
.radio-group, .checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 4px;
}
.radio-label, .check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-main);
  cursor: pointer;
}
.radio-label input, .check-label input { cursor: pointer; }

/* ─── Help text ───────────────────────────────────────────────────────── */
.help-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* ─── Dependent rows ──────────────────────────────────────────────────── */
.dependent-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.dependent-row.header-row { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.dependent-row input, .dependent-row select { width: 100%; }
.dep-remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 18px; padding: 0 4px; }

/* ─── W-2 rows ────────────────────────────────────────────────────────── */
.w2-row { border: 1px solid var(--border-light); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; background: var(--bg-section); position: relative; }
.w2-remove { position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--danger); cursor: pointer; font-size: 18px; }

/* ─── Standard Deduction Box ──────────────────────────────────────────── */
.std-deduction-box {
  background: linear-gradient(135deg, var(--irs-blue), var(--irs-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: inline-flex;
  flex-direction: column;
  min-width: 280px;
}
.std-ded-label { font-size: 12px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
.std-ded-amount { font-size: 36px; font-weight: 800; margin: 4px 0; }
.std-ded-note { font-size: 12px; opacity: 0.75; }

/* ─── Total / Result rows ─────────────────────────────────────────────── */
.total-row { border-top: 2px solid var(--total-border); padding-top: 12px; margin-top: 4px; }
.computed-section { background: var(--computed-bg); border-radius: var(--radius); padding: 10px; }

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn-primary, .btn-next, .btn-back, .btn-secondary {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary, .btn-next {
  background: var(--irs-blue);
  color: #fff;
}
.btn-primary:hover, .btn-next:hover { background: var(--irs-dark); }
.btn-back {
  background: var(--bg-white);
  color: var(--irs-blue);
  border: 1px solid var(--irs-blue);
}
.btn-back:hover { background: var(--computed-bg); }
.btn-secondary {
  background: var(--bg-section);
  color: var(--text-sub);
  border: 1px solid var(--border);
  font-size: 12px;
  padding: 6px 12px;
  margin-top: 6px;
}
.btn-secondary:hover { background: var(--border-light); }

/* ─── Footer nav ──────────────────────────────────────────────────────── */
.form-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: center;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
  z-index: 80;
}
.nav-buttons { display: flex; gap: 12px; align-items: center; max-width: 960px; width: 100%; }
.nav-buttons .btn-next, .nav-buttons .btn-primary { margin-left: auto; }

/* ─── Result Summary ──────────────────────────────────────────────────── */
.result-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.result-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.result-card.refund { border-color: var(--success); border-width: 2px; }
.result-card.owed   { border-color: var(--danger);  border-width: 2px; }
.result-card.neutral { border-color: var(--irs-blue); border-width: 2px; }
.rc-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.rc-value { font-size: 24px; font-weight: 800; color: var(--irs-dark); }
.result-card.refund .rc-value { color: var(--success); }
.result-card.owed   .rc-value { color: var(--danger); }
.rc-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Form 1040 Preview ───────────────────────────────────────────────── */
.form-1040-preview {
  background: var(--bg-white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.f1040-header {
  background: var(--irs-dark);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.f1040-header h2 { font-size: 18px; }
.f1040-header .tax-year-badge {
  background: var(--irs-accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}
.f1040-body { padding: 0; }
.f1040-section { padding: 12px 24px; border-bottom: 1px solid var(--border-light); }
.f1040-section:last-child { border-bottom: none; }
.f1040-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border-light);
}
.f1040-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: 13px;
}
.f1040-line:hover { background: var(--bg-section); margin: 0 -24px; padding: 4px 24px; }
.f1040-line-num { color: var(--text-muted); font-size: 11px; min-width: 50px; }
.f1040-line-desc { flex: 1; padding: 0 8px; color: var(--text-main); }
.f1040-line-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 110px;
  text-align: right;
  color: var(--irs-dark);
}
.f1040-line.total {
  background: var(--total-bg);
  font-weight: 700;
  border-top: 2px solid var(--total-border);
  margin: 4px -24px 0;
  padding: 8px 24px;
}
.f1040-line.total .f1040-line-amt { font-size: 15px; }
.f1040-line.refund-line {
  background: #e8f5e9;
  color: var(--success);
  font-weight: 700;
  border-top: 2px solid var(--success);
  margin: 4px -24px 0;
  padding: 8px 24px;
}
.f1040-line.owed-line {
  background: #fce8e8;
  color: var(--danger);
  font-weight: 700;
  border-top: 2px solid var(--danger);
  margin: 4px -24px 0;
  padding: 8px 24px;
}
.f1040-line.sub { padding-left: 16px; color: var(--text-sub); }
.f1040-line.zero { color: var(--text-muted); }

.action-bar { display: flex; gap: 12px; padding: 16px 0; justify-content: center; }

/* ─── Utilities ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.spouse-fields.hidden { display: none !important; }
.spouse-only.hidden { display: none !important; }

/* ─── State Tax Selector ──────────────────────────────────────────────── */
.state-tax-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}
.state-tax-selector select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg-white);
  cursor: pointer;
}

/* ─── State Tax Banner ────────────────────────────────────────────────── */
.state-tax-banner {
  background: #e8f4fd;
  border: 1px solid #90caf9;
  border-left: 4px solid var(--irs-blue);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin: 0 0 16px 0;
  font-size: 13px;
  color: var(--irs-dark);
}

/* ─── Field Validation ────────────────────────────────────────────────── */
input.field-error { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(200,16,46,0.12) !important; background: #fff8f8; }
.field-error-msg { font-size: 11px; color: var(--danger); margin-top: 3px; line-height: 1.4; }

/* ─── Print Styles ────────────────────────────────────────────────────── */
@media print {
  .no-print, .app-header, .progress-nav, .form-footer { display: none !important; }
  body { background: #fff; font-size: 12px; }
  #app { max-width: 100%; padding: 0; }
  .form-step { display: none; }
  .form-step.active { display: block !important; }
  .form-1040-preview { border: 1px solid #000; box-shadow: none; }
  .f1040-header { background: #000 !important; -webkit-print-color-adjust: exact; color-adjust: exact; }
  .f1040-line.total { background: #e0e0e0 !important; -webkit-print-color-adjust: exact; }
  .f1040-line.refund-line { background: #d4edda !important; -webkit-print-color-adjust: exact; }
  .f1040-line.owed-line { background: #f8d7da !important; -webkit-print-color-adjust: exact; }
  .result-summary { display: grid !important; }
  .result-card { border: 1px solid #000; }
  .step-title { color: #000 !important; border-color: #000 !important; }
  h2.step-title { display: block !important; }
  .action-bar { display: none !important; }
  .f1040-line:hover { background: none; margin: 0; padding: 4px 0; }
}

/* ─── Trade Importer ──────────────────────────────────────────────────── */
.ti-import-section { margin-bottom: 16px; }

.ti-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-section);
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}
.ti-dropzone:hover,
.ti-dropzone.ti-dragover {
  border-color: var(--irs-blue);
  background: var(--computed-bg);
}
.ti-dropzone.ti-loading { opacity: 0.6; cursor: wait; }
.ti-dropzone.ti-error   { border-color: var(--danger); background: #fff8f8; }

.ti-dropzone-icon { font-size: 28px; line-height: 1; margin-bottom: 6px; }
.ti-dropzone-text { font-size: 13px; color: var(--text-sub); }
.ti-dropzone-link { color: var(--irs-blue); text-decoration: underline; }
.ti-dropzone-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.ti-status { font-size: 12px; margin-top: 6px; min-height: 16px; }
.ti-status-loading { color: var(--irs-blue); }
.ti-status-error   { color: var(--danger); }

/* Result panel */
.ti-result {
  border: 1px solid #90caf9;
  border-left: 4px solid var(--irs-blue);
  border-radius: var(--radius);
  background: #e8f4fd;
  margin-top: 10px;
  overflow: hidden;
}
.ti-result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--irs-dark);
  background: #d0e8fa;
  flex-wrap: wrap;
}
.ti-check { color: var(--success); font-size: 16px; }
.ti-clear {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  color: var(--text-sub);
}
.ti-clear:hover { background: var(--bg-white); color: var(--danger); }

.ti-warning {
  font-size: 12px;
  color: #7a4f00;
  background: #fff8e1;
  border-top: 1px solid #ffe082;
  padding: 6px 14px;
}

.ti-gains-row {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  flex-wrap: wrap;
}
.ti-gain-box {
  flex: 1;
  min-width: 160px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.ti-gain-box.ti-loss { border-color: var(--danger); background: #fff8f8; }
.ti-gain-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); font-weight: 600; }
.ti-gain-value { font-size: 20px; font-weight: 800; color: var(--irs-dark); margin: 2px 0; }
.ti-gain-box.ti-loss .ti-gain-value { color: var(--danger); }
.ti-gain-note { font-size: 10px; color: var(--text-muted); }

.ti-details { padding: 0 14px 12px; }
.ti-details summary {
  font-size: 12px;
  color: var(--irs-blue);
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
}
.ti-table-wrap { overflow-x: auto; margin-top: 8px; }
.ti-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ti-table th {
  background: var(--irs-dark);
  color: #fff;
  padding: 6px 8px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.ti-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ti-table tr:hover td { background: var(--bg-section); }
.ti-num  { text-align: right; font-variant-numeric: tabular-nums; }
.ti-neg  { color: var(--danger); }
.ti-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ti-badge-short   { background: #fff3cd; color: #7a4f00; }
.ti-badge-long    { background: #d4edda; color: #155724; }
.ti-badge-unknown { background: var(--bg-section); color: var(--text-muted); }
.ti-note { font-size: 11px; color: var(--text-muted); margin-top: 6px; padding: 0 4px; }

/* ─── Save / Load ─────────────────────────────────────────────────────── */
.sl-btn { min-width: 70px; }

.sl-toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.sl-toast-success {
  background: #1e7e34;
  color: #fff;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.sl-toast-error {
  background: var(--danger);
  color: #fff;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Help modal ──────────────────────────────────────────────────────── */
.help-btn { font-weight: 700; }

.help-modal[hidden] { display: none; }
.help-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 80px;
  overflow-y: auto;
}
.help-modal[hidden] { display: none; }

.help-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.help-modal-box {
  background: var(--bg-white);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 680px;
  overflow: hidden;
  animation: help-pop-in 0.2s ease;
}
@keyframes help-pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--irs-blue);
  color: #fff;
  padding: 16px 20px;
}
.help-modal-header h2 { font-size: 18px; font-weight: 700; }
.help-modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
}
.help-modal-close:hover { color: #fff; background: rgba(255,255,255,0.15); }

.help-modal-body { padding: 0; }

.help-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.help-section:last-child { border-bottom: none; }
.help-section p { font-size: 13px; color: var(--text-main); line-height: 1.6; margin-bottom: 10px; }
.help-section p:last-child { margin-bottom: 0; }

.help-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--irs-dark);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.help-subsection {
  font-size: 13px;
  font-weight: 700;
  color: var(--irs-blue);
  margin: 12px 0 6px;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 10px 0;
}
.help-table th {
  background: var(--irs-dark);
  color: #fff;
  padding: 6px 10px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.help-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.help-table tr:last-child td { border-bottom: none; }
.help-table tr:nth-child(even) td { background: var(--bg-section); }

.help-steps { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.help-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.5;
}
.help-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--irs-blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.help-list {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.6;
  padding-left: 20px;
  margin: 8px 0;
}
.help-list li { margin-bottom: 4px; }

.help-note {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  background: var(--bg-section);
  border-left: 3px solid var(--border);
  padding: 6px 10px !important;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 10px !important;
  margin-bottom: 0 !important;
}

.help-section code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: var(--bg-section);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--irs-dark);
}

/* ─── Restore session banner ──────────────────────────────────────────── */
.sl-restore-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #e8f5e9;
  border-bottom: 1px solid #a5d6a7;
  padding: 8px 20px;
  font-size: 13px;
  color: #1b5e20;
  animation: sl-slide-down 0.3s ease;
}
.sl-restore-banner button {
  background: none;
  border: none;
  cursor: pointer;
  color: #388e3c;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
}
.sl-restore-banner button:hover { color: #1b5e20; }
@keyframes sl-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ─── Export / Submit button ─────────────────────────────────────────── */
.export-submit-btn { background: #1565c0; margin-left: 8px; }
.export-submit-btn:hover { background: #0d47a1; }

/* ─── Export / Submit modal ──────────────────────────────────────────── */
.export-modal[hidden] { display: none; }
.export-modal {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center;
}
.export-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}
.export-modal-box {
  position: relative; z-index: 1;
  background: var(--bg-white);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  width: min(640px, 96vw);
  max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.export-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 14px;
  background: var(--irs-blue);
  color: #fff;
  flex-shrink: 0;
}
.export-modal-header h2 { font-size: 16px; font-weight: 700; margin: 0; }
.export-modal-close {
  background: none; border: none; cursor: pointer;
  color: #fff; font-size: 18px; line-height: 1;
  padding: 2px 6px; border-radius: 4px; opacity: 0.85;
}
.export-modal-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }
.export-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.export-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-light);
}
.export-section:last-of-type { border-bottom: none; }
.export-section h3 {
  font-size: 13px; font-weight: 700; color: var(--irs-blue);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px;
}
.export-section > p { font-size: 13px; color: var(--text-sub); margin-bottom: 12px; line-height: 1.5; }
.export-btn-row { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.export-action-btn { flex-shrink: 0; min-width: 190px; font-size: 13px; padding: 9px 16px; }
.export-action-desc { font-size: 12px; color: var(--text-sub); line-height: 1.5; padding-top: 4px; }
.export-provider-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; margin-bottom: 10px;
}
.export-mode-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 2px 7px; border-radius: 10px;
}
.export-mode-badge.test { background: #fff3cd; color: #856404; }
.export-mode-badge.live { background: #f8d7da; color: #721c24; }
.export-status {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-top: 12px; line-height: 1.4;
}
.export-status-success { background: #d4edda; color: #155724; }
.export-status-error   { background: #f8d7da; color: #721c24; }
.export-status-info    { background: #d1ecf1; color: #0c5460; }
.export-note {
  font-size: 11px; color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 12px; margin-top: 4px; line-height: 1.6;
}
.export-note code {
  font-family: 'Courier New', monospace; font-size: 11px;
  background: var(--bg-section); border: 1px solid var(--border-light);
  border-radius: 3px; padding: 1px 4px;
}

/* ─── IRS Compliance: Election Fund ──────────────────────────────────── */
.f1040-election-fund {
  background: #fffbf0;
  border-left: 3px solid #f9a825;
  font-size: 12px;
}

/* ─── IRS Compliance: Signature Section ──────────────────────────────── */
.f1040-sign-section h3 {
  color: var(--irs-blue);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.f1040-declaration {
  font-size: 11px;
  color: var(--text-sub);
  line-height: 1.6;
  background: #f8f9fb;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 14px;
}
.f1040-sig-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0 16px;
  align-items: end;
}
.f1040-sig-cell { padding-bottom: 6px; }
.f1040-sig-cell.wide { grid-column: span 2; }
.f1040-sig-line {
  border-bottom: 1px solid var(--text-main);
  min-height: 28px;
  padding: 2px 4px;
  font-size: 12px;
  color: var(--text-main);
}
.f1040-sig-line.f1040-ippin {
  letter-spacing: 4px;
  font-weight: 600;
  color: var(--irs-blue);
  font-family: 'Courier New', monospace;
}
.f1040-sig-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.f1040-third-party {
  margin-top: 12px;
  padding: 8px 12px;
  background: #e8f0fe;
  border-radius: var(--radius);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.f1040-tp-label {
  font-weight: 600;
  color: var(--irs-blue);
}
.f1040-edu-note {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 14px;
  line-height: 1.5;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}

/* ─── IRS Compliance: Paid Preparer Section ──────────────────────────── */
.f1040-preparer-section {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.f1040-preparer-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--irs-blue);
  margin-bottom: 10px;
}
.f1040-preparer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 16px;
}
.f1040-prep-cell { display: flex; flex-direction: column; gap: 2px; }
.f1040-prep-cell.wide { grid-column: span 2; }
.f1040-prep-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.f1040-prep-value {
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  min-height: 20px;
}
.f1040-ptin {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--irs-blue);
  letter-spacing: 1px;
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner { flex-direction: column; }
  .header-warning { display: none; }
  .form-row { flex-direction: column; }
  .field-group, .field-group.small { min-width: 100%; }
  .dependent-row { grid-template-columns: 1fr 1fr; }
  .f1040-line { font-size: 12px; }
  .step-label { display: none; }
  .step { padding: 6px 8px; }
}
