:root {
  color-scheme: light;
  --ink: #20242a;
  --muted: #73777d;
  --line: #e8e9ec;
  --surface: #ffffff;
  --soft: #f6f7f9;
  --brand: #a93687;
  --brand-dark: #86286d;
  --accent: #ff5b2f;
  --india-magenta: #a93687;
  --india-magenta-dark: #86286d;
  --danger: #b64943;
  --success: #1c9561;
  --shadow: 0 16px 38px rgba(34, 48, 73, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #edf0f5;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.shell {
  min-height: 100vh;
  padding: 18px 14px 44px;
}

.app-frame {
  width: min(100%, 980px);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid rgba(23, 34, 44, 0.07);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 0;
  background: var(--brand);
  color: white;
}

.status-link {
  color: white;
  font-size: 12px;
  font-weight: 720;
  text-decoration: none;
}

.status-link:hover { text-decoration: underline; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 760;
  letter-spacing: 0;
}

.brand-mark {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: contain;
}

.topbar-account {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  line-height: 1.25;
}

.topbar-account strong {
  color: white;
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.topbar-actions { margin-top: 0; }

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: end;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-nav .status-link {
  opacity: .82;
}

.admin-nav .status-link.active {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

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

.admin-menu-card {
  display: grid;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.admin-menu-card p {
  margin-bottom: 8px;
}

.admin-menu-card .button {
  justify-self: start;
}

.content { display: block; }

.main {
  min-width: 0;
  padding: 26px;
  background: #f8f9fb;
}

.side {
  min-width: 0;
  padding: 22px 18px;
  border-left: 1px solid var(--line);
  background: #f8fbfb;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: clamp(26px, 5vw, 38px); line-height: 1.08; }
h2 { margin-bottom: 8px; font-size: 24px; line-height: 1.2; }
h3 { margin-bottom: 7px; font-size: 15px; }
p { color: var(--muted); line-height: 1.55; }

.eyebrow {
  margin-bottom: 10px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.eyebrow.inverse { color: #c9d9ff; }

.home-hero {
  position: relative;
  overflow: hidden;
  margin: -26px -26px 20px;
  padding: 25px 26px 26px;
  background: #2458bf;
  color: white;
}

.home-hero::after {
  position: absolute;
  right: -40px;
  top: 0;
  width: 58%;
  height: 100%;
  background: rgba(255,255,255,.045);
  clip-path: polygon(38% 0, 100% 0, 100% 100%, 0 100%);
  content: "";
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
}

.application-range-title {
  position: relative;
  z-index: 1;
  margin: 0;
  color: white;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.08;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.hero-application {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  padding-top: 19px;
  border-top: 1px solid rgba(255,255,255,.22);
}

.hero-application-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.hero-application .card-kicker {
  display: block;
  color: #c9d9ff;
}

.hero-range {
  display: block;
  margin-top: 6px;
  color: white;
  font-size: 22px;
  line-height: 1.15;
}

.hero-application .status-chip {
  background: rgba(255,255,255,.14);
  color: white;
}

.hero-application .status-chip.success {
  background: rgba(177, 239, 204, .18);
  color: #d6ffe4;
}

.hero-application .status-chip.warn {
  background: rgba(255, 230, 163, .18);
  color: #fff0bd;
}

.hero-application .status-chip.fail {
  background: rgba(255, 210, 205, .18);
  color: #ffd8d4;
}

.card-kicker, .mini-label { color: var(--muted); font-size: 11px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.status-chip { padding: 6px 9px; background: #eef1f6; color: var(--muted); font-size: 11px; font-weight: 760; }
.status-chip.success { background: #e8f7ef; color: var(--success); }
.status-chip.warn { background: #fff5df; color: #966515; }
.status-chip.fail { background: #fff0ee; color: var(--danger); }
.amount-disclosure { margin: 10px 0 16px; font-size: 12px; }
.hero-application .amount-disclosure { color: #d8e3ff; }
.application-meta { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 7px 12px; margin-bottom: 18px; color: var(--muted); font-size: 12px; }
.application-meta strong { color: var(--ink); font-size: 12px; }
.button-wide { width: 100%; }
.hero-application .application-meta { color: #c9d9ff; }
.hero-application .application-meta strong { color: white; }
.contract-panel { display: grid; gap: 16px; }
.contract-copy {
  max-height: 430px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  white-space: pre-wrap;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.contract-acceptance { display: grid; gap: 14px; }
.checkbox-field { display: flex; align-items: flex-start; gap: 9px; color: var(--ink); font-size: 13px; line-height: 1.45; }
.checkbox-field input { width: 17px; height: 17px; margin: 1px 0 0; flex: 0 0 auto; }
.button.hero-cta {
  border-color: var(--india-magenta);
  background: var(--india-magenta);
  color: white;
  box-shadow: 0 8px 18px rgba(76, 12, 70, .22);
}
.button.hero-cta:hover { background: var(--india-magenta-dark); }

.checklist-panel { margin-top: 16px; }
.checklist-panel h3 { margin: 4px 0 0; }
.home-checklist { display: grid; gap: 0; margin-top: 15px; }
.check-item { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 12px 0; border-bottom: 1px solid var(--line); color: #a1a4a9; font-size: 13px; }
.check-item:last-child { border-bottom: 0; }
.check-item.done, .check-item.current { color: var(--ink); }
.check-item small { color: #a1a4a9; font-size: 11px; }
.check-item.done small { color: var(--success); }
.check-item.current small { color: var(--accent); }
.check-mark { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #d9dde3; border-radius: 50%; color: #a1a4a9; font-size: 11px; }
.check-item.done .check-mark { border-color: var(--success); background: var(--success); color: white; }
.check-item.current .check-mark { border-color: var(--accent); color: var(--accent); }
.home-actions { margin-top: 16px; }

.notice {
  padding: 14px 15px;
  border-left: 4px solid var(--accent);
  background: #fff8e7;
  color: #604919;
  font-size: 13px;
  line-height: 1.55;
}

.notice strong { color: #47330f; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  background: var(--brand);
  color: white;
  font-weight: 720;
}

.button:hover { background: var(--brand-dark); }
.button.secondary { border-color: var(--line); background: white; color: var(--ink); }
.button.secondary:hover { background: var(--soft); }
.button.warning { border-color: #efcd91; background: #fff8e7; color: #68480e; }
.button.danger { border-color: #e6b1ae; background: #fff3f2; color: var(--danger); }
.button:disabled { cursor: not-allowed; opacity: .55; }

.form {
  display: grid;
  gap: 15px;
  max-width: 520px;
  margin-top: 20px;
}

.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 730; }
.field small { color: var(--muted); line-height: 1.4; }
.field input, .field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd6da;
  background: white;
  color: var(--ink);
}
.field input:focus, .field select:focus { outline: 3px solid rgba(12, 107, 98, .16); border-color: var(--brand); }

.amount-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 24px 0;
  padding: 22px;
  background: var(--brand);
  color: white;
}

.amount-panel p { margin-bottom: 7px; color: #cce4e0; font-size: 13px; }
.amount { font-size: clamp(32px, 8vw, 58px); font-weight: 800; line-height: 1; }
.amount-caption { max-width: 190px; color: #d9efeb; font-size: 12px; line-height: 1.45; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 18px;
}

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

.panel.soft { background: var(--soft); }
.panel p:last-child { margin-bottom: 0; }

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.status-row:last-child { border-bottom: 0; }
.status { font-weight: 740; color: var(--muted); text-align: right; }
.status.success { color: var(--success); }
.status.warn { color: #95651a; }
.status.fail { color: var(--danger); }

.progress {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin: 22px 0;
}
.progress span { height: 5px; background: #d8e2e4; }
.progress span.active { background: var(--brand); }
.progress span.done { background: var(--success); }

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

.step-count { color: var(--muted); font-size: 13px; white-space: nowrap; }

.progress-labels { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 20px 0 6px; }
.progress-labels span { overflow: hidden; color: #9ca2aa; font-size: 10px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.progress-labels span.active { color: var(--brand); font-weight: 760; }
.progress-labels span.done { color: var(--success); }
.step-panel { position: relative; padding: 22px; }
.step-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 15px; background: #e9efff; color: var(--brand); font-size: 12px; font-weight: 800; }
.step-panel h3 { font-size: 20px; }
.step-panel > p { max-width: 620px; }
.status-list { margin-top: 17px; border-top: 1px solid var(--line); }
.review-status { display: flex; align-items: center; gap: 12px; margin: 19px 0; padding: 15px; background: #f5f8ff; }
.review-status strong, .review-status small { display: block; }
.review-status small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.review-spinner { width: 22px; height: 22px; border: 3px solid #ccdafd; border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.compact-notice { margin-top: 17px; }
.video-preview { display: grid; place-items: center; gap: 8px; min-height: 160px; margin: 18px 0; border: 1px dashed #b9c8ec; background: #f4f7ff; text-align: center; }
.video-preview small { color: var(--muted); font-size: 11px; }
.camera-mark { display: grid; place-items: center; width: 58px; height: 40px; background: var(--brand); color: white; font-size: 10px; font-weight: 800; }
.success-icon { background: #e9f8ef; color: var(--success); }

.timeline { display: grid; gap: 0; margin-top: 15px; }
.timeline-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
}
.timeline-dot {
  width: 10px;
  height: 10px;
  margin: 4px 0 0 2px;
  border: 2px solid #bbcacc;
  background: white;
}
.timeline-dot.done { border-color: var(--success); background: var(--success); }
.timeline-dot.current { border-color: var(--brand); background: white; }
.timeline-text { font-size: 12px; color: var(--muted); line-height: 1.35; }
.timeline-text strong { display: block; color: var(--ink); font-size: 13px; }

.side h3 { margin-top: 0; }
.side-section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.side-section:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.side label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.side select { width: 100%; min-height: 38px; padding: 7px; border: 1px solid #cbd6da; background: white; }
.event-log { display: grid; gap: 7px; max-height: 240px; overflow: auto; }
.event {
  padding: 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.event strong { display: block; color: var(--ink); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(11, 25, 29, .54);
}
.modal {
  width: min(100%, 580px);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  padding: 24px;
  background: white;
  box-shadow: var(--shadow);
}
.modal .actions { justify-content: end; }

.error-box {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid #e5b5b1;
  background: #fff4f3;
}
.error-box h3 { color: var(--danger); }
.error-box p { margin-bottom: 0; color: #744540; }
.error-dismiss {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 24px;
  line-height: 1;
}
.error-dismiss:hover { background: #fbe2df; }

.status-machine { display: grid; gap: 16px; }
.status-machine > p { max-width: 700px; margin-bottom: 0; }
.status-machine-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.status-machine select {
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #cbd6da;
  background: white;
}
.status-machine .button { margin-top: 12px; }
.mock-control { display: inline-flex; align-items: center; justify-content: end; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.mock-control input { width: 110px; min-height: 38px; padding: 8px 10px; border: 1px solid #cbd6da; background: white; color: var(--ink); }
.mock-control .button { margin-top: 0; }
.mock-control .status + .button { margin-left: 8px; }
.mock-action { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.mock-action small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.45; }
.mock-action .button { flex: 0 0 auto; margin-top: 0; }
.mock-action + .mock-action { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.state-table { margin-top: 0; }
.status-row.compact { padding: 5px 0; font-size: 12px; }
.table-scroll { overflow-x: auto; }
.ops-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ops-table th, .ops-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.ops-table th { color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.ops-table td strong, .ops-table td small { display: block; }
.ops-table td small, .otp-ops-card small { color: var(--muted); line-height: 1.45; }
.ops-table .table-action { min-height: 32px; margin: 0 4px 4px 0; padding: 6px 9px; font-size: 11px; }
.otp-ops-list { display: grid; gap: 12px; }
.otp-ops-card { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.otp-ops-card > div:first-child { display: grid; gap: 3px; }
.otp-control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.otp-control input { width: 120px; }
.compact-form { gap: 10px; }

.topay-console { max-width: 100%; }
.topay-console .panel { display: grid; gap: 14px; }
.topay-console h1 { font-size: 30px; }
.topay-config-grid { display: grid; grid-template-columns: minmax(190px, .7fr) minmax(0, 1.3fr); align-items: end; gap: 18px; }
.topay-base-url { display: grid; gap: 7px; min-width: 0; color: var(--muted); font-size: 12px; }
.topay-base-url code, .topay-path { overflow-wrap: anywhere; color: var(--ink); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.topay-config-flags { display: flex; grid-column: 1 / -1; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.topay-config-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.topay-config-actions .button { margin: 0; }
.topay-endpoint-line { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1.4fr); align-items: end; gap: 12px; }
.topay-endpoint-line select { width: 100%; min-height: 42px; padding: 9px; border: 1px solid #cbd6da; background: white; }
.topay-method, .topay-path { min-height: 42px; display: flex; align-items: center; padding: 8px 10px; background: var(--soft); }
.topay-method { color: var(--success); font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.topay-form { display: grid; gap: 18px; }
.topay-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.topay-wide { grid-column: 1 / -1; }
.topay-console textarea, .topay-console input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cbd6da;
  background: white;
  color: var(--ink);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.topay-console textarea:focus, .topay-console input:focus, .topay-console select:focus {
  outline: 3px solid rgba(169, 54, 135, .15);
  border-color: var(--brand);
}
.topay-console textarea { resize: vertical; }
.topay-console input { min-height: 42px; }
.topay-console .field small { font-size: 11px; }
.topay-header-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.topay-warning { padding: 13px 14px; border-left: 3px solid var(--accent); background: #fff5f0; color: #6d3828; font-size: 12px; line-height: 1.5; }
.topay-result-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; color: var(--muted); font-size: 12px; }
.topay-details { border-top: 1px solid var(--line); padding-top: 12px; }
.topay-details summary { cursor: pointer; color: var(--ink); font-size: 12px; font-weight: 700; }
.topay-details .mono { max-height: 300px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.topay-console .actions { margin-top: 0; }
.topay-console .state-list .status-row { display: grid; grid-template-columns: minmax(150px, .6fr) auto minmax(0, 1.5fr); align-items: start; }
.topay-console .state-list small { color: var(--muted); line-height: 1.45; }

.mono {
  padding: 10px;
  overflow-x: auto;
  background: #17222c;
  color: #d8efea;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.footer-note {
  margin-top: 22px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .shell { padding: 0; }
  .app-frame { min-height: 100vh; border: 0; }
  .main { padding: 24px 18px 30px; }
  .side { border-top: 1px solid var(--line); border-left: 0; }
  .status-machine-grid { grid-template-columns: 1fr; }
  .admin-menu-grid { grid-template-columns: 1fr; }
  .admin-nav { justify-content: start; gap: 8px; }
  .amount-panel { align-items: start; flex-direction: column; }
  .home-hero { margin: -24px -18px 18px; padding: 24px 18px 20px; }
  .topay-config-grid, .topay-endpoint-line, .topay-field-grid, .topay-header-grid { grid-template-columns: 1fr; }
  .topay-config-flags { grid-column: auto; }
  .topay-method, .topay-path { min-height: 38px; }
}

@media (min-width: 761px) {
  .content.with-side { display: grid; grid-template-columns: minmax(0, 1fr) 270px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .topbar { padding: 14px; }
  .topbar-account { align-items: end; font-size: 10px; }
  .topbar-account strong { font-size: 12px; }
  .main { padding: 22px 14px 28px; }
  .button { width: 100%; }
  .actions { display: grid; }
  .progress { gap: 3px; }
  .hero-copy { display: block; }
  .progress-labels { gap: 2px; }
  .progress-labels span { font-size: 8px; }
  .application-meta { grid-template-columns: auto 1fr; }
  .check-item { grid-template-columns: 25px minmax(0, 1fr); }
  .check-item small { grid-column: 2; }
  .topay-console .state-list .status-row { grid-template-columns: 1fr auto; }
  .topay-console .state-list small { grid-column: 1 / -1; }
  .topay-config-actions { align-items: start; flex-direction: column; }
}
