:root {
  --bg: #f4f7f1;
  --surface: #ffffff;
  --surface-alt: #edf4eb;
  --text: #1a2a24;
  --muted: #4f645d;
  --brand: #0f7a52;
  --brand-dark: #0b5e3f;
  --accent: #d96f28;
  --line: #cbd8d1;
  --shadow: 0 18px 40px rgba(15, 49, 37, 0.1);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Sora", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #dce9dd 0%, var(--bg) 35%), var(--bg);
  line-height: 1.6;
}

h1,
h2,
h3 {
  font-family: "Source Serif 4", serif;
  line-height: 1.2;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(244, 247, 241, 0.88);
  border-bottom: 1px solid rgba(26, 42, 36, 0.08);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 0.9rem 0;
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
}

.logo-mark {
  display: inline-flex;
  width: 2.15rem;
  height: 2.15rem;
  background: var(--brand);
  border-radius: 4px;
}

.logo-mark svg {
  display: none;
}

.main-nav {
  display: none;
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  min-width: 260px;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border: 1px solid #d8e4de;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 49, 37, 0.14);
  overflow: hidden;
  z-index: 50;
  color: var(--muted);
  font-size: 0.95rem;
}

.main-nav.open {
  display: flex;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
  border-radius: 10px;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  z-index: 60;
}

.main-nav a:hover {
  color: var(--brand-dark);
}

.main-nav a {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid #e5eeea;
}

.main-nav a:last-child {
  border-bottom: 0;
}

.phone-link {
  font-size: 0.93rem;
  color: var(--brand-dark);
  font-weight: 600;
  white-space: nowrap;
}

.header-callout {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.preapprove-link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand-dark);
  text-decoration: underline;
}

.nav-auth {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.nav-auth .btn {
  padding: 0.45rem 0.9rem;
}

.hero {
  padding: 4.8rem 0 3.6rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: stretch;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  margin: 0 0 0.7rem;
}

.hero-eyebrow {
  font-size: 1rem;
  letter-spacing: 0.09em;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  margin-bottom: 0.9rem;
}

.lead {
  color: var(--muted);
  max-width: 52ch;
}

.hero-actions {
  display: flex;
  gap: 0.7rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  padding: 0.75rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 122, 82, 0.32);
}

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

.btn-secondary {
  background: #fff;
  color: var(--brand-dark);
  border: 1px solid var(--line);
}

.btn-sm {
  padding: 0.38rem 0.68rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.btn-success {
  background: #e7f6ee;
  color: #1f6b46;
  border: 1px solid #bfe2cd;
}

.btn-success:hover {
  background: #dbf1e5;
}

.btn-danger {
  background: #fff1f0;
  color: #8f2f28;
  border: 1px solid #e4b7b2;
}

.btn-danger:hover {
  background: #ffe5e2;
}

.text-link-btn {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.86rem;
  color: #355c50;
  text-decoration: underline;
  cursor: pointer;
}

.text-link-btn:hover {
  color: #1d4f3a;
}

.text-link-danger {
  color: #8f2f28;
}

.text-link-danger:hover {
  color: #6f1f1a;
}

.full {
  width: 100%;
}

.hero-badges {
  display: grid;
  gap: 0.5rem;
  padding: 0;
  margin: 1.3rem 0 0;
  list-style: none;
}

.hero-badges li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
}

.hero-badges li::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--brand);
}

.hero-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(26, 42, 36, 0.07);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.hero-card h2 {
  font-size: 1.45rem;
}

.hero-card p {
  color: var(--muted);
  margin-top: 0.4rem;
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
  margin-top: 1rem;
  flex: 1;
}

.lead-form button[type="submit"] {
  margin-top: auto;
}

label {
  display: grid;
  gap: 0.34rem;
  font-size: 0.89rem;
  font-weight: 500;
}

input,
select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.82rem;
  font: inherit;
}

input:focus,
select:focus {
  outline: 2px solid rgba(15, 122, 82, 0.3);
  border-color: var(--brand);
}

.fine-print {
  margin: 0;
  font-size: 0.78rem;
  color: #6f837c;
}

.form-status {
  min-height: 1.2rem;
  margin-top: 0.5rem;
  font-size: 0.89rem;
  color: var(--brand-dark);
}

.field-error {
  margin: 0.15rem 0 0;
  min-height: 1rem;
  font-size: 0.78rem;
  color: #b42318;
}

input.input-error {
  border-color: #d14a3a;
  outline-color: rgba(209, 74, 58, 0.25);
}

