:root {
  color-scheme: light;
  --blue: #154273;
  --blue-2: #01689b;
  --blue-3: #e5f0f9;
  --blue-4: #f1f7fc;
  --yellow: #ffb612;
  --yellow-dark: #d99a00;
  --ink: #1b1b1b;
  --muted: #535353;
  --line: #d7d7d7;
  --line-strong: #b4b4b4;
  --surface: #f5f7fb;
  --panel: #ffffff;
  --success: #39870c;
  --warning: #f9e11e;
  --danger: #d52b1e;
  --focus: #007bc7;
  --radius: 8px;
  --shadow: 0 16px 36px rgba(21, 66, 115, 0.08);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.5;
  overflow-x: hidden;
}

main,
header,
section,
aside,
nav,
form {
  min-width: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

a {
  color: var(--blue-2);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.site-header {
  background: #fff;
}

.brand-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-top: 4px solid var(--blue);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
}

.brand-agency {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.brand-lockup strong {
  display: block;
  color: var(--blue);
  font-size: 1.24rem;
  line-height: 1.18;
  letter-spacing: 0;
}

.utility-nav {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.utility-nav a {
  color: var(--blue);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.hero-band {
  background: var(--blue);
  color: #fff;
}

.hero-inner,
.page-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding-inline: clamp(16px, 4vw, 48px);
}

.hero-inner {
  padding-block: 28px 34px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
}

.section-kicker,
.eyebrow {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-kicker {
  color: #dbeaf7;
}

.hero-grid h1 {
  margin: 2px 0 0;
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-grid p:not(.section-kicker) {
  max-width: 62ch;
  margin: 10px 0 0;
  color: #fff;
  font-size: 1.08rem;
}

.hero-tools {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.language-switch {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  overflow: hidden;
}

.language-button {
  min-width: 48px;
  min-height: 36px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.7);
  background: transparent;
  color: #fff;
  font-weight: 700;
}

.language-button:last-child {
  border-right: 0;
}

.language-button.is-active {
  background: #fff;
  color: var(--blue);
}

.topbar-actions,
.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions {
  justify-content: flex-end;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0 16px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.primary-button {
  color: #111;
  background: var(--yellow);
  border-color: var(--yellow);
}

.primary-button:hover:not(:disabled) {
  background: #ffd35c;
  border-color: #ffd35c;
}

.ghost-button {
  color: var(--blue);
  background: #fff;
  border-color: #fff;
}

.ghost-button:hover:not(:disabled) {
  background: var(--blue-3);
  border-color: var(--blue-3);
}

.panel .ghost-button {
  border-color: var(--blue-2);
}

.compact {
  min-height: 38px;
  padding-inline: 13px;
  font-size: 0.94rem;
}

.page-shell {
  padding-block: 26px 48px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px 16px;
  color: var(--blue);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(21, 66, 115, 0.05);
}

.step span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  color: var(--blue);
  background: var(--blue-3);
  border-radius: 999px;
  font-size: 0.9rem;
}

.step.is-active {
  border-color: var(--blue-2);
  box-shadow: inset 0 -4px 0 var(--yellow), 0 12px 28px rgba(1, 104, 155, 0.12);
}

.step.is-locked {
  color: var(--muted);
  pointer-events: none;
  background: #f7f7f7;
}

.step.is-locked span {
  color: var(--muted);
  background: #eeeeee;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  width: 100%;
  max-width: 100vw;
}

.workspace,
.results-rail {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.panel {
  min-width: 0;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.is-active-step {
  border-color: rgba(1, 104, 155, 0.38);
}

.result-panel {
  border-color: rgba(21, 66, 115, 0.22);
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--blue-2);
}

.panel-heading h2 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.dropzone {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: center;
  min-height: 154px;
  max-width: 100%;
  overflow: hidden;
  padding: 24px;
  color: var(--blue);
  background: var(--blue-4);
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}

.dropzone.is-dragging {
  border-color: var(--blue-2);
  background: var(--blue-3);
}

.dropzone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.intake-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.upload-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  color: var(--blue);
  background: #fff;
  border: 2px solid var(--blue-2);
  border-radius: var(--radius);
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.primary-upload {
  color: #111;
  background: var(--yellow);
  border-color: var(--yellow);
}

.upload-action:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.upload-action:hover {
  background: var(--blue-3);
}

.primary-upload:hover {
  background: #ffd35c;
  border-color: #ffd35c;
}

.dropzone-title {
  max-width: 42ch;
  justify-self: center;
  color: var(--blue);
  font-size: 1.12rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dropzone-meta,
.status-line,
.empty-state,
.file-meta,
.benefit-meta,
.small {
  color: var(--muted);
  font-size: 0.92rem;
}

.controls-row {
  justify-content: space-between;
  margin-top: 16px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  color: var(--ink);
  font-weight: 700;
}

.toggle input {
  width: 19px;
  height: 19px;
  accent-color: var(--blue-2);
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 260px);
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue-2);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.autofill-notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  color: #14350a;
  background: #eef7e8;
  border-left: 4px solid var(--success);
  border-radius: var(--radius);
  font-weight: 700;
}

[data-autofilled="true"] {
  border-color: var(--success) !important;
  background: #fbfff8 !important;
}

.file-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 11px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.file-item strong,
.file-item span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--blue);
  background: var(--blue-3);
  border-left: 4px solid var(--blue-2);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: normal;
}

.pill.warning {
  color: #5b4300;
  background: #fff8d1;
  border-left-color: var(--yellow-dark);
}

.pill.danger {
  color: #7a1611;
  background: #fdecea;
  border-left-color: var(--danger);
}

.pill.success {
  color: #245508;
  background: #eef7e8;
  border-left-color: var(--success);
}

.status-line {
  min-height: 24px;
  margin-top: 12px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.form-toggle {
  align-self: end;
  min-height: 44px;
  padding-bottom: 1px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  background: transparent;
}

.metric {
  display: grid;
  align-content: center;
  min-height: 92px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(21, 66, 115, 0.06);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 4px;
  color: var(--blue);
  font-size: clamp(1.36rem, 3vw, 1.7rem);
  line-height: 1;
  letter-spacing: 0;
}

.benefit-list,
.stack {
  display: grid;
  gap: 12px;
}

.benefit-card,
.debt-card,
.letter-card {
  min-width: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.benefit-card {
  border-left: 4px solid var(--blue-2);
}

.debt-card {
  border-left: 4px solid var(--yellow);
}

.letter-card {
  border-left: 4px solid var(--blue);
}

.benefit-card header,
.debt-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.benefit-card h3,
.debt-card h3,
.letter-card h3 {
  margin: 0;
  color: var(--blue);
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.benefit-card p,
.debt-card p,
.letter-card p {
  margin-block: 8px 0;
}

.benefit-value {
  color: var(--success);
  font-weight: 700;
  white-space: nowrap;
}

.confidence {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.confidence-bar {
  width: 70px;
  height: 8px;
  background: #e1e1e1;
  overflow: hidden;
}

.confidence-bar span {
  display: block;
  height: 100%;
  background: var(--blue-2);
}

.inline-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.inline-list li {
  max-width: 100%;
}

.timeline-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.timeline-table th,
.timeline-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.timeline-table th {
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.action-preview {
  display: grid;
  gap: 12px;
}

.letter-card ul,
.debt-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.letter-card pre {
  max-height: 220px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  white-space: pre-wrap;
}

a.source-link {
  color: var(--blue-2);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.45);
}

.modal-card {
  width: min(560px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
  padding: 22px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.modal-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.modal-heading h2 {
  margin: 3px 0 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.qr-code {
  display: grid;
  place-items: center;
  width: min(300px, 100%);
  margin: 18px auto 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.qr-code svg {
  display: block;
  width: 100%;
  height: auto;
}

.pairing-url {
  margin: 0;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: center;
}

/* ── Payment plan phases ─────────────────────────────────── */

.plan-total-badge {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
  align-self: center;
}

.plan-phases {
  display: grid;
  gap: 10px;
}

.plan-phase {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue-2);
  border-radius: var(--radius);
  overflow: hidden;
}

.plan-phase--urgent {
  border-left-color: var(--danger);
}

.plan-phase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}

.plan-phase-num {
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-phase-range {
  color: var(--muted);
}

.plan-focus-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  flex-wrap: wrap;
}

.plan-focus-info {
  flex: 1;
  min-width: 0;
}

.plan-focus-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.plan-focus-title strong {
  font-size: 1rem;
  color: var(--ink);
}

.plan-focus-action {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.plan-focus-stats {
  display: flex;
  gap: 20px;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: flex-start;
}

.plan-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.plan-stat-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.plan-stat-primary {
  color: var(--blue);
  font-size: 1.05rem;
}

.plan-parallel {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.plan-parallel-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-token-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-token-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink);
}

.plan-token-meta {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

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

  .hero-tools,
  .topbar-actions {
    justify-items: start;
    justify-content: flex-start;
  }

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

@media (max-width: 680px) {
  .brand-strip,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .utility-nav {
    gap: 12px;
  }

  .hero-inner,
  .page-shell {
    padding-inline: 14px;
  }

  .hero-inner {
    padding-block: 18px 22px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .stepper,
  .summary-strip,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }

  .dropzone {
    min-height: 138px;
    padding: 18px;
  }

  .dropzone-title {
    max-width: 25ch;
  }

  .intake-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .upload-action {
    width: 100%;
  }

  .controls-row,
  .inline-field {
    align-items: stretch;
    flex-direction: column;
  }

  .file-item,
  .benefit-card header,
  .debt-card header,
  .modal-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .benefit-value {
    white-space: normal;
  }
}

@media print {
  .site-header,
  .workspace,
  .summary-strip,
  .stepper {
    display: none;
  }

  .page-shell,
  .app-shell {
    display: block;
    padding: 0;
  }

  .panel {
    border: 0;
  }
}
