:root {
  --ink:        #0f1b2d;
  --ink-soft:   #3a4a63;
  --ink-mute:   #6b7a93;
  --line:       #d9e0ec;
  --line-soft:  #ecf0f7;
  --bg:         #f4f6fb;
  --card:       #ffffff;
  --saffron:    #d96a1f;
  --saffron-d:  #b8551a;
  --navy:       #133a6b;
  --navy-d:     #0d2a4e;
  --ok:         #1f7a4d;
  --ok-bg:      #e6f4ec;
  --warn:       #8a5a00;
  --warn-bg:    #fef3d6;
  --err:        #a32020;
  --err-bg:     #fbe6e6;
  --shadow:     0 1px 0 rgba(15,27,45,0.04), 0 8px 24px -12px rgba(15,27,45,0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top ribbon (govt-style) ---------- */
.ribbon {
  background: var(--navy-d);
  color: #cfd9e8;
  font-size: 12px;
  padding: 6px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.02em;
}
.ribbon a { color: #cfd9e8; text-decoration: none; opacity: 0.85; }
.ribbon a:hover { opacity: 1; text-decoration: underline; }
.ribbon-left { display: flex; gap: 16px; align-items: center; }
.ribbon-flag {
  display: inline-flex; flex-direction: column;
  width: 14px; height: 10px; border: 1px solid rgba(255,255,255,0.3);
  overflow: hidden; border-radius: 1px;
}
.ribbon-flag span { flex: 1; }
.ribbon-flag span:nth-child(1) { background: #ff9933; }
.ribbon-flag span:nth-child(2) { background: #fff; }
.ribbon-flag span:nth-child(3) { background: #138808; }

/* ---------- Header ---------- */
header.masthead {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
}
.masthead-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
}
.seal {
  height: 60px;
  width: auto;
  flex-shrink: 0;
  display: block;
}
.masthead-text { min-width: 0; }
.masthead-text h1 {
  margin: 0; font-size: 20px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.01em;
}
.masthead-text p {
  margin: 2px 0 0; font-size: 13px; color: var(--ink-mute);
  font-weight: 500;
}
.masthead-right {
  margin-left: auto; text-align: right;
  font-size: 11px; color: var(--ink-mute); line-height: 1.5;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.masthead-right strong { color: var(--ink); font-weight: 700; display: block; font-size: 12px; }

/* ---------- Breadcrumbs ---------- */
.crumbs {
  max-width: 1100px; margin: 0 auto; padding: 14px 24px 0;
  font-size: 12px; color: var(--ink-mute);
  display: flex; gap: 6px; align-items: center;
}
.crumbs a { color: var(--navy); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--ink-mute); }
.crumbs .here { color: var(--ink); font-weight: 600; }

/* ---------- Main ---------- */
main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

.page-title {
  margin: 16px 0 4px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.page-sub {
  margin: 0 0 20px;
  color: var(--ink-mute);
  font-size: 14px;
  max-width: 680px;
  line-height: 1.55;
}

/* ---------- Form card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, #fbfcfe, #ffffff);
  display: flex; align-items: center; gap: 10px;
}
.card-head h2 {
  margin: 0; font-size: 14px; font-weight: 700; color: var(--ink);
  letter-spacing: 0.01em;
}
.card-head .accent {
  width: 6px; height: 18px; background: var(--saffron); border-radius: 2px;
}
.card-body { padding: 22px 20px 24px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  align-items: end;
}
.form-grid .field-id    { grid-column: 1 / -1; }
.form-grid .field-email { grid-column: 1 / 2; }
.form-grid .field-mob   { grid-column: 2 / 3; }
.form-grid .actions     { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; padding-top: 4px; align-items: stretch; }

/* ---------- Confirm checkbox ---------- */
.confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #fbfaf6;
  border: 1px solid #ecdfb8;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.confirm:hover { background: #f7f3e6; border-color: #e1ce91; }
.confirm.checked {
  background: var(--ok-bg);
  border-color: #b9dec9;
  color: var(--ok);
}
.confirm input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid #b8a25c;
  border-radius: 4px;
  background: #fff;
  flex-shrink: 0;
  margin: 1px 0 0;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.confirm input[type="checkbox"]::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
  transition: opacity 0.12s;
}
.confirm input[type="checkbox"]:checked {
  background: var(--ok);
  border-color: var(--ok);
}
.confirm input[type="checkbox"]:checked::after { opacity: 1; }
.confirm input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}
.confirm .ct { flex: 1; }
.confirm .ct b { color: var(--ink); font-weight: 700; }
.confirm.checked .ct b { color: var(--ok); }

.btn-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-submit {
  height: 46px;
  padding: 0 26px;
  background: var(--saffron);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 4px 10px -4px rgba(217,106,31,0.45);
  white-space: nowrap;
}
.btn-submit:hover:not(:disabled) {
  background: var(--saffron-d);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 6px 16px -4px rgba(217,106,31,0.55);
}
.btn-submit:active:not(:disabled) { transform: translateY(1px); }
.btn-submit:disabled {
  background: #d8c2a8;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-submit svg { width: 16px; height: 16px; }


.id-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.id-row .id-input { flex: 1; min-width: 0; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.field label .req { color: var(--saffron); margin-left: 2px; }
.field .hint {
  font-size: 11.5px;
  color: var(--ink-mute);
  margin-top: 4px;
  font-weight: 500;
  min-height: 14px;
}
.field .hint.err { color: var(--err); }

.ctl {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.ctl:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(19,58,107,0.12);
}
.ctl.invalid {
  border-color: var(--err);
  background: #fdf6f6;
}
.ctl.invalid:focus { box-shadow: 0 0 0 3px rgba(163,32,32,0.12); }

.ctl-prefix {
  position: relative;
}
.ctl-prefix .ctl { padding-left: 52px; }
.ctl-prefix .prefix {
  position: absolute;
  left: 1px; top: 1px; bottom: 1px;
  width: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--line-soft);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 13px;
  border-right: 1.5px solid var(--line);
  border-radius: 6px 0 0 6px;
  pointer-events: none;
  font-family: 'IBM Plex Mono', monospace;
}

.id-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #f8fafd;
  color: var(--ink);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: not-allowed;
  transition: border-color 0.15s, background 0.15s;
}
.id-input:focus { outline: none; }
.id-input.has-value {
  background: #fff;
  border-color: var(--navy);
  color: var(--ink);
}
.id-input.empty {
  color: var(--ink-mute);
  font-style: italic;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 500;
  letter-spacing: 0;
  font-size: 14px;
}

.btn-view {
  height: 46px;
  padding: 0 22px;
  background: var(--navy);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 4px 10px -4px rgba(19,58,107,0.4);
  white-space: nowrap;
}
.btn-view:hover:not(:disabled) {
  background: var(--navy-d);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 6px 16px -4px rgba(19,58,107,0.5);
}
.btn-view:active:not(:disabled) { transform: translateY(1px); }
.btn-view:disabled {
  background: #aab4c6;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-view svg { width: 16px; height: 16px; }

/* ---------- Status messages ---------- */
.status {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  line-height: 1.4;
}
.status svg { width: 16px; height: 16px; flex-shrink: 0; }
.status.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d99a; }
.status.err  { background: var(--err-bg);  color: var(--err);  border: 1px solid #f0baba; }
.status.ok   { background: var(--ok-bg);   color: var(--ok);   border: 1px solid #b9dec9; }

/* ---------- Help block ---------- */
.help {
  margin-top: 16px;
  padding: 14px 16px;
  background: #f6f8fc;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.help b { color: var(--ink); font-weight: 700; }
.help code {
  font-family: 'IBM Plex Mono', monospace;
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--navy);
  font-size: 12px;
}

/* ---------- PDF viewer ---------- */
.pdf-card {
  margin-top: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.pdf-card.show { display: flex; }

.pdf-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, #fbfcfe, #ffffff);
}
.pdf-icon {
  width: 32px; height: 32px;
  background: var(--err-bg); color: var(--err);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
}
.pdf-meta { flex: 1; min-width: 0; }
.pdf-meta .t {
  font-size: 14px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pdf-meta .s {
  font-size: 11.5px; color: var(--ink-mute);
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pdf-actions { display: flex; gap: 8px; }
.pdf-actions a {
  height: 34px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px; font-weight: 600;
  text-decoration: none;
  transition: all 0.12s;
}
.pdf-actions a:hover { background: var(--line-soft); color: var(--ink); border-color: #c5d0e1; }
.pdf-actions a.primary {
  background: var(--navy); color: #fff; border-color: var(--navy);
}
.pdf-actions a.primary:hover { background: var(--navy-d); }
.pdf-actions svg { width: 14px; height: 14px; }

.pdf-frame-wrap {
  position: relative;
  width: 100%;
  height: 720px;
  background: #525a64;
}
.pdf-frame {
  width: 100%; height: 100%;
  border: none;
  display: block;
}
.pdf-loading {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: #d6dbe3;
  font-size: 13px;
  pointer-events: none;
  transition: opacity 0.3s;
}
.pdf-loading.hide { opacity: 0; }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Payment QR modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 45, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal-backdrop.show {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgba(15, 27, 45, 0.5), 0 8px 24px -8px rgba(15, 27, 45, 0.3);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.3, 1.2), opacity 0.2s ease;
}
.modal-backdrop.show .modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-head {
  padding: 18px 20px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, #fff6ec, #fff);
}
.modal-head .pay-badge {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--saffron);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal-head .pay-badge svg { width: 20px; height: 20px; }
.modal-head .mh-text { flex: 1; min-width: 0; }
.modal-head .mh-text h3 {
  margin: 0; font-size: 16px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.01em;
}
.modal-head .mh-text p {
  margin: 2px 0 0; font-size: 12px; color: var(--ink-mute); font-weight: 500;
}
.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--ink-mute);
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--line-soft); color: var(--ink); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body {
  padding: 22px 20px 8px;
  text-align: center;
}

.qr-wrap {
  margin: 0 auto;
  width: 240px;
  height: 240px;
  padding: 14px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  position: relative;
  box-shadow: inset 0 0 0 1px #fff, 0 4px 14px -8px rgba(15,27,45,0.2);
}
.qr-wrap svg, .qr-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.qr-wrap .qr-logo {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 100%; height: 44px;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 0 0 3px #fff;
  display: flex; align-items: center; justify-content: center;
}
.qr-wrap .qr-logo img { width: 100%; height: auto; display: block; }

.qr-caption {
  margin: 16px auto 4px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 320px;
}
.qr-caption b { color: var(--ink); font-weight: 700; }
.qr-caption .demand-pill {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  background: var(--line-soft);
  border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.04em;
}

.upi-apps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 4px;
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.upi-apps .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--line);
}
.upi-apps .apps {
  display: flex; gap: 6px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 600;
  font-size: 12px;
}

.modal-meta {
  margin: 14px -20px 0;
  padding: 14px 20px;
  background: #fbfcfe;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  row-gap: 6px;
  font-size: 12.5px;
  text-align: left;
}
.modal-meta dt { color: var(--ink-mute); font-weight: 600; }
.modal-meta dd { margin: 0; color: var(--ink); font-weight: 600; word-break: break-all; }
.modal-meta dd.mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

.modal-foot {
  padding: 14px 20px 18px;
  display: flex;
  gap: 10px;
}
.modal-foot .btn {
  flex: 1;
  height: 42px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, transform 0.05s, border-color 0.15s, color 0.15s;
}
.modal-foot .btn svg { width: 14px; height: 14px; }
.modal-foot .btn-secondary {
  background: #fff;
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
}
.modal-foot .btn-secondary:hover { background: var(--line-soft); color: var(--ink); border-color: #c5d0e1; }
.modal-foot .btn-primary {
  background: var(--navy);
  color: #fff;
}
.modal-foot .btn-primary:hover { background: var(--navy-d); }
.modal-foot .btn:active { transform: translateY(1px); }

/* ---------- Footer ---------- */
footer {
  background: var(--ink);
  color: #aab4c6;
  padding: 20px 24px;
  font-size: 12px;
  margin-top: auto;
}
.foot-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap;
}
footer a { color: #cfd9e8; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- Responsive: ≤ 640 px (phones, small tablets) ---------- */
@media (max-width: 640px) {
  /* Header */
  header.masthead { padding: 14px 16px; }
  .masthead-right { display: none; }
  .masthead-text h1 { font-size: 16px; }
  .masthead-text p { font-size: 11px; }

  /* Layout */
  main { padding: 16px 16px 36px; }
  footer { padding: 14px 16px; }

  /* Form */
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field-id,
  .form-grid .field-email,
  .form-grid .field-mob { grid-column: 1 / -1; }
  .form-grid .id-row .btn-view { padding: 0 16px; }
  .form-grid .actions { justify-content: stretch; }
  .id-row { gap: 8px; }

  /* Buttons */
  .btn-row { flex-direction: column; }
  .btn-submit { width: 100%; justify-content: center; }

  /* PDF viewer */
  .pdf-frame-wrap { height: 460px; }
  .pdf-head { flex-wrap: wrap; gap: 8px; }
  .pdf-actions { width: 100%; }
  .pdf-actions a { flex: 1; justify-content: center; }
}

/* ---------- Responsive: ≤ 400 px (small phones) ---------- */
@media (max-width: 400px) {
  .seal { height: 48px; }
  .masthead-text h1 { font-size: 14px; }
  header.masthead { padding: 12px 14px; }
  main { padding: 12px 14px 28px; }
  .modal-backdrop { padding: 10px; }
  .qr-wrap { width: 200px; height: 200px; }
  .upi-apps { flex-wrap: wrap; justify-content: center; }
  .pdf-frame-wrap { height: 380px; }
}