.stats {
  padding: 1.3rem 0 2.2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stats-grid article {
  background: var(--surface-alt);
  border: 1px solid #dae5de;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.stats-grid h3 {
  font-size: 1.7rem;
}

.stats-grid p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.section {
  padding: 3.4rem 0;
}

.section-head {
  max-width: 760px;
  margin-bottom: 1.3rem;
}

.section-head h2 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  margin-bottom: 0.7rem;
}

.section-head p {
  color: var(--muted);
  margin: 0;
}

.rate-table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(26, 42, 36, 0.1);
  overflow-x: auto;
}

.rate-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.rate-table th,
.rate-table td {
  text-align: left;
  padding: 0.9rem;
  border-bottom: 1px solid #e6eeea;
}

.rate-table th {
  color: #315247;
  background: #f2f7f4;
  font-size: 0.9rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.4rem;
  align-items: start;
}

.calc-card {
  background: var(--surface);
  border: 1px solid #d9e6df;
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  display: grid;
  gap: 0.7rem;
}

.calc-result {
  margin: 0.4rem 0 0;
  font-weight: 600;
  color: var(--brand-dark);
}

.calc-breakdown {
  display: grid;
  gap: 0.2rem;
  margin: 0.7rem 0 0.2rem;
  color: var(--muted);
}

.calc-breakdown p {
  margin: 0;
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}

.process-grid article {
  background: var(--surface);
  border: 1px solid #d6e5dd;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.process-grid span {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #e7f0ea;
  color: var(--brand-dark);
  font-weight: 700;
}

.process-grid h3 {
  margin: 0.7rem 0 0.5rem;
  font-size: 1.1rem;
}

.process-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.faq-list {
  display: grid;
  gap: 0.7rem;
}

.eligibility-unified-card {
  background: var(--surface);
  border: 1px solid #d7e4dd;
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

.eligibility-form-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  align-items: start;
  width: 100%;
}

.eligibility-address-label {
  display: grid;
  gap: 0.34rem;
  width: 100%;
}

.eligibility-address-label .field-error {
  margin-top: 0.06rem;
}

.eligibility-address-label .field-error:empty {
  display: none;
}

.eligibility-input-wrap {
  position: relative;
  width: 100%;
  margin-top: 0.8rem;
}

.eligibility-input-wrap #eligAddress {
  width: 100%;
  padding-right: 15rem;
  min-height: 2.8rem;
}

.eligibility-inline-submit {
  position: absolute;
  right: 0.32rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
  line-height: 1.1;
  z-index: 3;
  white-space: nowrap;
  transition: none;
}

.eligibility-inline-submit:hover {
  transform: translateY(-50%);
  background: var(--brand);
}

.address-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.2rem);
  background: #fff;
  border: 1px solid #cfe0d8;
  border-radius: 10px;
  box-shadow: 0 12px 22px rgba(15, 49, 37, 0.14);
  z-index: 12;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.address-suggestions.visible {
  display: block;
}

.address-suggestion-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #e7efeb;
  background: #fff;
  color: #244338;
  padding: 0.56rem 0.68rem;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.address-suggestion-item:last-child {
  border-bottom: 0;
}

.address-suggestion-item:hover,
.address-suggestion-item:focus {
  background: #eff6f2;
  outline: none;
}

.map-btn {
  min-width: 2.2rem;
  padding: 0.4rem 0.75rem;
  border-radius: 10px;
  position: relative;
  z-index: 4;
}

.map-frame {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #c5d7ce;
  aspect-ratio: auto;
  background: linear-gradient(120deg, #d7e7de 0%, #ecf4ef 100%);
  margin-bottom: 0.8rem;
  cursor: grab;
  user-select: none;
  touch-action: none;
  width: 100%;
  min-height: 380px;
}

.map-frame.is-dragging {
  cursor: grabbing;
}

.map-controls-inside {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 4;
}

.map-hint {
  position: absolute;
  right: 0.6rem;
  bottom: 0.55rem;
  margin: 0;
  padding: 0.28rem 0.45rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #2f4f43;
  z-index: 4;
  pointer-events: none;
}

.map-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  will-change: transform;
  pointer-events: none;
}

.map-frame img.visible {
  display: block;
}

#usdaMapImage {
  opacity: 0.72;
}

.map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -100%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #c7361d;
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
  will-change: transform;
  pointer-events: none;
}

.map-pin.visible {
  display: block;
}

