:root {
  --gold: #f6cc6d;
  --gold-border: #c6931f;
  --navy: #0b3b80;
  --deep-navy: #002357;
  --cream: #f8f5ef;
  --border: #e6d9be;
  --text: #1b2f46;
}

body.fin-page {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.fin-hero {
  background: #003C85;
  text-align: center;
  padding: 38px 20px 42px;
  border-bottom: 4px solid #BC8A36;
}

.fin-hero h1 {
  margin: 0;
  color: #ffffff;
  font-size: 40px;
  font-weight: 800;
  line-height: 1.08;
}

.fin-hero p {
  margin-top: 8px;
  color: #f0c75e;
  font-weight: 600;
  font-size: 19px;
  line-height: 1.35;
}

.fin-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 20px 54px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.fin-card {
  background: #fffdf8;
  border: 1px solid #e2c98f;
  border-radius: 20px;
  padding: 18px 22px 16px;
}

.fin-card.outline {
  border: 1px solid #e2c98f;
}

.draft-panel {
  background: #fff9ef;
  border: 1px solid #e2c57b;
}

.fin-card h2 {
  margin: 0 0 6px;
  text-align: center;
  color: #0a274f;
  font-size: 24px;
  font-weight: 800;
}

.fin-card h3 {
  margin: 12px 0 6px;
  color: #0a274f;
  font-size: 18px;
  font-weight: 700;
}

.subtext {
  margin: 0 0 10px;
  text-align: center;
  color: #2b4060;
  font-size: 0.94rem;
}

.subtext.center { text-align: center; }
.subtext.narrow { max-width: 100%; margin-left: auto; margin-right: auto; }
.subtext.stacked span { display: block; }

.draft-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.draft-actions-end {
  margin-top: 18px;
}

.form-status-banner {
  min-height: 24px;
  margin-top: 12px;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0a274f;
}

.form-status-banner.is-visible {
  padding: 8px 12px;
  border: 1px solid #2456a8;
  border-radius: 12px;
  background: #eef4ff;
  color: #2456a8;
}

body.fin-page.profile-linked .draft-panel {
  display: none;
}

body.fin-page.profile-linked .draft-actions-end {
  margin-top: 14px;
}

.form-status-banner.is-success {
  border-color: #1e5f45;
  background: #ebf7f0;
  color: #1e5f45;
}

.form-status-banner.is-error {
  border-color: #a62424;
  background: #fef0f0;
  color: #a62424;
}

.pill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(200px, 1fr));
  gap: 14px 16px;
  margin: 10px 0 8px;
}

.household-grid .row {
  display: grid;
  grid-template-columns: repeat(3, minmax(200px, 1fr));
  gap: 14px 16px;
  align-items: center;
}

.pill-grid label {
  font-weight: 800;
  color: #0a274f;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pill-grid input,
.pill-grid select {
  border: 0;
  border-radius: 12px;
  padding: 12px 10px;
  font-size: 1rem;
  background: #fff;
  color: #0a274f;
}

.pill-grid input:focus,
.pill-grid select:focus {
  outline: none;
}

.callout {
  background: #f8efda;
  border: 1px solid #dcc38d;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 600;
  color: #2b1f10;
  text-align: center;
  font-size: 0.98rem;
}

.table-block { margin-top: 10px; }

.fin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 0.95rem;
}

.fin-table th,
.fin-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  height: 40px;
  vertical-align: middle;
}

.fin-table th {
  background: #f3e3bb;
  color: #4a3706;
  font-weight: 800;
}

