:root {
  --bg: #eff3f7;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --text: #0f1728;
  --muted: #5e6978;
  --accent: #0d4778;
  --accent-strong: #0a3559;
  --line: #d7dfe8;
  --line-strong: #bac6d2;
  --success: #1a7f53;
  --warning: #9a6700;
  --shadow: 0 18px 42px rgba(15, 23, 40, 0.06);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.82), transparent 24%),
    linear-gradient(180deg, #f7f9fc 0%, #edf1f5 220px, #edf1f5 100%);
}

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

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 44px;
}

.utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.utility-items {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 24px;
  padding: 22px 0 20px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.12);
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 68px;
  height: 48px;
  object-fit: cover;
  object-position: center;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: #ffffff;
}

.brand-copy strong {
  display: block;
  font-size: 1.08rem;
  letter-spacing: 0.02em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.95rem;
}

.header-nav a {
  position: relative;
  padding-bottom: 6px;
  color: #233243;
}

.header-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.18s ease;
}

.header-nav a:hover::after,
.header-nav a:focus-visible::after {
  transform: scaleX(1);
}

.header-status {
  display: grid;
  justify-items: end;
  gap: 3px;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.75fr);
  gap: 28px;
  align-items: end;
  padding: 28px 0 26px;
}

.hero-strip.compact {
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.hero-kicker,
.hero-label,
.summary-key,
.label,
.step-index {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.hero-strip h1 {
  margin: 0 0 10px;
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  font-weight: 700;
}

.hero-text {
  margin: 0;
  max-width: 720px;
  color: #445162;
  font-size: 1.02rem;
  line-height: 1.65;
}

.progress-side {
  display: grid;
  gap: 14px;
}

.hero-point {
  padding: 0 0 14px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.1);
}

.hero-point:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.hero-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.hero-point strong {
  font-size: 0.98rem;
}

.flow-layout {
  padding-top: 28px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.request-panel {
  width: 100%;
  min-width: 0;
}

.flow-panel {
  padding: 24px;
}

.access-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: #f7fafc;
}

.access-banner strong {
  display: block;
  margin-bottom: 4px;
}

.access-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.access-copy {
  min-width: 220px;
}

.local-auth-panel {
  display: grid;
  flex: 1 1 560px;
  gap: 12px;
}

.auth-switch {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.auth-switch-button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: #435366;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-switch-button.active {
  background: var(--text);
  color: #ffffff;
}

.local-auth-form {
  margin: 0;
}

.local-auth-grid {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) auto;
  align-items: end;
  gap: 14px;
}

.local-auth-grid.verification-grid {
  grid-template-columns: minmax(180px, 1fr) auto auto;
}

.local-auth-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.session-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-status {
  padding: 11px 12px;
  border-left: 3px solid var(--line-strong);
  background: #ffffff;
  color: #435366;
  font-size: 0.9rem;
}

.auth-status.success {
  border-left-color: #99d3b4;
  background: #eef8f2;
  color: var(--success);
}

.auth-status.warning {
  border-left-color: #f2c66d;
  background: #fff6e5;
  color: var(--warning);
}

.form-stack {
  display: grid;
  gap: 18px;
}

.step-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.step-card.active {
  border-color: #b8c7d6;
}