.eligibility-meta-line {
  margin: 0.2rem 0 0;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
}

.official-map-note a {
  color: inherit;
  text-decoration: underline;
}

details {
  border: 1px solid #d7e4dd;
  border-radius: var(--radius-md);
  background: #fff;
  padding: 0.95rem 1rem;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

details p {
  margin: 0.6rem 0 0;
  color: var(--muted);
}

.contact-card {
  background: linear-gradient(140deg, #1f6f4f 0%, #14553b 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
}

.contact-card p {
  margin: 0.5rem 0 0;
  max-width: 58ch;
}

.site-footer {
  border-top: 1px solid #d6e2db;
  padding: 1.1rem 0 1.5rem;
  font-size: 0.86rem;
  color: #5e746d;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.7rem;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .hero-grid,
  .calc-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .process-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .phone-link {
    display: none;
  }

  .eligibility-unified-card {
    height: auto;
  }
}

@media (max-width: 620px) {
  .hero {
    padding-top: 3.4rem;
  }

  .stats-grid,
  .process-grid {
    grid-template-columns: 1fr;
  }

  .eligibility-form-inline {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .eligibility-input-wrap #eligAddress {
    padding-right: 11.5rem;
  }

  .eligibility-inline-submit {
    padding: 0.42rem 0.62rem;
    font-size: 0.74rem;
  }

  .contact-card {
    align-items: flex-start;
    flex-direction: column;
  }
}

.app-shell {
  padding-top: 2.2rem;
}

.app-title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin-bottom: 0.7rem;
}

.progress-wrap {
  background: var(--surface);
  border: 1px solid #d8e4de;
  border-radius: var(--radius-md);
  padding: 0.9rem;
  margin-bottom: 1rem;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.progress-meta strong {
  color: var(--brand-dark);
  font-size: 0.94rem;
}

.progress-meta span {
  color: var(--muted);
  font-size: 0.88rem;
}

.progress-track {
  width: 100%;
  height: 0.6rem;
  border-radius: 999px;
  background: #e8f0eb;
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f7a52 0%, #2ea06f 100%);
  transition: width 0.25s ease;
}

.app-grid {
  display: grid;
  gap: 1rem;
}

.app-card {
  background: var(--surface);
  border: 1px solid #d8e4de;
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  box-shadow: 0 10px 22px rgba(15, 49, 37, 0.06);
}

.app-card h2 {
  font-size: 1.35rem;
  margin-bottom: 0.8rem;
}

.app-step {
  display: none;
}

.app-step.active-step {
  display: block;
}

.field-grid {
  display: grid;
  gap: 0.8rem;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.loan-type-group {
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}

.loan-type-group legend {
  margin-bottom: 0.5rem;
  font-size: 0.89rem;
  font-weight: 500;
}

.loan-type-options {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.loan-type-option {
  position: relative;
}

.loan-type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.loan-type-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.75rem;
  border: 1px solid #cbd8d1;
  border-radius: 999px;
  background: #fff;
  color: #27473c;
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.loan-type-option input:checked + span {
  background: #0f7a52;
  border-color: #0f7a52;
  color: #fff;
}

.loan-type-option input:focus-visible + span {
  outline: 2px solid rgba(15, 122, 82, 0.35);
  outline-offset: 2px;
}

.range-field {
  align-content: start;
}

.range-field input[type="range"] {
  width: 100%;
  padding: 0;
}

.range-field span {
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.95rem;
}

.app-actions p {
  margin: 0.5rem 0 1rem;
  color: var(--muted);
}

.asset-detail-card {
  display: grid;
  gap: 0.8rem;
}

.income-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  width: 100%;
}

.asset-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.asset-items {
  display: grid;
  gap: 0.6rem;
}

.asset-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
  border: 1px solid #d9e5df;
  border-radius: 10px;
  padding: 0.55rem;
  background: #fbfdfc;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.asset-item-row.liability-item-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 0.95fr) minmax(0, 1fr) auto;
}

.asset-item-row.reo-item-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr) minmax(0, 0.95fr) minmax(0, 1fr) minmax(0, 1fr) auto;
}

.asset-item-row.employment-item-row {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(0, 0.95fr) minmax(0, 1fr) auto;
}

.asset-item-row.employment-summary-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.7rem;
}

.employment-summary-main {
  min-width: 0;
}

