:root {
  --bg: #faf7f2; --surface: #ffffff; --surface-2: #f4efe6; --border: #e6dccb; --text: #2a211a; --muted: #6f6253;
  --brand: #8c2f1b; --brand-2: #b4462a; --brand-soft: #f8e7df; --accent: #d98e04;
  --ok: #1f7a4d; --ok-soft: #e3f3ea; --warn: #9a5b00; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fde8e6; --info: #1d5fa8; --info-soft: #e5eefa;
  --radius: 10px; --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 14px rgba(60, 40, 20, .06);
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Devanagari", "Mangal", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
.mr { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .nowrap { white-space: nowrap; } .right { text-align: right; }
.hidden { display: none !important; }

/* top bar */
.topbar { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; }
.topbar .in { max-width: 1180px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar .logo { width: 38px; height: 38px; border-radius: 50%; background: #fff3; display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; }
.topbar .logo img { width: 100%; height: 100%; object-fit: cover; }
.topbar .title { font-weight: 650; font-size: 1.05rem; }
.topbar .sub { font-size: .8rem; opacity: .85; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .9rem; }
.topbar nav a:hover, .topbar nav a.on { background: #ffffff26; }

.wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.wrap.wide { max-width: 1180px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card.tight { padding: 14px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

/* forms */
.grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }
.field label, .lbl { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.req::after { content: " *"; color: var(--bad); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfc2ad; border-radius: 8px; background: #fff; color: var(--text); font: inherit;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #d98e0455; outline-offset: 1px; border-color: var(--accent); }
input[readonly] { background: var(--surface-2); }
.field.err input, .field.err select, .field.err textarea, .field.err .drop { border-color: var(--bad); }
.field .msg { color: var(--bad); font-size: .82rem; margin-top: 3px; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: #fff; }
.choice:hover { border-color: var(--accent); }
.choice input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.choice.sel { border-color: var(--brand); background: var(--brand-soft); }
.choice .amt { margin-left: auto; color: var(--muted); font-size: .85rem; }
.choices.inline { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.drop { border: 2px dashed #cfc2ad; border-radius: 10px; padding: 14px; text-align: center; background: var(--surface-2); cursor: pointer; }
.drop:hover { border-color: var(--accent); }
.filelist { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.filelist li { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: .88rem; }
.filelist img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.filelist .x { margin-left: auto; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600;
  cursor: pointer; background: var(--brand); color: #fff; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--brand-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--brand); border-color: #d8c4b0; }
.btn.secondary:hover { background: var(--brand-soft); }
.btn.ghost { background: transparent; color: var(--brand); padding: 6px 10px; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: var(--bad); } .btn.danger:hover { background: #8f1b12; }
.btn.ok { background: var(--ok); } .btn.ok:hover { background: #165c3a; }
.btn.wa { background: #1fa855; } .btn.wa:hover { background: #178a45; }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn.lg { padding: 12px 22px; font-size: 1.02rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* notices */
.note { padding: 12px 14px; border-radius: 8px; border: 1px solid; font-size: .92rem; margin: 10px 0; }
.note.info { background: var(--info-soft); border-color: #bcd2ee; color: #123d6d; }
.note.warn { background: var(--warn-soft); border-color: #f0d29c; color: #6b3f00; }
.note.ok { background: var(--ok-soft); border-color: #b4dcc5; color: #14532f; }
.note.bad { background: var(--bad-soft); border-color: #f3b8b1; color: #7a1a12; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .76rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.badge.pending_review { background: var(--warn-soft); color: var(--warn); }
.badge.more_info, .badge.cancelled, .badge.failed { background: var(--bad-soft); color: var(--bad); }
.badge.verified { background: var(--info-soft); color: var(--info); }
.badge.receipt_issued, .badge.active, .badge.accepted { background: var(--ok-soft); color: var(--ok); }

/* bank details */
.banks { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.bank { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); font-size: .9rem; }
.bank h4 { margin: 0 0 6px; font-size: .98rem; }
.bank dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; }
.bank dt { color: var(--muted); } .bank dd { margin: 0; font-weight: 600; word-break: break-word; }
.bank img.qr { width: 160px; max-width: 100%; display: block; margin: 8px auto 0; border-radius: 6px; background: #fff; padding: 6px; }
.copy { border: 0; background: none; color: var(--brand); cursor: pointer; font-size: .78rem; padding: 0 4px; }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th, table.t td { padding: 9px 10px; border-bottom: 1px solid #efe7da; text-align: left; vertical-align: top; }
table.t th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); position: sticky; top: 0; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #fdf8f1; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }

/* toast & modal */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99; display: grid; gap: 8px; width: min(92vw, 440px); }
#toast div { background: #2a211a; color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: .92rem; }
#toast div.bad { background: var(--bad); } #toast div.ok { background: var(--ok); }
.modal-bg { position: fixed; inset: 0; background: rgba(30, 20, 10, .45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(100%, 560px); max-height: 92vh; overflow: auto; padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal.wide { width: min(100%, 980px); }
.modal h2 { margin-top: 0; }

/* stat tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { font-size: .8rem; color: var(--muted); }
.tile .v { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile.alert .v { color: var(--warn); }
.tile.clickable { cursor: pointer; } .tile.clickable:hover { border-color: var(--accent); }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 6px; } }

.hero { text-align: center; padding: 26px 10px 10px; }
.portal-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.portal-cards a.card { text-decoration: none; color: inherit; display: block; transition: border-color .15s; }
.portal-cards a.card:hover { border-color: var(--brand); }
.portal-cards .ic { font-size: 1.8rem; }
.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 20px 16px; }
.otp-input { font-size: 1.5rem !important; letter-spacing: .5em; text-align: center; max-width: 240px; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- receipt ---------- */
.receipt { background: #fff; color: #1d1712; width: 100%; max-width: 760px; margin: 0 auto; border: 2px solid #8c2f1b; border-radius: 6px; padding: 26px 30px; position: relative; overflow: hidden; font-size: 14px; }
.receipt .rh { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid #8c2f1b; padding-bottom: 12px; }
.receipt .rh img { width: 64px; height: 64px; object-fit: contain; }
.receipt .rh .org { font-size: 1.25rem; font-weight: 700; color: #8c2f1b; }
.receipt .rh .addr { font-size: .8rem; color: #554739; }
.receipt .rtitle { text-align: center; font-weight: 700; letter-spacing: .12em; margin: 14px 0 10px; font-size: .95rem; }
.receipt .meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .9rem; margin-bottom: 10px; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 7px 8px; border: 1px solid #e3d6c3; vertical-align: top; }
.receipt td:first-child { width: 34%; color: #554739; background: #fbf6ee; }
.receipt .amt { font-size: 1.2rem; font-weight: 700; }
.receipt .sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 34px; gap: 16px; }
.receipt .sign .s { text-align: center; border-top: 1px solid #777; padding-top: 4px; min-width: 180px; font-size: .85rem; }
.receipt .foot { margin-top: 16px; font-size: .74rem; color: #6b5d4e; border-top: 1px dashed #d4c4ad; padding-top: 8px; }
.receipt .void { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.receipt .void span { transform: rotate(-24deg); font-size: 88px; font-weight: 800; color: rgba(180, 35, 24, .2); border: 8px solid rgba(180, 35, 24, .2); padding: 0 24px; border-radius: 12px; }
.receipt .copytag { position: absolute; top: 10px; right: 12px; font-size: .7rem; color: #8c2f1b; border: 1px solid #8c2f1b; padding: 1px 6px; border-radius: 4px; }

@media print {
  body { background: #fff; }
  .noprint, .topbar, #toast, .footer { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .receipt { border-width: 2px; max-width: none; }
}