.step-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.step-header h2 {
  margin: 4px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.step-index {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-grid {
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
}

.span-2 {
  grid-column: span 2;
}

.label {
  display: block;
  margin-bottom: 8px;
  color: #2f4052;
  font-size: 0.76rem;
  font-weight: 700;
}

.input,
.select {
  width: 100%;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  outline: none;
  appearance: none;
}

.select {
  padding-right: 26px;
  background-image:
    linear-gradient(45deg, transparent 50%, #516274 50%),
    linear-gradient(135deg, #516274 50%, transparent 50%);
  background-position:
    calc(100% - 14px) calc(50% - 2px),
    calc(100% - 8px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.input:focus,
.select:focus {
  border-bottom-color: var(--accent);
}

.field-note,
.muted {
  margin: 0;
  color: var(--muted);
}

.route-overview,
.review-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.summary-chip {
  min-width: 140px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #f9fbfd;
}

.summary-chip-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-chip strong {
  display: block;
  font-size: 0.95rem;
}

.route-section {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.network-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.network-pill {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
}

.network-pill.active {
  border-color: var(--text);
  background: var(--text);
  color: #ffffff;
}

.subtle-panel,
.inline-note {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.92rem;
}

.subtle-panel strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.95rem;
}

.step-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.step-actions.dual {
  flex-wrap: wrap;
}

.cta,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--text);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.thanks-link {
  text-decoration: none;
}

.thanks-hero {
  grid-template-columns: minmax(0, 1fr);
}

.cta {
  background: var(--text);
  color: #ffffff;
}

.ghost {
  background: transparent;
  color: var(--text);
}

.cta.small,
.ghost.small {
  min-height: 42px;
  padding: 0 16px;
}

.cta:hover,
.ghost:hover {
  border-color: var(--accent-strong);
}

.cta:hover {
  background: var(--accent-strong);
}

.ghost:hover {
  color: var(--accent-strong);
}

.cta:disabled,
.ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.quote-card {
  padding: 4px 0 0;
}

.quote-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.quote-row:first-child {
  padding-top: 0;
}

.quote-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.momo-payer-card {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.momo-payer-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.momo-payer-header strong {
  color: var(--text);
}

.momo-payer-header span {
  max-width: 360px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.momo-payer-grid {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 16px;
}

.feedback-stack {
  display: grid;
  gap: 12px;
}

.status-panel {
  padding: 16px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.status-panel-section + .status-panel-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.status-panel-section strong {
  display: block;
  margin-bottom: 8px;
}

.status-entry {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 0.92rem;
}

.status-entry span {
  color: var(--muted);
}

.processing-indicator {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.processing-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #d5dee8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}

.processing-copy strong {
  display: block;
  margin-bottom: 4px;
}

.processing-indicator.is-success .processing-spinner {
  border-top-color: var(--success);
  animation: none;
}

.processing-indicator.is-failed .processing-spinner {
  border-top-color: #b42318;
  animation: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status {
  padding: 14px 16px;
  border-left: 3px solid transparent;
  font-size: 0.92rem;
}

.status.success {
  background: #eef8f2;
  border-left-color: #99d3b4;
  color: var(--success);
}

.status.warning {
  background: #fff6e5;
  border-left-color: #f2c66d;
  color: var(--warning);
}

.hidden {
  display: none !important;
}

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

  .header-status {
    justify-items: start;
  }

  .step-header {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100%, calc(100% - 24px));
  }

  .utility-bar {
    display: none;
  }

  .app-header {
    gap: 12px;
    padding: 14px 0 12px;
  }

  .header-nav {
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .header-nav::-webkit-scrollbar {
    display: none;
  }

  .header-status,
  .progress-side {
    display: none;
  }

  .hero-strip {
    gap: 16px;
    padding: 16px 0 18px;
  }

  .hero-strip h1 {
    font-size: 2rem;
    line-height: 1.02;
  }

  .flow-panel,
  .step-card {
    padding: 16px;
  }

  .form-grid,
  .compact-grid,
  .step-actions {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .step-header,
  .access-banner {
    grid-template-columns: 1fr;
    display: grid;
  }

  .local-auth-grid {
    grid-template-columns: 1fr;
  }

  .auth-switch,
  .local-auth-session {
    width: 100%;
  }

  .auth-switch-button {
    flex: 1;
  }

  .cta,
  .ghost {
    width: 100%;
  }

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

  .summary-chip {
    width: 100%;
  }

  .momo-payer-header,
  .momo-payer-grid {
    grid-template-columns: 1fr;
    display: grid;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100%, calc(100% - 18px));
  }

  .brand-logo {
    width: 58px;
    height: 42px;
  }

  .hero-kicker {
    margin-bottom: 6px;
    font-size: 0.74rem;
  }

  .hero-strip h1 {
    font-size: 1.62rem;
  }

  .hero-text {
    font-size: 0.92rem;
  }

  .input,
  .select {
    padding: 12px 0;
    font-size: 16px;
  }

  .network-pills {
    grid-template-columns: 1fr;
  }

  .quote-row {
    gap: 10px;
    font-size: 0.92rem;
  }

  .quote-row strong {
    text-align: right;
  }
}

/* External browser payment notice */
.status.browser-hint {
  padding: 0;
  border: 1px solid var(--line);
  border-left: 4px solid #0f172a;
  background: #f8fafc;
  color: var(--text);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.browser-pay-card {
  display: block;
  padding: 16px;
}

.browser-pay-card.compact {
  padding: 12px 14px;
}

.browser-pay-icon {
  display: none;
}

.browser-pay-copy strong,
.payment-progress-card strong,
.pi-session-status strong {
  display: block;
  margin-bottom: 5px;
  color: #102033;
}

.browser-pay-copy p {
  margin: 0 0 12px;
  color: #475569;
  line-height: 1.48;
}

.browser-pay-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.browser-pay-note {
  color: #64748b;
  font-size: 0.84rem;
  line-height: 1.4;
}

.open-pi-button {
  border-color: var(--text) !important;
  background: var(--text) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

.open-pi-button:hover,
.open-pi-button:focus-visible {
  border-color: #334155 !important;
  background: #334155 !important;
}

.pi-session-status {
  display: grid;
  gap: 3px;
  border-left-width: 4px;
}

.pi-session-status span {
  color: inherit;
  opacity: 0.88;
}

.payment-progress-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #cfe8d8;
  border-left: 4px solid #1a7f53;
  background: linear-gradient(135deg, #effaf3 0%, #f6fff8 100%);
  color: #145c3d;
}

.payment-progress-card span {
  color: #3f6d58;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .browser-pay-card {
    grid-template-columns: 1fr;
  }

  .browser-pay-icon {
    width: 38px;
    height: 38px;
  }

  .browser-pay-actions {
    align-items: stretch;
  }

  .browser-pay-actions .cta {
    width: 100%;
  }
}