.employment-summary-title {
  font-weight: 700;
  color: #1f372e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employment-summary-sub {
  margin-top: 0.12rem;
  font-size: 0.82rem;
  color: #5a7068;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.employment-summary-tags {
  display: inline-flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.employment-summary-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.36rem;
  border: 1px solid #d5e4dd;
  border-radius: 999px;
  background: #f4f8f6;
  font-size: 0.72rem;
  color: #496157;
}

.employment-summary-total {
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
}

.employment-summary-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.asset-item-row.residence-item-row {
  grid-template-columns:
    minmax(0, 0.75fr)
    minmax(0, 0.85fr)
    minmax(0, 1.2fr)
    minmax(0, 0.95fr)
    minmax(0, 0.45fr)
    minmax(0, 0.7fr)
    minmax(0, 0.45fr)
    minmax(0, 0.45fr)
    auto;
}

.asset-item-row.residence-item-row.residence-summary-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.7rem;
}

.asset-item-row .btn {
  align-self: center;
}

.asset-item-row > label {
  min-width: 0;
}

.asset-item-row > label input,
.asset-item-row > label select {
  width: 100%;
  min-width: 0;
}

.asset-total-row {
  margin-top: 0.2rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
  text-align: right;
}

.asset-total-row strong {
  color: var(--brand-dark);
  font-size: 1.02rem;
}

.declarations-block {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.declarations-block h3 {
  font-size: 1.05rem;
  margin: 0;
}

.declarations-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.8rem;
}

.doc-inline-check .decl-choice-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: #3d5e52;
  margin-left: 0.2rem;
}

.decl-no-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.6rem;
}

.action-row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.step-pagination {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
}

.step-pagination .btn {
  min-width: 8.5rem;
}