.fin-table.striped tbody tr:nth-child(even) td { background: #fffdf8; }
.fin-table.striped tbody tr:nth-child(odd) td { background: #faf5e9; }

.fin-table .small {
  font-size: 0.72rem;
  font-weight: 400;
  font-style: italic;
}
.fin-table .indent { padding-left: 24px; }

.fin-table input {
  width: 97%;
  border: 0;
  border-radius: 0;
  padding: 2px 4px;
  background: transparent;
  height: 30px;
  color: #0a274f;
  font-size: 0.96rem;
}

.fin-table select {
  width: 97%;
  border: 0;
  border-radius: 0;
  padding: 2px 4px;
  background: transparent;
  height: 30px;
  color: #0a274f;
  font-size: 0.96rem;
}

.fin-table input:focus,
.fin-table select:focus {
  outline: none;
  border-color: transparent;
}

.household-table select {
  font-size: 0.92rem;
}

.single-col th:last-child,
.single-col td:last-child { width: 28%; }

.bank-table th:nth-child(1),
.bank-table td:nth-child(1) { width: 48%; }
.bank-table th:nth-child(2),
.bank-table td:nth-child(2) { width: 26%; }
.bank-table th:nth-child(3),
.bank-table td:nth-child(3) { width: 26%; }

.vehicle-table th:nth-child(1),
.vehicle-table td:nth-child(1) { width: 50%; }
.vehicle-table th:nth-child(2),
.vehicle-table td:nth-child(2) { width: 25%; }
.vehicle-table th:nth-child(3),
.vehicle-table td:nth-child(3) { width: 25%; }

.biz-table th:nth-child(1),
.biz-table td:nth-child(1) { width: 36%; }
.biz-table th:nth-child(2),
.biz-table td:nth-child(2) { width: 18%; }
.biz-table th:nth-child(3),
.biz-table td:nth-child(3) { width: 18%; }
.biz-table th:nth-child(4),
.biz-table td:nth-child(4) { width: 28%; }

.inc1099-table th:nth-child(1),
.inc1099-table td:nth-child(1) { width: 40%; }
.inc1099-table th:nth-child(2),
.inc1099-table td:nth-child(2),
.inc1099-table th:nth-child(3),
.inc1099-table td:nth-child(3),
.inc1099-table th:nth-child(4),
.inc1099-table td:nth-child(4) { width: 20%; }

.pl-table th:nth-child(1),
.pl-table td:nth-child(1) { width: 28%; }
.pl-table th:nth-child(2),
.pl-table td:nth-child(2) { width: 17%; }
.pl-table th:nth-child(3),
.pl-table td:nth-child(3) { width: 18%; }
.pl-table th:nth-child(4),
.pl-table td:nth-child(4) { width: 22%; }
.pl-table th:nth-child(5),
.pl-table td:nth-child(5) { width: 15%; }

.pl-custom-range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.pl-custom-range select {
  width: auto;
  min-width: 52px;
  padding: 0 2px;
  font-size: 0.82rem;
}

.w2-table th:nth-child(1),
.w2-table td:nth-child(1) { width: 50%; }
.w2-table th:nth-child(2),
.w2-table td:nth-child(2) { width: 25%; }
.w2-table th:nth-child(3),
.w2-table td:nth-child(3) { width: 25%; }

.supp-table th:nth-child(1),
.supp-table td:nth-child(1) { width: 40%; }
.supp-table th:nth-child(2),
.supp-table td:nth-child(2),
.supp-table th:nth-child(3),
.supp-table td:nth-child(3),
.supp-table th:nth-child(4),
.supp-table td:nth-child(4) { width: 20%; }

.cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.cta-row.left { justify-content: flex-start; }
.cta-row.right { justify-content: flex-end; }
.cta-row.center { justify-content: center; }

.section-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.btn-primary {
  border: 2px solid #2456a8;
  background: #2a63bf;
  color: #fff;
  padding: 8px 18px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary.gold {
  background: var(--gold);
  border-color: var(--gold-border);
  color: #071425;
}

.btn-secondary {
  border: 2px solid #0b2a5a;
  background: #0f2f66;
  color: #fff;
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}

.btn-secondary.add-btn {
  font-size: 0.85rem;
  padding: 6px 12px;
  background: #1b4a8f;
  border-color: #143c76;
}

.micro {
  font-size: 0.95rem;
  color: #2b4060;
}

.micro.small {
  font-size: 0.9rem;
}

details[data-fin-accordion] {
  margin-top: 10px;
  border-top: 1px solid #e7dcc3;
  padding-top: 8px;
}

details[data-fin-accordion] summary {
  font-weight: 700;
  color: #0a274f;
  cursor: pointer;
  list-style: none;
}

details[data-fin-accordion] summary::-webkit-details-marker {
  display: none;
}

details[data-fin-accordion] summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: #0f2f66;
  transition: transform 0.18s ease;
}

details[data-fin-accordion][open] summary::before {
  transform: rotate(90deg);
}

.status-note {
  font-weight: 600;
}

.status-note[data-state="saved"] {
  color: #1f5f2f;
}

.status-note[data-state="restored"] {
  color: #2456a8;
}

body.fin-page:not(.analysis-page) .fin-container {
  margin: 0 auto 34px;
  padding: 18px 24px 24px;
  background: #fffaf1;
  border: 1px solid #e2c98f;
  border-radius: 20px;
  gap: 0;
}

body.fin-page:not(.analysis-page) .fin-card,
body.fin-page:not(.analysis-page) .fin-card.outline,
body.fin-page:not(.analysis-page) .draft-panel {
  margin: 0;
  padding: 8px 0 10px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

body.fin-page:not(.analysis-page) .fin-card + .fin-card,
body.fin-page:not(.analysis-page) .fin-card + .callout,
body.fin-page:not(.analysis-page) .callout + .fin-card {
  margin-top: 14px;
}

body.fin-page:not(.analysis-page) .fin-card h2 {
  margin: 0 0 6px;
}

body.fin-page:not(.analysis-page) .fin-card h3 {
  margin: 10px 0 6px;
}

body.fin-page:not(.analysis-page) .subtext {
  margin: 0 0 8px;
}

body.fin-page:not(.analysis-page) .draft-actions,
body.fin-page:not(.analysis-page) .draft-actions-end,
body.fin-page:not(.analysis-page) .section-actions,
body.fin-page:not(.analysis-page) .cta-row {
  margin-top: 8px;
}

body.fin-page:not(.analysis-page) .table-block,
body.fin-page:not(.analysis-page) details[data-fin-accordion] {
  margin-top: 10px;
}

body.fin-page:not(.analysis-page) .callout {
  margin-left: 0;
  margin-right: 0;
}

body.fin-page:not(.analysis-page) .fin-table {
  margin-top: 4px;
  font-size: 0.92rem;
}

body.fin-page:not(.analysis-page) .fin-table th,
body.fin-page:not(.analysis-page) .fin-table td {
  padding: 6px 10px;
  height: 36px;
}

body.fin-page:not(.analysis-page) .fin-table input,
body.fin-page:not(.analysis-page) .fin-table select {
  width: 100%;
  height: 28px;
}

.tt-footer {
  margin-top: auto;
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.5in;
  }

  body.fin-page:not(.analysis-page) {
    background: #fff;
    color: #000;
    display: block;
    font-size: 10pt;
    line-height: 1.3;
    min-height: auto;
    orphans: 3;
    widows: 3;
  }

  body.fin-page:not(.analysis-page) .tt-header,
  body.fin-page:not(.analysis-page) .tt-footer,
  body.fin-page:not(.analysis-page) .fin-hero,
  body.fin-page:not(.analysis-page) .draft-panel,
  body.fin-page:not(.analysis-page) .draft-actions,
  body.fin-page:not(.analysis-page) .draft-actions-end,
  body.fin-page:not(.analysis-page) .section-actions,
  body.fin-page:not(.analysis-page) .cta-row,
  body.fin-page:not(.analysis-page) .row-remove,
  body.fin-page:not(.analysis-page) button,
  body.fin-page:not(.analysis-page) .form-status-banner,
  body.fin-page:not(.analysis-page) .status-note {
    display: none !important;
  }

  body.fin-page:not(.analysis-page) .fin-container {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 0;
    border-radius: 0;
    gap: 10px;
  }

  body.fin-page:not(.analysis-page) .fin-card,
  body.fin-page:not(.analysis-page) .fin-card.outline,
  body.fin-page:not(.analysis-page) details,
  body.fin-page:not(.analysis-page) .table-block,
  body.fin-page:not(.analysis-page) .callout {
    background: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    clip-path: none;
    break-inside: avoid-page;
    page-break-inside: avoid;
    margin-top: 8px;
  }

  body.fin-page:not(.analysis-page) .fin-card {
    padding: 0 0 10px;
  }

  body.fin-page:not(.analysis-page) details > * {
    display: block !important;
  }

  body.fin-page:not(.analysis-page) details summary {
    display: block !important;
    cursor: default;
    padding-left: 0;
  }

  body.fin-page:not(.analysis-page) details summary::before,
  body.fin-page:not(.analysis-page) details summary::-webkit-details-marker {
    display: none !important;
  }

  body.fin-page:not(.analysis-page) h1,
  body.fin-page:not(.analysis-page) h2,
  body.fin-page:not(.analysis-page) h3,
  body.fin-page:not(.analysis-page) summary {
    break-after: avoid;
    page-break-after: avoid;
    color: #000;
    margin-bottom: 4px;
  }

  body.fin-page:not(.analysis-page) .fin-table {
    break-inside: auto;
    page-break-inside: auto;
    table-layout: fixed;
    width: 100%;
    margin-top: 3px;
    font-size: 9pt;
  }

  body.fin-page:not(.analysis-page) .fin-table thead {
    display: table-header-group;
  }

  body.fin-page:not(.analysis-page) .fin-table tbody,
  body.fin-page:not(.analysis-page) .fin-table tfoot {
    break-inside: auto;
    page-break-inside: auto;
  }

  body.fin-page:not(.analysis-page) .fin-table tr,
  body.fin-page:not(.analysis-page) .fin-table th,
  body.fin-page:not(.analysis-page) .fin-table td {
    background: #fff !important;
    color: #000;
    border: 1px solid #888;
    break-inside: avoid;
    height: auto;
    page-break-inside: avoid;
    padding: 3px 5px;
    vertical-align: top;
  }

  body.fin-page:not(.analysis-page) .fin-table input,
  body.fin-page:not(.analysis-page) .fin-table select,
  body.fin-page:not(.analysis-page) .fin-table textarea,
  body.fin-page:not(.analysis-page) input,
  body.fin-page:not(.analysis-page) select,
  body.fin-page:not(.analysis-page) textarea {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #000;
    font: inherit;
    height: auto;
    min-height: 0;
    padding: 0;
    width: 100%;
  }

  body.fin-page:not(.analysis-page) textarea {
    min-height: 28px;
  }

  body.fin-page:not(.analysis-page) .subtext,
  body.fin-page:not(.analysis-page) .callout {
    color: #000;
    font-size: 9pt;
    line-height: 1.25;
    padding: 0;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .fin-card { padding: 16px; }
  .pill-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .fin-table th, .fin-table td { font-size: 0.9rem; }
  .draft-actions { align-items: flex-start; }
}