.xml-preview {
  margin-top: 1.1rem;
  background: #102119;
  color: #d4e7dd;
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.xml-preview h2 {
  margin-bottom: 0.6rem;
}

.xml-preview pre {
  margin: 0;
  overflow: auto;
  max-height: 480px;
  font-size: 0.78rem;
  line-height: 1.45;
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

@media (max-width: 760px) {
  .field-grid.two {
    grid-template-columns: 1fr;
  }

  .asset-item-row {
    grid-template-columns: 1fr;
  }

  .income-sections {
    grid-template-columns: 1fr;
  }

  .declarations-grid {
    grid-template-columns: 1fr;
  }

  .asset-total-row {
    justify-content: space-between;
  }

}

.portal-shell {
  padding-top: 2rem;
}

.portal-auth,
.portal-dashboard {
  display: grid;
  gap: 1rem;
}

.portal-toggle {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: #e8f0eb;
  width: fit-content;
}

.portal-tab {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: #3a5f52;
}

.portal-tab.active {
  background: #fff;
  box-shadow: 0 4px 10px rgba(15, 49, 37, 0.1);
  color: var(--brand-dark);
}

.portal-card {
  background: var(--surface);
  border: 1px solid #d8e4de;
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.portal-card h2,
.portal-card h3 {
  margin-bottom: 0.6rem;
}

.portal-card h4 {
  margin: 0 0 0.45rem;
  font-family: "Source Serif 4", serif;
}

.portal-form {
  display: grid;
  gap: 0.7rem;
  max-width: 560px;
}

.hidden {
  display: none !important;
}

.portal-summary {
  background: linear-gradient(140deg, #1f6f4f 0%, #14553b 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.dashboard-tabs {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.dashboard-tab {
  border: 1px solid #d3e3dc;
  background: #f7fbf8;
  color: #36574b;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.dashboard-tab.active {
  background: #e7f5ee;
  border-color: #9eccb8;
  color: #194f38;
}

.dashboard-view.hidden {
  display: none;
}

.portal-divider {
  border: 0;
  border-top: 1px solid #dbe8e1;
  margin: 1rem 0;
}

.application-list {
  display: grid;
  gap: 0.55rem;
}

.application-row {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  border: 1px solid #dbe8e1;
  border-radius: 10px;
  background: #f9fcfa;
  padding: 0.6rem 0.7rem;
}

.application-meta p {
  margin: 0.1rem 0 0;
}

.officer-app-preview {
  margin: 0.35rem 0 0;
  background: #102119;
  color: #d4e7dd;
  border-radius: 12px;
  padding: 0.8rem;
  max-height: 420px;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.45;
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

.pipeline-table-wrap {
  overflow: auto;
}

.officer-screen {
  display: grid;
  gap: 1rem;
}

.officer-backbar {
  display: flex;
  justify-content: flex-start;
}

.pipeline-pagination {
  margin-top: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pipeline-page-btn {
  background: #eceff2;
  border-color: #d0d7de;
  color: #2e475a;
}

.pipeline-page-btn:hover {
  background: #e4e9ee;
}

.pipeline-tools {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.pipeline-search {
  min-width: 300px;
  flex: 1 1 320px;
}

.pipeline-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

.pipeline-table th,
.pipeline-table td {
  text-align: left;
  border-bottom: 1px solid #e2ece7;
  padding: 0.65rem;
  vertical-align: middle;
}

.pipeline-table th {
  color: #315247;
  background: #f2f7f4;
  font-size: 0.87rem;
}

.pipeline-sort-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pipeline-table tr.selected {
  background: #ecf7f1;
}

.doc-request-missing {
  background: #fff2f2;
  border-color: #f0caca;
}

.doc-table-wrap {
  width: 100%;
  border: 1px solid #dbe8e1;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
}

.doc-table th,
.doc-table td {
  border-bottom: 1px solid #e2ece7;
  padding: 0.65rem;
  text-align: left;
  vertical-align: middle;
}

.doc-table th {
  background: #f2f7f4;
  color: #315247;
  font-size: 0.84rem;
}

.doc-col-name {
  font-weight: 600;
  color: #28473c;
}

.doc-request-missing-row {
  background: #fff2f2;
}

.doc-table-detail-row td {
  background: #fbfdfc;
}

.doc-table-detail-panel {
  display: grid;
  gap: 0.55rem;
}

.doc-table-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.7rem;
}

.doc-table-pagination {
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.officer-doc-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.officer-doc-grid .doc-item-block {
  padding: 0.75rem;
}

.officer-doc-grid .upload-row {
  flex-wrap: nowrap;
  gap: 0.45rem;
}

.officer-doc-grid textarea {
  width: 100%;
}

.btn-danger-soft {
  border-color: #e4b7b2;
  background: #fff1f0;
  color: #8f2f28;
}

.btn-danger-soft:hover {
  background: #ffe5e2;
}

textarea {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.82rem;
  font: inherit;
  resize: vertical;
}

@media (max-width: 980px) {
  .officer-doc-grid {
    grid-template-columns: 1fr;
  }

  .doc-table-wrap {
    overflow: auto;
  }

  .doc-table {
    min-width: 780px;
  }
}

.officer-app-editor {
  border: 1px solid #d8e4de;
  border-radius: 12px;
  background: #fbfdfc;
  padding: 0.85rem;
}

.officer-edit-form {
  max-width: 100%;
}

.field-error {
  margin: 0.1rem 0 0;
  font-size: 0.76rem;
  color: #b13a2d;
}

.field-invalid {
  border-color: #b13a2d !important;
  box-shadow: 0 0 0 2px rgba(177, 58, 45, 0.14);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}

.milestone-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.5rem;
}

.milestone-item {
  border: 1px solid #d8e4de;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  color: #4f645d;
}

.milestone-item.current {
  border-color: #2a8f65;
  background: #ecf7f1;
  color: #1f6b4d;
  font-weight: 600;
}

.milestone-item.complete {
  border-color: #c8ddd2;
  background: #f4faf7;
}

.doc-list {
  display: grid;
  gap: 0.55rem;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #dbe8e1;
  border-radius: 10px;
}

.portal-actions .action-row {
  margin-top: 0.5rem;
}

@media (max-width: 760px) {
  .portal-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .application-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* LOS dashboard polish */
.pipeline-row {
  width: 100%;
  justify-content: space-between;
  background: #f9fcfa;
  border: 1px solid #d6e5dd;
}

.doc-item-block {
  display: block;
  background: #fbfdfb;
  border: 1px solid #d8e7df;
}

.doc-header {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
}

.doc-header-right {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-toggle-btn {
  border: 1px solid #d8e1dc;
  border-radius: 999px;
  background: #f6faf8;
  color: #395a4e;
  padding: 0.2rem 0.55rem;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.status-toggle-btn:hover {
  background: #edf5f1;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-badge.info {
  background: #e8f2ff;
  color: #1f4d8f;
  border-color: #c9defa;
}

.status-badge.warn {
  background: #fff5e8;
  color: #9a5a16;
  border-color: #f3d4aa;
}

.status-badge.success {
  background: #eaf8ef;
  color: #1b6b46;
  border-color: #bfe2cd;
}

.status-badge.muted {
  background: #f2f5f3;
  color: #5f746c;
  border-color: #d8e1dc;
}

.upload-form-inline {
  margin-top: 0.5rem;
  max-width: 100%;
}

.upload-stack {
  margin-top: 0.45rem;
}

.upload-row {
  justify-content: space-between;
  align-items: center;
}

.upload-meta {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.detail-top {
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #dbe7e0;
}

.detail-section {
  margin-top: 0.8rem;
}

.doc-footer-right {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

.doc-inline-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #4f645d;
}

.doc-inline-check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.comment-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(10, 26, 19, 0.5);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.comment-modal-panel {
  width: min(900px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #d5e3dc;
  border-radius: 14px;
  box-shadow: 0 20px 42px rgba(15, 49, 37, 0.24);
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
}

.employment-modal-panel {
  width: min(980px, 96vw);
}

.residence-modal-panel {
  width: min(1080px, 96vw);
}

.employment-modal-form {
  display: grid;
  gap: 0.85rem;
}

.employment-sheet-form {
  gap: 0.65rem;
}

.employment-sheet-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem 0.55rem;
}

.employment-sheet-meta label {
  font-size: 0.78rem;
  color: #4a6158;
  display: grid;
  gap: 0.2rem;
}

.employment-sheet-meta input,
.employment-sheet-meta select {
  height: 2rem;
  padding: 0.3rem 0.5rem;
}

.employment-meta-wide {
  grid-column: span 2;
}

.employment-sheet-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.employment-sheet-table th,
.employment-sheet-table td {
  border: 1px solid #d7e5de;
  padding: 0.32rem 0.45rem;
  font-size: 0.8rem;
  text-align: left;
}

.employment-sheet-table thead th {
  background: #eef5f1;
  color: #35574a;
  font-weight: 700;
}

.employment-sheet-table tbody td:first-child {
  color: #456056;
  width: 55%;
}

.employment-sheet-table input {
  width: 100%;
  min-width: 0;
  height: 1.9rem;
  padding: 0.28rem 0.45rem;
}

.employment-sheet-table .employment-sheet-group td {
  background: #f4f8f6;
  font-weight: 700;
  color: #3c5a4e;
}

.employment-toggle-link {
  border: 0;
  background: transparent;
  color: #2f5a4a;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.employment-toggle-link:hover {
  text-decoration: underline;
}

.employment-sheet-table tfoot th {
  background: #eef5f1;
  color: #27453a;
  font-weight: 700;
}

.employment-sheet-table tfoot input[readonly] {
  background: #f3f8f5;
  color: #224439;
  font-weight: 700;
}

.employment-sheet-flags {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.employment-subhead {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  color: #2d4a3f;
}

.employment-modal-total {
  border-top: 1px solid #d8e6df;
  padding-top: 0.5rem;
  margin-top: 0.1rem;
}

.employment-modal-total-wrap {
  border-top: 1px solid #d8e6df;
  padding-top: 0.5rem;
  margin-top: 0.1rem;
}

.employment-modal-total-wrap input[readonly] {
  background: #f3f8f5;
  color: #224439;
  font-weight: 700;
}

@media (max-width: 820px) {
  .employment-sheet-meta {
    grid-template-columns: 1fr;
  }

  .employment-meta-wide {
    grid-column: auto;
  }
}

.residence-modal-panel input[readonly] {
  background: #f3f8f5;
  color: #224439;
  font-weight: 700;
}

.calc-modal-panel {
  width: min(760px, 96vw);
}

.calc-popup-form {
  max-width: 100%;
}

.comment-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.comment-modal-head h3 {
  margin: 0;
}

.comment-history {
  display: grid;
  gap: 0.55rem;
}

.comment-row {
  border: 1px solid #d7e4dd;
  border-radius: 10px;
  background: #f8fbf9;
  padding: 0.6rem 0.7rem;
  display: grid;
  gap: 0.45rem;
}

.comment-row-text {
  margin: 0;
  color: #36554b;
}

.comment-compose {
  max-width: 100%;
}

.comment-review-wrap {
  border-top: 1px solid #dde9e3;
  padding-top: 0.75rem;
  display: grid;
  gap: 0.65rem;
}

.comment-upload-row {
  border: 1px solid #d8e6df;
  border-radius: 10px;
  background: #f9fcfa;
  padding: 0.65rem;
  display: grid;
  gap: 0.5rem;
}

.comment-upload-focus {
  border-color: #90c4ad;
  box-shadow: 0 0 0 2px rgba(63, 146, 106, 0.12);
}
