/* Mobile-first. Base rules are the phone layout; the min-width blocks add tablet and desktop. */

:root {
  --maroon: #7A1F2B;
  --maroon-deep: #541320;
  --maroon-tint: #F6E7DF;
  --cream: #FFF8E7;
  --ivory: #FFFDF6;
  --gold: #C8982E;
  --gold-soft: #EAD9AE;
  --gold-active: #E2B31B; /* a rich golden yellow for "you are here" (the old gold read as orange) */
  --ink: #3A2418;
  --ink-soft: #6F5A4B;
  --danger: #A32A1E;
  --success: #2F6B3C;
  --radius: 14px;
  --tap: 48px;
  --tabbar: 64px;
  --font-body: "Noto Sans", "Noto Sans Devanagari", system-ui, sans-serif;
  --font-head: "Noto Serif", "Noto Serif Devanagari", Georgia, serif;

  --bs-body-bg: var(--cream);
  --bs-body-color: var(--ink);
  --bs-body-font-family: var(--font-body);
  --bs-border-color: var(--gold-soft);
  --bs-link-color-rgb: 122, 31, 43;
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--cream); color: var(--ink); min-height: 100dvh; }
h1, h2, h3, .brand-title { font-family: var(--font-head); color: var(--maroon-deep); }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.boot-spinner {
  width: 40px; height: 40px; margin: 40vh auto 0; border-radius: 50%;
  border: 4px solid var(--gold-soft); border-top-color: var(--maroon);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons and fields. 16px text stops iOS zooming into inputs. */
.btn-app, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: .5rem 1.25rem; border-radius: 12px;
  font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, transform .05s;
}
.btn-app { background: var(--maroon); color: var(--cream); }
.btn-app:hover { background: var(--maroon-deep); color: var(--cream); }
.btn-app:active, .btn-ghost:active { transform: translateY(1px); }
.btn-app:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--maroon); border-color: var(--gold); }
.btn-ghost:hover { background: var(--maroon-tint); color: var(--maroon-deep); }
.btn-danger-soft { color: var(--danger); border-color: var(--danger); }
.btn-whatsapp { background: #1B7F4B; color: #fff; }
.btn-whatsapp:hover { background: #14653B; color: #fff; }
.btn-block { width: 100%; }

.form-control, .form-select {
  min-height: var(--tap); font-size: 16px; border-radius: 10px;
  border-color: var(--gold-soft); background-color: var(--ivory); color: var(--ink);
}
textarea.form-control { min-height: 7rem; }
.form-control:focus, .form-select:focus { border-color: var(--maroon); box-shadow: 0 0 0 3px rgba(122, 31, 43, .15); }
.form-label { font-weight: 600; margin-bottom: .35rem; }
.field { margin-bottom: 1rem; }
.field-error { color: var(--danger); font-size: .875rem; margin-top: .3rem; }
.field-hint { color: var(--ink-soft); font-size: .875rem; margin-top: .3rem; }
.optional { color: var(--ink-soft); font-weight: 400; font-size: .875rem; }
.is-bad { border-color: var(--danger) !important; }

.card-app {
  background: var(--ivory); border: 1px solid var(--gold-soft);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
}
.card-app > h2 { margin-bottom: .75rem; }

/* App shell: maroon header and bottom tabs on phones. */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--maroon); color: var(--cream);
  padding: calc(.7rem + env(safe-area-inset-top)) 1rem .7rem;
  border-bottom: 3px solid var(--gold);
}
.topbar .brand-title { color: var(--cream); font-size: 1.05rem; line-height: 1.2; }
.topbar .brand-line1, .topbar .brand-line2 { display: block; }
.topbar .brand-line1 { letter-spacing: .03em; }
.topbar .brand-line2 { font-size: .85em; opacity: .95; }
/* Tablet and desktop have room: one line. */
@media (min-width: 768px) {
  .topbar .brand-line1, .topbar .brand-line2 { display: inline; font-size: inherit; opacity: 1; }
  .topbar .brand-line2::before { content: ' '; }
}
.page { padding: 1rem 1rem calc(var(--tabbar) + 1.5rem + env(safe-area-inset-bottom)); }
.page-inner { max-width: 640px; margin: 0 auto; }
.page-title { margin-bottom: 1rem; }

.nav-rail {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--maroon-deep);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-rail-brand, .nav-rail-user { display: none; }
.nav-links { display: flex; list-style: none; margin: 0; padding: 0; }
.nav-links li { flex: 1; min-width: 0; }
.nav-link-app {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar); color: var(--gold-soft); font-size: .7rem; line-height: 1.1; text-align: center; text-decoration: none;
}
.nav-link-app svg { width: 24px; height: 24px; }
.nav-link-app[aria-current="page"] { color: #fff; font-weight: 600; box-shadow: inset 0 3px 0 var(--gold-active); }

/* Toggles */
.seg { display: flex; background: var(--maroon-tint); border-radius: 12px; padding: 4px; }
.seg label {
  flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: 44px; border-radius: 9px; font-weight: 600; color: var(--maroon); cursor: pointer; margin: 0;
}
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg input:checked + span { color: var(--cream); }
.seg label:has(input:checked) { background: var(--maroon); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 1px; }
.seg-sm { display: flex; flex-wrap: wrap; } /* checkout: keep the extra cash as a donation, or give it back */
.seg-sm label { flex: 1 1 12rem; min-height: 40px; font-size: .9rem; text-align: center; }
#cash-change .seg-sm { margin-top: .4rem; }
.cart-lines .cart-line { flex-wrap: wrap; } .cart-line-note { flex-basis: 100%; font-size: .82rem; color: var(--success); font-weight: 600; } /* cart: money above a book's price becomes a donation */
.seg-stack { display: grid; gap: .6rem; margin-bottom: 1rem; }

/* Book tiles: 4 across on a phone so one thumb reaches all of them. */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.tile {
  position: relative; display: block; margin: 0; cursor: pointer; text-align: center;
  background: var(--ivory); border: 2px solid var(--gold-soft); border-radius: 12px; padding: .4rem .3rem;
}
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; display: block; }
.tile-code { display: block; font-weight: 700; color: var(--maroon-deep); margin-top: .25rem; }
.tile-name { display: block; font-size: .7rem; line-height: 1.2; color: var(--ink-soft); min-height: 1.7rem; }
.tile:has(input:checked) { border-color: var(--maroon); background: var(--maroon-tint); }
.tile:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 1px; }
.tile:has(input:checked)::after {
  content: "✓"; position: absolute; top: -8px; right: -6px; width: 24px; height: 24px; line-height: 24px;
  border-radius: 50%; background: var(--maroon); color: var(--cream); font-size: .85rem; font-weight: 700;
}
.tiles.tiles-carton { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 320px; }

/* Quantity */
.qty-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pill {
  min-width: var(--tap); height: var(--tap); border-radius: 999px; font-weight: 600; font-size: 1rem;
  border: 1px solid var(--gold); background: var(--ivory); color: var(--maroon); cursor: pointer;
}
.canto-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; margin-bottom: .5rem; }
.canto-btn { min-width: 0; padding-inline: 0; text-align: center; }
.pill.active { background: var(--maroon); color: var(--cream); border-color: var(--maroon); }
.stepper { display: flex; align-items: center; gap: .25rem; width: 100%; }
.stepper input { flex: 1; min-width: 0; text-align: center; font-weight: 700; }
.step-btn {
  width: var(--tap); height: var(--tap); border-radius: 12px; font-size: 1.4rem; line-height: 1;
  border: 1px solid var(--maroon); background: var(--ivory); color: var(--maroon); cursor: pointer;
}

/* Amount */
.input-money { position: relative; }
.input-money span { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--maroon); }
.input-money input { padding-left: 2rem; font-size: 1.25rem; font-weight: 700; }
.amount-words { min-height: 1.5rem; margin-top: .4rem; color: var(--maroon); font-weight: 600; }

/* Screenshot picker */
.shot-picker {
  display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 72px;
  border: 2px dashed var(--gold); border-radius: 12px; color: var(--maroon); font-weight: 600; cursor: pointer; margin: 0;
  background: var(--ivory); padding: .5rem;
}
.shot-picker:has(input:focus-visible) { outline: 3px solid var(--gold); }
.shot-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.shot-preview { max-height: 96px; max-width: 72px; border-radius: 6px; object-fit: cover; }
.shot-status { display: flex; align-items: center; gap: .6rem; min-height: 2.5rem; margin: .25rem 0 .5rem; color: var(--ink-soft); font-weight: 600; }
.shot-pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.shot-pick-row .shot-picker { flex-direction: column; gap: .15rem; min-height: 84px; text-align: center; }
.shot-icon { font-size: 1.6rem; line-height: 1; }

/* UPI QR code shown when UPI is chosen */
.upi-qr { text-align: center; margin: 0 0 .75rem; }
.qr-card { width: 270px; max-width: 100%; margin: 0 auto; background: #fff; border: 3px solid var(--gold); border-radius: 18px; box-shadow: 0 0 0 1px var(--maroon), 0 6px 18px rgba(84, 19, 32, .15); overflow: hidden; }
.qr-card-head { background: var(--maroon); color: #fff; padding: .6rem .5rem .55rem; border-bottom: 3px solid var(--gold); }
.qr-card-head span { display: block; font-family: var(--font-head); font-size: 1.25rem; font-weight: 700; letter-spacing: .04em; line-height: 1.2; }
.qr-card-head small { display: block; font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-soft); }
.qr-card-body { padding: .75rem .75rem .85rem; }
.qr-card-scan { font-family: var(--font-head); font-weight: 700; color: var(--maroon-deep); font-size: 1.05rem; margin-bottom: .35rem; }
.qr-card-body img { display: block; width: 220px; height: 220px; max-width: 100%; margin: 0 auto; }
.upi-qr figcaption { margin-top: .4rem; font-size: .9rem; }

/* Checkout header band */
.checkout-band {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; margin-bottom: .9rem;
  padding: .85rem 1rem; border-radius: 18px; color: var(--cream);
  background: linear-gradient(135deg, var(--maroon-deep), var(--maroon) 60%, #A8434F);
  box-shadow: 0 8px 20px rgba(84, 19, 32, .22);
}
.checkout-band h1 { margin: 0; color: var(--cream); font-size: 1.6rem; text-align: center; letter-spacing: .02em; }
.band-back {
  justify-self: start; background: rgba(255, 248, 231, .16); color: var(--cream); border: 1px solid rgba(255, 248, 231, .45);
  border-radius: 999px; padding: .35rem .85rem; font-weight: 600; font-size: .9rem; min-height: 36px;
}
.band-back:hover { background: rgba(255, 248, 231, .28); }
@media (max-width: 420px) { .band-spacer { display: none; } .checkout-band { grid-template-columns: auto 1fr; } .checkout-band h1 { font-size: 1.35rem; } }

/* Generate-QR button, spinner and the QR shown inline */
.btn-green { background: #1F8A4C; border-color: #1F8A4C; color: #fff; }
.btn-green:hover:not([disabled]) { background: #187A41; border-color: #187A41; color: #fff; }
.qr-area { margin-top: .75rem; }
.qr-area:empty { margin: 0; }
.mini-spinner {
  width: 44px; height: 44px; margin: 1.5rem auto; border-radius: 50%;
  border: 4px solid var(--gold-soft); border-top-color: #1F8A4C; animation: spin .9s linear infinite;
}
.qr-inline { text-align: center; border: 2px dashed #A9DBBE; background: #F6FCF8; border-radius: 16px; padding: 1rem; }
.success-bank { color: var(--success); font-weight: 600; margin: .25rem 0 0; }

/* Thank-you part of the success page */
.thank-box { text-align: left; border: 2px solid #A9DBBE; background: #F6FCF8; border-radius: 16px; padding: .9rem 1rem; margin: 1rem 0; }
.thank-box h2 { font-size: 1.05rem; margin-bottom: .6rem; color: #22603D; }
.thank-name { color: var(--ink-soft); margin-bottom: .4rem; }
.thank-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; padding: .55rem 0; border-top: 1px solid #DCEFE3; }
.thank-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.thank-row .btn-whatsapp { flex: 1 1 100%; }
.thank-add { border-top: 1px solid #DCEFE3; padding-top: .6rem; margin-top: .3rem; }
.num-badge {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--maroon); color: var(--cream); font-size: .78rem; font-weight: 700;
}

/* Compact name and WhatsApp fields */
.compact-fields .form-control { min-height: 38px; padding: .3rem .7rem; font-size: .95rem; }
.compact-fields .form-label { margin-bottom: .15rem; font-size: .85rem; }

/* Errors listed at the top of the Add and Checkout pages */
.error-box {
  border: 2px solid var(--danger); background: #FCEDEA; color: var(--danger); border-radius: 12px;
  padding: .75rem 1rem; margin-bottom: .75rem; font-weight: 600;
}
.error-box ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.error-box:focus { outline: none; }

/* Cart */
.cart-count {
  display: inline-block; min-width: 1.6rem; padding: 0 .45rem; border-radius: 999px; text-align: center;
  background: var(--maroon); color: #fff; font-family: var(--font-body); font-size: .85rem; vertical-align: middle;
}
.cart-empty { color: var(--ink-soft); margin: 0; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: flex; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--gold-soft); }
.cart-line-label { flex: 1; min-width: 0; font-weight: 600; }
.cart-line-amount { width: 7.5rem; flex: none; }
.cart-line-amount input { font-size: 1rem; padding-left: 1.8rem; }
.cart-line-sum { font-weight: 700; }
.cart-remove {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--danger);
  background: transparent; color: var(--danger); font-size: 1.3rem; line-height: 1;
}
.cart-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: .6rem; font-size: 1.15rem; color: var(--maroon-deep); }

/* Checkout */
.checkout-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.btn-link-app { background: none; border: 0; padding: .4rem 0 0; color: var(--maroon); font-weight: 600; text-decoration: underline; text-align: left; }
.success-lines { list-style: none; padding: 0; margin: .75rem 0 0; text-align: left; }
.success-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px solid var(--gold-soft); }

.add-save { margin-top: .25rem; }
.save-error { color: var(--danger); font-weight: 600; margin-bottom: .75rem; }

/* Saved confirmation */
.success-panel { text-align: center; padding: 2rem 1rem; }
.success-mark {
  width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 50%; background: var(--success); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 2.25rem;
}
.success-summary { color: var(--ink-soft); margin: .5rem 0 1.5rem; }
.success-actions { display: grid; gap: .75rem; max-width: 360px; margin: 0 auto; }

/* Records */
.totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.total {
  background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; padding: .65rem .8rem;
}
.total-primary { background: var(--maroon); border-color: var(--maroon); }
.total-primary .total-label, .total-primary .total-value { color: var(--cream); }
.total-label { font-size: .8rem; color: var(--ink-soft); }
.total-value { font-size: 1.25rem; font-weight: 700; color: var(--maroon-deep); font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.chip {
  flex: none; min-height: 40px; padding: 0 1rem; border-radius: 999px; font-weight: 600; font-size: .9rem;
  border: 1px solid var(--gold); background: var(--ivory); color: var(--maroon); cursor: pointer;
}
.chip.active { background: var(--maroon); border-color: var(--maroon); color: var(--cream); }
.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.filter-grid .span-all { grid-column: 1 / -1; }

/* Date filter: All · Today · Yesterday · a picked date (with a day back and forward) */
.date-chips { align-items: center; }
.day-pick { display: inline-flex; align-items: center; gap: .3rem; }
.day-chip { position: relative; display: inline-flex; align-items: center; gap: .35rem; margin: 0; }
.day-chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.day-chip:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.day-step { padding: 0 .75rem; min-width: 40px; font-size: 1.1rem; }
.day-step[disabled] { opacity: .4; cursor: not-allowed; }
/* "More filters": folded until needed */
.more-filters { margin: 0 0 .75rem; border: 1px solid var(--gold-soft); border-radius: 12px; background: var(--ivory); }
.more-filters > summary { display: flex; align-items: center; gap: .4rem; padding: .55rem .85rem; cursor: pointer; font-weight: 600; color: var(--maroon); list-style: none; }
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters > summary::before { content: '▸'; font-size: .8rem; }
.more-filters[open] > summary::before { content: '▾'; }
.more-on { color: var(--ink-soft); font-weight: 500; }
.more-clear { margin-left: auto; font-size: .9rem; }
.more-body { padding: 0 .85rem .85rem; }
.more-body .chips { margin-bottom: .5rem; }
.more-label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin: .5rem 0 .3rem; display: block; }

.record-cards { display: grid; gap: .6rem; }
.record-card {
  display: block; width: 100%; text-align: left; cursor: pointer; color: inherit;
  background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; padding: .75rem .9rem;
}
.record-top { display: flex; justify-content: space-between; gap: .75rem; font-weight: 700; color: var(--maroon-deep); }
.record-meta { color: var(--ink-soft); font-size: .875rem; margin-top: .15rem; }
.badge-pay { font-size: .75rem; font-weight: 600; border-radius: 6px; padding: .05rem .4rem; background: var(--maroon-tint); color: var(--maroon); }
/* Date and time pills (pastel) */
.pill-date, .pill-time {
  display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 999px; padding: .1rem .55rem;
  margin: .1rem .25rem .1rem 0; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.pill-date { background: #DCEBFA; color: #24507A; }
.pill-time { background: #E3F4E1; color: #2D6331; }
.when-cell { white-space: nowrap; }
.edit-col { width: 1%; text-align: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 1px solid #D9CCF0; background: #F3EEFB; color: #5B3F99; transition: background .15s, transform .15s;
}
.icon-btn:hover { background: #E6DCF7; transform: scale(1.06); }
.by-edit { margin-top: .1rem; }
/* Deleted entries stay listed, crossed out, with Restore */
.is-deleted td:not(.edit-col), .record-card.is-deleted .record-top, .record-card.is-deleted .record-meta {
  text-decoration: line-through; text-decoration-color: #B3261E; text-decoration-thickness: 2px; opacity: .6;
}
.record-card.is-deleted { background: #FBF3F2; }
.record-deleted { font-size: .8rem; font-weight: 600; color: var(--danger); margin-bottom: .25rem; }
.badge-deleted { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .08rem .5rem; background: #FADCD9; color: #8C1D18; }
.edit-col { white-space: nowrap; }
.icon-restore { border-color: #BFE3C6; background: #E6F5E9; color: #2D6331; }
.icon-restore:hover { background: #D3EDD8; }
.by-edit .form-select { flex: 1; min-width: 0; }

/* My target tiles */
.total-target { background: #FFF4D9; border-color: #EAD9AE; }
.total-target .link-btn { padding: 0; margin-top: .15rem; font-size: .85rem; }
.target-bar { height: 8px; border-radius: 999px; background: #F2E6C9; margin-top: .4rem; overflow: hidden; }
.target-bar span { display: block; height: 100%; background: var(--success); border-radius: 999px; }
.target-edit { grid-column: 1 / -1; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; padding: .75rem .9rem; }
/* Leader dashboard: devotees, family members and targets per Bhakti Vriksha */
/* Each Bhakti Vriksha is its own card: a coloured header band with the name centred, then a white table. */
.bv-team {
  --tone-band: #EDE6FA; --tone-line: #CDBEF0; --tone-ink: #4A2F86; --tone-soft: #F8F5FE;
  margin-top: 1.25rem; background: #fff; border: 2px solid var(--tone-line); border-radius: 18px;
  overflow: hidden; box-shadow: 0 6px 18px rgba(84, 19, 32, .08);
}
.bv-tone-1 { --tone-band: #DFF3E8; --tone-line: #A9DBBE; --tone-ink: #22603D; --tone-soft: #F3FBF6; }
.bv-tone-2 { --tone-band: #FDE8DA; --tone-line: #F2C2A2; --tone-ink: #8A3F12; --tone-soft: #FEF6F0; }
.bv-tone-3 { --tone-band: #DCEBFA; --tone-line: #A9CBEE; --tone-ink: #1F4E7A; --tone-soft: #F2F8FE; }
.bv-tone-4 { --tone-band: #FBE0EA; --tone-line: #EEB2C7; --tone-ink: #8C2350; --tone-soft: #FEF4F8; }
.bv-tone-5 { --tone-band: #FBF1CF; --tone-line: #E9D28A; --tone-ink: #6E5310; --tone-soft: #FEFAEC; }
.bv-band {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem;
  background: var(--tone-band); border-bottom: 2px solid var(--tone-line); padding: .9rem 1rem;
}
.bv-band-title { text-align: center; }
.bv-band h2 { margin: 0; color: var(--tone-ink); font-size: 1.3rem; }
.bv-sum { margin-top: .2rem; font-size: .85rem; font-weight: 600; color: var(--tone-ink); opacity: .85; }
.bv-band-actions { display: flex; justify-content: flex-end; gap: .4rem; }
.icon-on-band { background: #fff; border-color: var(--tone-line); color: var(--tone-ink); }
.icon-on-band:hover { background: var(--tone-soft); }
.icon-delete { color: #A32A1E; border-color: #EDB8B2; }
.icon-delete:hover { background: #FCEDEA; }
.bv-body { padding: .75rem 1rem 1rem; }
.bv-team .team-table th { color: var(--tone-ink); border-bottom-color: var(--tone-line); }
.bv-team .team-table td { border-bottom-color: #EFEAE0; }
.bv-team .family-row { background: var(--tone-soft); }
.bv-team .team-table tfoot td { color: var(--tone-ink); border-top: 2px solid var(--tone-line); }
.rename-form { margin-bottom: .75rem; }
.props-form { background: var(--tone-soft, #FFFDF6); border: 1px dashed var(--tone-line, #EAD9AE); border-radius: 12px; padding: .9rem 1rem; }
.props-title { font-size: 1rem; margin: 0 0 .6rem; color: var(--tone-ink, var(--maroon-deep)); }
.props-grid { display: grid; gap: .75rem; }
@media (min-width: 640px) { .props-grid { grid-template-columns: 1fr 1fr; } }
.props-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }
.team-table .num-left { padding-left: .9rem; font-variant-numeric: tabular-nums; }
.family-card, .summary-card { margin: 0 0 1.25rem; } /* My Records: the Targets and Distribution Summary cards, with room before the filters */
.family-table { min-width: 460px; }
@media (max-width: 575px) {
  .bv-band { grid-template-columns: 1fr auto; }
  .bv-band > .bv-band-side:first-child { display: none; }
  .bv-band-title { text-align: left; }
}
.team-wrap { overflow-x: auto; }
.team-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.team-table th { font-size: .8rem; color: var(--ink-soft); font-weight: 600; text-align: left; padding: .4rem .5rem; border-bottom: 2px solid var(--gold-soft); }
.team-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--gold-soft); vertical-align: middle; }
.team-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.team-table tfoot td { font-weight: 700; color: var(--maroon-deep); border-bottom: 0; }
.t-name { display: flex; align-items: center; gap: .35rem; min-width: 12rem; }
.t-family { color: var(--ink-soft); padding-left: 1rem; }
.family-row { background: #F7F3FC; }
.family-count { color: #5B3F99; font-weight: 600; }
.expand-btn { width: 28px; height: 28px; border-radius: 50%; border: 1px solid #D9CCF0; background: #F3EEFB; color: #5B3F99; line-height: 1; flex: none; }
.expand-space { display: inline-block; width: 28px; flex: none; }
.target-input { width: 6.5rem; text-align: right; }
.t-progress { display: flex; align-items: center; gap: .5rem; min-width: 8rem; }
.t-progress .target-bar { flex: 1; margin: 0; }
.stats-picker { max-width: 22rem; margin-bottom: .75rem; }

/* Stats */
.tips { background: #F3EEFB; border-color: #DCD0F0; }
.tip-list { margin: 0; padding-left: 1.2rem; display: grid; gap: .5rem; }
.split-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--gold-soft); }
.split-cash { background: #E8B4A8; }
.split-upi { background: #9CC9B4; }
.split-key { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .5rem; font-size: .875rem; }
.split-key i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: middle; }
.record-table-wrap { display: none; }
.empty { text-align: center; color: var(--ink-soft); padding: 2.5rem 1rem; }
.load-more { display: block; margin: 1rem auto 0; }

.detail-list { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.detail-list dt { font-weight: 500; color: var(--ink-soft); }
.detail-list dd { margin: 0; font-weight: 600; }
.detail-shot { display: block; width: 100%; border-radius: 10px; margin-top: 1rem; border: 1px solid var(--gold-soft); }
.modal-content { background: var(--ivory); border-radius: var(--radius); }

/* Sign-in and onboarding */
.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; }
.auth-hero {
  background: var(--maroon); color: var(--cream); text-align: center; border-bottom: 4px solid var(--gold);
  padding: calc(2.5rem + env(safe-area-inset-top)) 1.5rem 2rem;
}
.auth-hero .brand-title { color: var(--cream); font-size: 1.6rem; margin: .75rem 0 .25rem; }
.auth-hero p { margin: 0; color: var(--gold-soft); }
.auth-mark { width: 72px; height: 72px; }
.auth-body { flex: 1; padding: 1.5rem 1rem 2rem; width: 100%; max-width: 480px; margin: 0 auto; }
.signin-note { background: var(--maroon-tint); border-radius: 10px; padding: .75rem; margin-bottom: 1rem; }

/* Message settings */
.chips-insert .chip { min-height: 36px; font-size: .8rem; font-family: ui-monospace, Consolas, monospace; }
.template-row {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%;
  background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px;
  padding: .75rem .9rem; margin-bottom: .5rem; text-align: left; cursor: pointer; color: inherit;
}
.template-row.active { border-color: var(--maroon); box-shadow: inset 0 0 0 1px var(--maroon); }
.preview-bubble {
  background: #DCF8C6; color: #1d2b1d; border-radius: 10px; padding: .75rem .9rem;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem;
}
.form-check-input:checked { background-color: var(--maroon); border-color: var(--maroon); }
.check-row { display: flex; align-items: center; gap: .6rem; min-height: var(--tap); }
.check-row input { width: 1.25rem; height: 1.25rem; margin: 0; flex: none; }
.check-row label { margin: 0; }

.app-toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 2000;
  bottom: calc(var(--tabbar) + 1rem + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--cream); padding: .65rem 1.1rem; border-radius: 10px;
  max-width: calc(100vw - 2rem);
}

/* Pictures */
.camera-btn { min-height: 64px; font-size: 1.1rem; }
.camera-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.camera-btn.is-busy { opacity: .7; cursor: progress; }
.camera-btn:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.pic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.pic-empty { grid-column: 1 / -1; }
.pic { margin: 0; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; overflow: hidden; }
.pic img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.pic figcaption { padding: .4rem .6rem .6rem; font-size: .8rem; color: var(--ink-soft); }

/* Dashboard */
.chip-soft { min-height: 36px; font-size: .85rem; border-color: var(--gold-soft); }
.bv-grid { display: grid; gap: .6rem; }
.filter-row { display: grid; gap: .5rem; margin-bottom: .75rem; }
.link-row { display: flex; gap: .5rem; }
.link-row .form-control { flex: 1; min-width: 0; }
.num-links { display: inline-flex; flex-wrap: wrap; gap: .3rem .35rem; }

/* Pills: phone and WhatsApp, payment, book */
.pill-call, .pill-wa, .pill-pay, .pill-book {
  display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .15rem .6rem;
  font-size: .78rem; font-weight: 600; white-space: nowrap; text-decoration: none; line-height: 1.5;
}
.pill-call { background: #EEF0F5; color: #3C4660; border: 1px solid #D7DCE8; }
.pill-wa { background: #DDF6E4; color: #12703A; border: 1px solid #A8E2BC; }
.pill-call:hover { background: #E2E6EF; }
.pill-wa:hover { background: #C9F0D5; }
.pill-cash { background: #FFF1CC; color: #7A5600; border: 1px solid #F0D98C; }
.pill-upi { background: #DCEBFA; color: #1F4E7A; border: 1px solid #A9CBEE; }
.pill-none { background: #F3E9E7; color: #8C4A3F; border: 1px solid #E5CBC5; }
.pill-book { background: #F6EAFB; color: #6A2C80; border: 1px solid #E1C6EC; }
.amount-cell { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.row-actions { display: inline-flex; gap: .35rem; }
.pill-books { display: inline-block; min-width: 2.4rem; text-align: center; background: #7A1F2B; color: #FFF8E7; border-radius: 999px; padding: .1rem .6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pill-leader { background: #F6EAFB; color: #6A2C80; border: 1px solid #E1C6EC; }
.rank-pill { display: inline-grid; place-items: center; min-width: 1.9rem; height: 1.9rem; border-radius: 50%; background: #F3EEE4; color: var(--ink-soft); font-weight: 700; font-size: .85rem; }
.rank-1 { background: #F7E2A6; color: #6E5310; }
.rank-2 { background: #E6E9EF; color: #3C4660; }
.rank-3 { background: #F2D3BF; color: #7A3E1B; }
.link-strong { background: none; border: 0; padding: 0; font-weight: 700; color: var(--maroon-deep); text-align: left; text-decoration: underline; text-decoration-color: var(--gold-soft); text-underline-offset: 3px; }
.link-strong:hover { text-decoration-color: var(--maroon); }
.section-title { margin: 2rem 0 .75rem; font-size: 1.15rem; }
.move-bar { background: #FFF4D9; border: 2px solid #E9D28A; border-radius: 14px; padding: .85rem 1rem; margin-bottom: .9rem; box-shadow: 0 4px 12px rgba(84, 19, 32, .07); }
.move-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Super Admin: payment method choice */
.pay-modes { display: grid; gap: .6rem; margin-bottom: .6rem; }
.pay-mode { display: flex; gap: .75rem; align-items: flex-start; border: 2px solid var(--gold-soft); border-radius: 14px; padding: .8rem 1rem; background: #fff; cursor: pointer; }
.pay-mode input { margin-top: .3rem; flex: none; }
.pay-mode-body { display: grid; gap: .15rem; }
.pay-mode-body small { color: var(--ink-soft); }
.pay-mode-body .pill-pay { justify-self: start; }
.pay-mode.is-on { border-color: #5FA97F; background: #F2FAF5; }
.pay-mode.is-live.is-on { border-color: #C0392B; background: #FEF4F2; }
.pay-mode.is-off { opacity: .6; cursor: not-allowed; }
.edit-panel { margin-top: .9rem; background: #FEF6F0; border-color: #F2C2A2; }
.icon-sm { width: 34px; height: 34px; }
.icon-shot { border-color: #A9CBEE; background: #DCEBFA; color: #1F4E7A; }
.icon-ok { border-color: #A9DBBE; background: #DFF3E8; color: #22603D; }
.icon-ok:hover { background: #CDEBD9; }
.icon-sm.icon-restore { border-color: #BFE3C6; background: #E6F5E9; color: #2D6331; }
.pill-alert { background: #FADCD9; color: #8C1D18; border: 1px solid #F0B8B2; white-space: normal; }
.pill-action { background: #EDE6FA; color: #4A2F86; border: 1px solid #CDBEF0; text-transform: capitalize; }
.hist-btn { cursor: pointer; }

/* Payment status pills and the check-status button */
.pay-status {
  display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .15rem .6rem; font-size: .78rem;
  font-weight: 700; white-space: nowrap; line-height: 1.5; border: 1px solid transparent;
}
.st-success { background: #DDF6E4; color: #12703A; border-color: #A8E2BC; }
.st-pending { background: #FFF1CC; color: #7A5600; border-color: #F0D98C; }
.st-user_dropped { background: #F1E7F6; color: #6A2C80; border-color: #DCC3E8; }
.st-failed { background: #FADCD9; color: #8C1D18; border-color: #F0B8B2; }
.st-deemed_failed { background: #ECEAE6; color: #5A5750; border-color: #D3CFC7; }
.st-queried { background: #E3EAFB; color: #2E4A9A; border-color: #BCCBF1; }
.icon-check { border-color: #F0D98C; background: #FFF1CC; color: #7A5600; }
.icon-check:hover:not([disabled]) { background: #FBE6A8; }
.icon-check[disabled] { opacity: .45; cursor: not-allowed; }
.icon-check.is-spinning svg { animation: check-pulse .8s ease-in-out infinite; }
@keyframes check-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.25); opacity: .55; } }
.pay-hint { background: #FFF4D9; border: 1px dashed var(--gold); border-radius: 10px; padding: .5rem .8rem; }
tr.gateway-row td { background: #FFFBEF; }
.record-card.is-gateway { cursor: default; background: #FFFBEF; border-color: #F0D98C; }
.card-check { margin-left: auto; float: right; }
a.icon-btn { text-decoration: none; }
.icon-shot:hover { background: #C8DEF5; }

/* Bordered pastel tables with alternating rows (Dashboard lists) */
.rtable-fancy { --t-band: #EDE6FA; --t-line: #CDBEF0; --t-edge: #8E78C9; --t-ink: #4A2F86; --t-alt: #F8F5FE; }
.rtable-fancy.tone-mint { --t-band: #DFF3E8; --t-line: #A9DBBE; --t-edge: #5FA97F; --t-ink: #22603D; --t-alt: #F2FAF5; }
.rtable-fancy.tone-peach { --t-band: #FDE8DA; --t-line: #F2C2A2; --t-edge: #D08454; --t-ink: #8A3F12; --t-alt: #FEF6F0; }
.rtable-fancy.tone-rose { --t-band: #FBE0EA; --t-line: #EEB2C7; --t-edge: #C96C91; --t-ink: #8C2350; --t-alt: #FEF4F8; }
.rtable-fancy .rtable tr { background: #fff; border: 2px solid var(--t-edge); }
.rtable-fancy .rtable tr:nth-child(even) { background: var(--t-alt); }
.rtable-fancy .rtable td::before { color: var(--t-ink); font-weight: 600; }

/* One table: stacked cards on phones, a real table on desktop. */
.rtable { display: block; width: 100%; }
.rtable thead { display: none; }
.rtable tbody { display: grid; gap: .6rem; }
.rtable tr { display: block; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; padding: .5rem .9rem; }
.rtable td { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; text-align: right; overflow-wrap: anywhere; }
.rtable td::before { content: attr(data-label); color: var(--ink-soft); font-size: .875rem; flex: none; text-align: left; }
.rtable .num-links { justify-content: flex-end; }

/* Administration */
.link-btn {
  background: none; border: 0; padding: .25rem 0; min-height: 32px; color: var(--maroon);
  font-weight: 600; text-decoration: underline; cursor: pointer; text-align: inherit;
}
.crumbs { margin-bottom: .75rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.export-link { width: fit-content; }
.review-grid { display: grid; gap: .75rem; }
.review-card { display: flex; gap: .75rem; margin: 0; align-items: flex-start; }
.review-card > a { flex: none; width: 96px; }
.review-card img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; border: 1px solid var(--gold-soft); }
.review-body { flex: 1; min-width: 0; }
.review-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.org-row { margin-bottom: .75rem; }
.org-heading { font-size: 1rem; margin: 1rem 0 .5rem; }
.org-meta { display: flex; justify-content: space-between; align-items: center; gap: .75rem; color: var(--ink-soft); font-size: .875rem; margin-top: .25rem; }
.admin-row { padding: .4rem 0; border-bottom: 1px solid var(--gold-soft); }
.cat-list { display: grid; gap: 0 1rem; }
.cat-head { display: flex; gap: .75rem; margin-bottom: .75rem; }
.cat-fields { flex: 1; min-width: 0; }
.cat-thumb { flex: none; width: 72px; margin: 0; cursor: pointer; text-align: center; color: var(--maroon); font-size: .8rem; font-weight: 600; }
.cat-thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; border: 1px solid var(--gold-soft); }
.cat-thumb input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cat-thumb:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-bottom: .6rem; }

/* Books & Cartons: two tables (books, cartons), Hindi and English side by side; Edit turns cells into boxes in place */
.cat-card { background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.cat-head-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .85rem; background: var(--maroon-deep); color: var(--cream); }
.cat-head-bar h2 { margin: 0; font-size: 1.15rem; color: var(--cream); }
.cat-actions { display: flex; gap: .4rem; }
.cat-head-bar .cat-edit, .cat-head-bar .cat-cancel { color: var(--cream); border-color: rgba(255, 248, 231, .6); }
.cat-head-bar .cat-edit:hover, .cat-head-bar .cat-cancel:hover { background: rgba(255, 248, 231, .15); color: #fff; }
.cat-head-bar .btn-app { background: var(--gold); color: var(--maroon-deep); }
.cat-head-bar .btn-app[disabled] { opacity: .55; }
.cat-tip { margin: .5rem .85rem 0; }
.cat-card .cat-table th:first-child, .cat-card .cat-table td:first-child { padding-left: .85rem; }
.cat-card .cat-table th:last-child, .cat-card .cat-table td:last-child { padding-right: .85rem; }
.cat-add-link { display: block; margin: .5rem 0 1rem; font-size: .9rem; }
.cat-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cat-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.cat-table th, .cat-table td { padding: .45rem .4rem; border-bottom: 1px solid var(--gold-soft); vertical-align: middle; }
.cat-table thead th { font-size: .78rem; color: var(--maroon-deep); background: var(--maroon-tint); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.cat-table tbody th { font-weight: 600; color: var(--maroon-deep); text-align: left; }
.cat-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cat-table td.is-unset { color: var(--danger); font-weight: 700; }
.cat-table td.is-off { color: var(--ink-soft); }
.cat-off { font-size: .72rem; border: 1px solid var(--gold-soft); border-radius: 999px; padding: 0 .35rem; color: var(--ink-soft); }
.cat-na { color: var(--gold-soft); text-align: right; }
.cat-bycanto { color: var(--ink-soft); font-style: italic; font-weight: 500; }
.cat-canto th { font-weight: 500; padding-left: 1.4rem; color: var(--ink); }
.cat-canto td, .cat-canto th { background: #FFFBF0; }
.cat-note td { font-size: .8rem; color: var(--ink-soft); }
.cat-expand { border: 0; background: none; color: var(--maroon); font-size: .8rem; font-weight: 600; padding: 0 .25rem; cursor: pointer; white-space: nowrap; }
.cat-table .price-input { width: 6rem; margin-left: auto; text-align: right; padding: .3rem .45rem; min-height: 38px; }
.cat-table .unit-input { width: 4rem; margin-left: auto; text-align: right; padding: .3rem .45rem; min-height: 38px; }
.price-input.is-draft, .unit-input.is-draft { border-color: var(--gold); background: #FFF3D6; }
.cat-on { display: flex; justify-content: flex-end; align-items: center; gap: .25rem; font-size: .75rem; color: var(--ink-soft); margin: .2rem 0 0; }
.cat-details-row td { background: var(--cream); }
.cat-fold > summary { cursor: pointer; list-style: revert; }
.cat-fold > summary h2 { display: inline; font-size: 1.1rem; }
.cat-fold[open] > summary { margin-bottom: .75rem; }

/* Tablet */
@media (min-width: 576px) {
  .totals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile-name { font-size: .8rem; }
  .pic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stepper { width: auto; margin-left: auto; }
  .stepper input { flex: none; width: 4.5rem; }
}

/* Desktop: sidebar replaces the bottom tabs, and pages use the width. */
@media (min-width: 992px) {
  .topbar { display: none; }
  .nav-rail {
    top: 0; right: auto; bottom: 0; width: 240px; display: flex; flex-direction: column;
    border-right: 3px solid var(--gold); padding: 1.25rem .75rem;
  }
  .nav-rail-brand { display: block; padding: 0 .5rem 1.25rem; }
  .nav-rail-brand .brand-title { color: var(--cream); font-size: 1.15rem; line-height: 1.25; }
  .nav-rail-brand small { color: var(--gold-soft); }
  .nav-links { flex-direction: column; gap: .25rem; flex: 1; }
  .nav-links li { flex: none; }
  .nav-link-app {
    flex-direction: row; justify-content: flex-start; gap: .75rem; height: 48px; padding: 0 .75rem;
    border-radius: 10px; font-size: 1rem;
  }
  .nav-link-app:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .nav-link-app[aria-current="page"] { background: var(--maroon); box-shadow: inset 3px 0 0 var(--gold-active); }
  .nav-rail-user { display: block; color: var(--gold-soft); font-size: .875rem; padding: .75rem .5rem 0; border-top: 1px solid rgba(255, 255, 255, .15); overflow-wrap: anywhere; }
  .nav-rail-user strong { display: block; color: var(--cream); }

  .page { margin-left: 240px; padding: 2rem 2.5rem; }
  .page-inner { max-width: 1120px; }
  .page-inner.narrow { max-width: 620px; margin-left: 0; }
  h1 { font-size: 1.75rem; }

  .add-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .add-side { position: sticky; top: 2rem; }

  .tiles { grid-template-columns: repeat(4, minmax(0, 150px)); gap: .75rem; }
  .tiles.tiles-carton { grid-template-columns: repeat(2, minmax(0, 150px)); }
  .tile-name { font-size: .85rem; }

  .camera-btn { width: auto; min-width: 280px; }
  .pic-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .review-grid, .cat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .rtable-wrap { background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: var(--radius); overflow: auto; }
  .rtable-wrap.rtable-fancy { background: #fff; border: 2px solid var(--t-edge); border-radius: 18px; box-shadow: 0 6px 18px rgba(84, 19, 32, .08); }
  .rtable-fancy .rtable tr, .rtable-fancy .rtable tr:nth-child(even) { border: 0; }
  .rtable-fancy .rtable th { background: var(--t-band); color: var(--t-ink); border-bottom: 2px solid var(--t-line); font-size: .85rem; letter-spacing: .01em; }
  .rtable-fancy .rtable td { border-top: 1px solid #EFEAE0; vertical-align: middle; }
  .rtable-fancy .rtable tbody tr:nth-child(odd) td { background: #fff; }
  .rtable-fancy .rtable tbody tr:nth-child(even) td { background: var(--t-alt); }
  .rtable-fancy .rtable tbody tr:hover td { background: #FFF6DD; }
  .rtable-fancy .rtable td.num { text-align: right; }
  .rtable-fancy .actions-cell { text-align: right; }
  .rtable { display: table; border-collapse: collapse; }
  .rtable thead { display: table-header-group; }
  .rtable tbody { display: table-row-group; }
  .rtable tr { display: table-row; background: none; border: 0; border-radius: 0; padding: 0; }
  .rtable th { background: var(--maroon-tint); color: var(--maroon-deep); font-weight: 600; padding: .7rem .8rem; text-align: left; white-space: nowrap; }
  .rtable td { display: table-cell; padding: .65rem .8rem; border-top: 1px solid var(--gold-soft); text-align: left; overflow-wrap: normal; vertical-align: top; }
  .rtable td::before { content: none; }
  .rtable .num-links { justify-content: flex-start; }

  .record-cards { display: none; }
  .record-table-wrap { display: block; background: #fff; border: 2px solid #8E78C9; border-radius: 18px; overflow: auto; box-shadow: 0 6px 18px rgba(84, 19, 32, .08); }
  .record-table { width: 100%; margin: 0; border-collapse: collapse; }
  .record-table th { background: #EDE6FA; color: #4A2F86; font-weight: 600; font-size: .85rem; padding: .7rem 1rem; text-align: left; border-bottom: 2px solid #CDBEF0; }
  .record-table td { padding: .7rem 1rem; border-top: 1px solid #EFEAE0; vertical-align: middle; }
  .record-table tbody tr { cursor: pointer; }
  .record-table tbody tr:nth-child(even) td { background: #F8F5FE; }
  .record-table tbody tr:hover td { background: #FFF6DD; }
  /* Wide tables scroll sideways inside their frame (the bar sits at the bottom of the frame, always in view), headings stay put */
  .record-table-wrap, .rtable-wrap { max-height: 72vh; }
  .record-table, .rtable { width: 100%; }
  .record-table th, .rtable th { position: sticky; top: 0; z-index: 2; white-space: nowrap; }
  .record-table td, .rtable td { white-space: nowrap; }
  /* All tables: each column is only as wide as its widest entry (spare width is not spread), with thin lines between columns */
  .rtable, .record-table { min-width: 0; }
  .rtable th, .rtable td, .record-table th, .record-table td { border-left: 1px solid var(--t-line, #CDBEF0); }
  .rtable th:first-child, .rtable td:first-child, .record-table th:first-child, .record-table td:first-child { border-left: 0; }
  .rtable td, .record-table td { border-top-color: var(--t-line, #CDBEF0); }
  .actions-cell { text-align: center; }
  .num { text-align: right !important; font-variant-numeric: tabular-nums; }

  .filter-grid { grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); }
  .filter-grid .span-all { grid-column: auto; }

  .messages-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
  .messages-preview { position: sticky; top: 2rem; }

  .auth-wrap { flex-direction: row; }
  .auth-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-bottom: 0; border-right: 4px solid var(--gold); }
  .auth-hero .brand-title { font-size: 2.25rem; }
  .auth-mark { width: 104px; height: 104px; }
  .auth-body { flex: 1; align-self: center; padding: 2rem; }

  .app-toast { bottom: 2rem; left: calc(50% + 120px); }
}

/* Phases 4 and 5: charts, live statistics, map, offline */
:root { --maroon-tint-faint: #F8F1E2; }
.card-app + .card-app, .insight-grid + .card-app, .card-app + .insight-grid { margin-top: .75rem; }
.total-value small { font-size: .75rem; font-weight: 500; color: var(--ink-soft); }
.total-primary .total-value small { color: var(--cream); }
.chart-tip {
  position: fixed; z-index: 2000; pointer-events: none; max-width: 240px; padding: .3rem .55rem;
  border-radius: 8px; background: var(--ink); color: var(--cream); font-size: .8rem;
}
[data-plot] { display: block; touch-action: pan-y; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .4rem; font-size: .85rem; color: var(--ink-soft); }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.key-line, .key-dash { display: inline-block; width: 18px; border-top: 2px solid var(--maroon); }
.key-dash { border-top: 2px dashed #9A8C7F; }
.bar-list { display: grid; gap: .5rem; margin-top: .5rem; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; align-items: center; gap: .5rem; font-size: .875rem; }
.bar-label { overflow-wrap: anywhere; }
.bar-track { height: 10px; }
.bar-fill { display: block; height: 100%; min-width: 2px; background: var(--maroon); border-radius: 0 4px 4px 0; }
.bar-value { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-soft); }
.heat { display: grid; grid-template-columns: 2.2rem repeat(var(--hours), minmax(0, 1fr)); gap: 2px; margin-top: .5rem; }
.heat-hour { font-size: .65rem; color: var(--ink-soft); white-space: nowrap; height: 1rem; }
.heat-day { font-size: .75rem; color: var(--ink-soft); align-self: center; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; min-height: 12px; }
.heat-key { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: .5rem; font-size: .75rem; color: var(--ink-soft); }
.heat-key i { width: 16px; height: 12px; border-radius: 2px; }
.insight-grid { display: grid; gap: .75rem; }
.insight-grid .card-app { margin: 0; }
.meter-head { margin-top: .4rem; font-variant-numeric: tabular-nums; }
.meter-head strong { font-size: 1.5rem; color: var(--maroon-deep); margin-right: .3rem; }
.meter { height: 12px; margin: .4rem 0; border-radius: 6px; background: var(--maroon-tint); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--maroon); }
.day-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .15rem 1rem; margin-top: .5rem; font-size: .85rem; max-height: 220px; overflow-y: auto; }
.day-table div { display: flex; justify-content: space-between; }
.map-box { height: 340px; border-radius: 10px; overflow: hidden; z-index: 0; }
.map-photo { display: block; width: 160px; height: 110px; object-fit: cover; border-radius: 6px; margin-bottom: .3rem; }
.person-line { display: flex; justify-content: space-between; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--gold-soft); font-size: .9rem; }
.log-detail { overflow-wrap: anywhere; }
.net-banner { max-width: 640px; margin: 0 auto .75rem; padding: .5rem .75rem; border-radius: 10px; background: var(--maroon-tint); color: var(--maroon-deep); font-size: .875rem; font-weight: 600; }
.queue-panel { display: grid; gap: .75rem; }
.queue-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; }
.queue-row > div:first-child { flex: 1 1 200px; min-width: 0; }
.queue-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (min-width: 768px) {
  .insight-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
  .net-banner { max-width: 1120px; }
  .map-box { height: 460px; }
}

/* Role picker and the "switch role" button. */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.switch-role {
  background: #FFD9E3; color: var(--maroon-deep); border: 1px solid #F4B6C8; border-radius: 999px; font-weight: 700;
  min-height: 36px; padding: 0 .85rem; font-size: .8rem; white-space: nowrap; margin-left: auto;
}
.nav-rail-user .switch-role { display: block; width: 100%; margin-top: .6rem; }
.mode-list { display: grid; gap: .85rem; margin-top: 1.25rem; }
.mode-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; width: 100%;
  padding: 1rem 2.75rem 1rem 1.25rem; text-align: left; cursor: pointer;
  background: var(--ivory); border: 1px solid var(--gold-soft); border-left: 4px solid var(--maroon);
  border-radius: var(--radius); box-shadow: 0 1px 2px rgba(84, 19, 32, .06);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.mode-card::after {
  content: ""; position: absolute; right: 1.1rem; top: 50%; width: 9px; height: 9px; margin-top: -6px;
  border-right: 2px solid var(--gold); border-top: 2px solid var(--gold); transform: rotate(45deg); transition: transform .15s;
}
.mode-card:hover { border-color: var(--gold); box-shadow: 0 4px 14px rgba(84, 19, 32, .12); transform: translateY(-1px); }
.mode-card:hover::after { transform: translateX(3px) rotate(45deg); }
.mode-card:active { transform: translateY(0); }
.mode-name { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; color: var(--maroon-deep); line-height: 1.2; }
.mode-pill {
  display: inline-block; max-width: 100%; padding: .2rem .8rem; border-radius: 999px;
  background: var(--maroon-tint); color: var(--maroon); border: 1px solid var(--gold-soft);
  font-size: .8rem; font-weight: 500; line-height: 1.35;
}

/* Group Leaders and Bhakti Vriksha groups: a form, then a table of what was entered. */
.org-form { display: grid; gap: .6rem; }
.org-form .field-error { margin-top: .2rem; }
.table-card { padding: 0; overflow: hidden; }
.table-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1rem; }
.table-head h2 { margin: 0; }
.table-count { color: var(--ink-soft); font-weight: 400; font-size: .9rem; }
.table-card .rtable tbody { padding: 0 .75rem .75rem; }
.status-pill { display: inline-block; padding: .1rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.status-pill.on { background: #E3F0E5; color: var(--success); }
.status-pill.off { background: #EFEAE0; color: var(--ink-soft); }
.status-pill.wait { background: var(--maroon-tint); color: var(--maroon); }
.row-actions { display: flex; flex-wrap: wrap; gap: .1rem 1rem; justify-content: flex-end; }
.link-btn.danger { color: var(--danger); }
.link-btn[disabled] { color: var(--ink-soft); opacity: .55; text-decoration: none; cursor: not-allowed; }
.cell-sub { display: block; color: var(--ink-soft); font-size: .8rem; }
.rtable tr.is-editing { border-color: var(--gold); box-shadow: 0 2px 10px rgba(84, 19, 32, .1); }
.rtable tr.is-editing td { display: block; text-align: left; }
.rtable tr.is-editing td::before { display: block; margin-bottom: .15rem; }
.confirm-box { background: #FBEDEA; border: 1px solid #E9C3BC; border-radius: 10px; padding: .7rem .8rem; color: var(--ink); }
.confirm-box .row-actions { justify-content: flex-start; margin-top: .4rem; }
@media (min-width: 768px) {
  .org-form { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: start; }
  .table-card .rtable tbody { padding: 0; }
  .table-card .rtable-wrap { border: 0; border-top: 1px solid var(--gold-soft); border-radius: 0; }
  .row-actions { justify-content: flex-start; flex-wrap: nowrap; }
  .rtable tr.is-editing td { display: table-cell; }
  .rtable tr.is-editing td::before { display: none; }
  .rtable tr.confirm-tr td { background: #FBEDEA; }
}

/* The Group Leaders table: the add row sits at the top of the table itself, and cells edit in place. */
.add-row { background: var(--maroon-tint-faint); }
.rtable tr.add-row { border-color: var(--gold); border-style: dashed; }
.add-row .form-control { min-width: 9rem; }
.cell-edit { cursor: text; border-bottom: 1px dashed var(--gold); }
.cell-edit:hover { background: var(--maroon-tint); }
.rtable tr.inactive-row td { color: var(--ink-soft); }
.state-link { font-weight: 600; text-decoration: underline; cursor: pointer; background: none; border: 0; padding: .25rem 0; min-height: 32px; }
.state-link.on { color: var(--success); }
.state-link.off { color: var(--ink-soft); }
@media (min-width: 768px) {
  .rtable tr.add-row td { background: var(--maroon-tint-faint); border-top: 0; vertical-align: middle; }
}

/* Targets */
.t-search { margin: .75rem 0; }
.t-edit { display: flex; gap: .4rem; align-items: center; }
.t-edit input { width: 7rem; min-height: 40px; }
.t-edit .btn-ghost { min-height: 40px; padding: 0 .9rem; }
.hist { position: relative; display: inline-block; }
.hist-pop { display: none; position: absolute; z-index: 20; right: 0; top: 1.6rem; min-width: 17rem; max-width: 85vw;
  background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 10px; padding: .6rem .8rem;
  box-shadow: 0 8px 24px rgba(43, 26, 20, .18); text-align: left; }
.hist:hover .hist-pop, .hist:focus-within .hist-pop { display: block; }
.hist-line { display: block; padding: .25rem 0; font-size: .85rem; }
.hist-line span { display: block; color: var(--muted, #7a6a5d); font-size: .78rem; }
.hist-all { max-height: 18rem; overflow: auto; border-top: 1px solid var(--gold-soft); margin-top: .5rem; padding-top: .4rem; }
@media (max-width: 767px) { .hist-pop { left: 0; right: auto; } }

/* Desktop: the title bar sits beside the sidebar, not underneath it. */
@media (min-width: 992px) {
  .topbar { display: flex; margin-left: 240px; padding-left: 2.5rem; padding-right: 2.5rem; }
  .topbar .brand-title { font-size: 1.2rem; }
  .topbar .role-menu { display: none; }
  .nav-rail-brand { display: none; }
}

/* Family members: who an entry is recorded for. */
.people-chips { margin-bottom: .75rem; }
.people-add { margin-bottom: .4rem; }

/* Book tiles: every picture the same size (3:4); names above, hidden by default. */
.tile img { aspect-ratio: 3 / 4; object-fit: cover; margin-bottom: .1rem; }
.tile-name { margin-bottom: .3rem; }
.tiles-plain .tile { padding: .9rem .3rem; }
.tiles-plain .tile-code { margin-top: 0; font-size: 1.15rem; }

/* UPI by dynamic QR (Cashfree): the checkout hint, the QR screen and the review label. */
.gateway-hint { margin: 0 0 .25rem; }
.qr-panel { text-align: center; padding: 1.5rem 1rem; }
.qr-amount { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; color: var(--maroon); line-height: 1.1; }
.qr-summary { color: var(--ink-soft); font-size: .92rem; margin: .25rem 0 .75rem; }
.qr-image { display: block; width: 260px; height: 260px; max-width: 100%; margin: 0 auto .75rem; background: #fff; padding: 8px;
  border: 2px solid var(--gold); border-radius: 10px; image-rendering: pixelated; }
.qr-missing { color: var(--danger); }
.qr-status { display: inline-block; margin: .25rem 0 .5rem; padding: .45rem 1rem; border-radius: 999px; font-weight: 700;
  background: var(--maroon-tint); color: var(--maroon-deep); }
.qr-status.qr-bad { background: #FBE3E0; color: var(--danger); }
.qr-sandbox { margin: .75rem 0; padding: .6rem .75rem; border: 1px dashed var(--gold); border-radius: 10px; background: var(--ivory); font-size: .88rem; text-align: left; }
.qr-sandbox code { overflow-wrap: anywhere; }
.qr-actions { display: flex; flex-direction: column; gap: .5rem; margin: .75rem 0; }
.review-online { flex: none; width: 96px; aspect-ratio: 3 / 4; display: grid; place-items: center; text-align: center; padding: .4rem;
  font-size: .78rem; font-weight: 600; color: var(--success); background: #E6F2E8; border: 1px solid var(--gold-soft); border-radius: 8px; }

/* Checkout: cash given; the "check all pending" line */
.cash-row { display: flex; align-items: center; gap: .4rem; max-width: 12rem; }
.cash-sign { font-weight: 700; color: var(--maroon); }
.pay-hint-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin-bottom: .6rem; }
.pay-hint-row .pay-hint { flex: 1 1 18rem; margin: 0; }
.pay-hint-row [data-check-all] { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }

/* Payment details (the (i) icon beside a status) */
.icon-info { border-color: #BCCBF1; background: #E3EAFB; color: #2E4A9A; margin-left: .3rem; cursor: pointer; }
.icon-info:hover { background: #D2DDF8; }
.details-col { text-align: center; }
.edit-col { text-align: center; }
.pd-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; margin-bottom: .6rem; }
.pd-amount { font-size: 1.5rem; font-weight: 700; color: var(--maroon); }
.pd-test { font-size: .72rem; font-weight: 700; background: #FFF1CC; color: #7A5600; border-radius: 999px; padding: .1rem .5rem; }
.pd-list { display: grid; grid-template-columns: minmax(7.5rem, 38%) 1fr; gap: .3rem .8rem; margin: 0 0 .6rem; font-size: .92rem; }
.pd-list dt { color: var(--ink-soft); font-weight: 600; }
.pd-list dd { margin: 0; overflow-wrap: anywhere; }
.pd-mono { font-family: ui-monospace, Consolas, monospace; font-size: .86rem; }
.pd-attempt { border: 2px solid #DCC3E8; background: #FBF7FD; border-radius: 14px; padding: .7rem .9rem; margin-top: .7rem; }
.pd-attempt h3 { font-size: 1rem; margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem; }
.pd-all summary { cursor: pointer; color: var(--ink-soft); font-size: .86rem; margin-bottom: .4rem; }
.pd-foot { margin-top: .8rem; }

/* One row per sale: received against due, and the books inside the sale pop-up */
.recv { display: inline-flex; align-items: center; gap: .4rem; }
.recv-ok { color: #12703A; font-weight: 700; }
.recv-short { background: #FADCD9; color: #8C1D18; border: 1px solid #F0B8B2; border-radius: 999px; padding: .1rem .55rem; font-size: .76rem; font-weight: 700; }
.recv-extra { background: #FFF1CC; color: #7A5600; border: 1px solid #F0D98C; border-radius: 999px; padding: .1rem .55rem; font-size: .76rem; font-weight: 700; }
.total-short { background: #FEF0EE; border-color: #F0B8B2; }
.total-short .total-value { color: #8C1D18; }
.sale-lines { width: 100%; border-collapse: collapse; margin-bottom: .6rem; font-size: .93rem; }
.sale-lines th { background: #EDE6FA; color: #4A2F86; text-align: left; padding: .4rem .6rem; font-size: .82rem; }
.sale-lines td { padding: .4rem .6rem; border-top: 1px solid #EFEAE0; }
.sale-lines .num { text-align: right; }
.sale-lines tfoot td { font-weight: 700; border-top: 2px solid #CDBEF0; }
.sale-lines tfoot tr + tr td { border-top: 1px solid #EFEAE0; }
.sale-lines .sale-short td { color: #8C1D18; background: #FEF0EE; }
.sale-lines .sale-ok td { color: #12703A; }


/* ---- Payment Review: a checked payment shows green, a queried one amber, at a glance ---- */
.rv-details { display: flex; flex-direction: column; gap: .15rem; min-width: 9rem; max-width: 16rem; }
.rv-bv { display: block; font-size: .8rem; color: var(--ink-soft); }
.rv-by { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.rv-note { font-size: .85rem; overflow-wrap: anywhere; }
.rv-thumb { display: inline-block; }
.rv-thumb img { display: block; width: 44px; height: 58px; object-fit: cover; border-radius: 6px; border: 1px solid var(--gold-soft); }
.rv-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid transparent; }
.rv-pill-pending { background: #F1EEE6; color: #6B5F4B; border-color: #DDD5C2; }
.rv-pill-verified { background: #CDEBD6; color: #1E6B3A; border-color: #8FCDA3; }
.rv-pill-queried { background: #FFE9B8; color: #8A5A00; border-color: #F0C766; }
.rv-actions { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.rv-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #fff; cursor: pointer; border: 2px solid; padding: 0; }
.rv-tick { color: #2F8F52; border-color: #8FCDA3; }
.rv-tick:hover:not(:disabled) { background: #EAF7EE; }
.rv-tick.on { background: #2F8F52; border-color: #2F8F52; color: #fff; }
.rv-tick:disabled { cursor: default; opacity: .9; }
.rv-ask { color: #B27300; border-color: #F0C766; }
.rv-ask:hover { background: #FFF5DC; }
.rv-ask.on { background: #E39A00; border-color: #E39A00; color: #fff; }
.rv-queryform { flex-basis: 100%; display: flex; flex-direction: column; gap: .3rem; min-width: 14rem; }
.rv-queryform[hidden] { display: none; }
.rv-queryrow { display: flex; gap: .4rem; }
.rtable-wrap.rtable-fancy .rtable tr.rv-verified { background: #E3F5E9; border-color: #5FA97F; }
.rtable-wrap.rtable-fancy .rtable tr.rv-queried { background: #FFF4D6; border-color: #E2B24A; }
@media (min-width: 768px) {
  .rtable-wrap.rtable-fancy .rtable tbody tr.rv-verified td { background: #E3F5E9; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.rv-queried td { background: #FFF4D6; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.rv-verified:hover td { background: #D5EEDD; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.rv-queried:hover td { background: #FFEBBA; }
}


/* ---- Sorting and filtering on every table (assets/js/tablekit.js) ---- */
.rt-sortable { cursor: pointer; user-select: none; }
.rt-sortable::after { content: '\21C5'; margin-left: .35rem; font-size: .85em; opacity: .35; }
th[aria-sort="ascending"]::after { content: '\25B2'; opacity: 1; font-size: .7em; }
th[aria-sort="descending"]::after { content: '\25BC'; opacity: 1; font-size: .7em; }
.rt-sortable:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.rt-filters th { padding: .3rem .5rem; font-weight: 400; background: var(--t-alt, #fff); border-bottom: 2px solid var(--t-line, var(--gold-soft)); }
.rt-filters input, .rt-filters select { width: 100%; min-width: 4.5rem; padding: .2rem .4rem; font-size: .8rem; border: 1px solid var(--gold-soft); border-radius: 6px; background: #fff; color: var(--ink); }
.rt-filters input:focus, .rt-filters select:focus { outline: 2px solid var(--gold); outline-offset: 0; }

@media (min-width: 768px) {
  /* Screens with big tables use the whole width, leaving 10% of the space beside the menu on each side. */
  .page:is([data-view="records"], [data-view="dashboard"], [data-view="admin"], [data-view="superadmin"], [data-view="targets"], [data-view="payments"], [data-view="allrecords"]) {
    padding-left: calc((100vw - 240px) * .1); padding-right: calc((100vw - 240px) * .1);
  }
  .page:is([data-view="records"], [data-view="dashboard"], [data-view="admin"], [data-view="superadmin"], [data-view="targets"], [data-view="payments"], [data-view="allrecords"]) .page-inner:not(.narrow) { max-width: none; }
  .rt-filters th { position: sticky; top: var(--rt-head-h, 2.6rem); z-index: 2; }
}

/* ---- Pictures: comment box, community viewer, reported pictures ---- */
.composer-preview { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: 12px; background: #000; }
.pic-comment { color: var(--ink); font-style: italic; overflow-wrap: anywhere; }
.pic-com { cursor: pointer; }
.pic-com:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pic-frame { position: relative; }
.pic-counts { position: absolute; left: .3rem; bottom: .3rem; display: flex; flex-wrap: wrap; gap: .2rem; max-width: calc(100% - .6rem); pointer-events: none; }
.pic-counts span { padding: .05rem .35rem; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .7rem; line-height: 1.3; }
.pic-who { display: flex; align-items: center; gap: .3rem; min-width: 0; }
.pic-who strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pic-when { display: flex; align-items: center; justify-content: space-between; gap: .3rem; margin-top: .15rem; white-space: nowrap; font-size: .74rem; }
.pic-when > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pic-map { flex: none; display: inline-flex; align-items: center; gap: .2rem; min-width: 2.2rem; justify-content: center; min-height: 1.9rem; padding: .1rem .35rem; border-radius: 8px; border: 1px solid #9DB9F5; background: #E8F1FF; color: #1A56C4; font-size: .78rem; font-weight: 700; text-decoration: none; }
.pic-map.off { font-size: .7rem;border-color: var(--gold-soft); background: transparent; color: var(--ink-soft); font-weight: 400; opacity: .7; }
.pic-quick { display: flex; gap: .25rem; margin-top: .35rem; }
.pic-quick-btn { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; min-height: 1.9rem; padding: .05rem .1rem; border-radius: 999px; border: 1px solid var(--gold-soft); background: #fff; font-size: .9rem; line-height: 1; cursor: pointer; }
.pic-quick-btn.pop { animation: pic-pop .35s ease-out; }
@keyframes pic-pop { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pic-quick-btn.pop { animation: none; } }
.pic-quick-btn.on { background: var(--maroon-tint, #f6e6ea); border-color: var(--maroon-deep, #541320); }
body.pv-open { overflow: hidden; }
.pv { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 8, 10, .96); color: #fff; display: flex; flex-direction: column; }
.pv-bar { display: flex; justify-content: space-between; align-items: center; padding: calc(.5rem + env(safe-area-inset-top, 0px)) 1rem .5rem; }
.pv-count { font-size: .9rem; opacity: .85; }
.pv-close { background: rgba(255, 255, 255, .15); border: 0; color: #fff; width: 2.5rem; height: 2.5rem; border-radius: 50%; font-size: 1.1rem; }
.pv-track { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pv-track::-webkit-scrollbar { display: none; }
.pv-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; overflow-y: auto; padding: 0 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); }
.pv-inner { max-width: 640px; margin: 0 auto; }
.pv-img { display: block; width: 100%; max-height: 62vh; object-fit: contain; border-radius: 10px; }
.pv-meta { margin-top: .6rem; font-size: .95rem; }
.pv-comment { margin-top: .25rem; font-style: italic; overflow-wrap: anywhere; }
.pv-react { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.pv-emoji { display: inline-flex; align-items: center; gap: .3rem; min-height: 2.75rem; padding: .25rem .75rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); color: #fff; }
.pv-emoji.on { background: #fff; color: #222; border-color: #fff; }
.pv-glyph { font-size: 1.35rem; line-height: 1; }
.pv-n { font-size: .9rem; min-width: .6rem; }
.pv-who { margin-top: .6rem; font-size: .9rem; opacity: .9; display: grid; gap: .2rem; overflow-wrap: anywhere; }
.pv-report { margin-top: 1rem; }
.pv-report .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .4); }
.pv-report-form { background: rgba(255, 255, 255, .08); border-radius: 12px; padding: .75rem; }
.pv-report-form .form-label, .pv-report-form .field-hint { color: #fff; }
.pv-nav { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .18); color: #fff; font-size: 1.8rem; line-height: 1; display: none; }
.pv-prev { left: .5rem; }
.pv-next { right: .5rem; }
@media (hover: hover) and (pointer: fine) { .pv-nav { display: block; } }
.obj-list { display: grid; gap: .75rem; }
.obj-card { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem; padding: .6rem; border: 1px solid var(--gold-soft); border-radius: 12px; background: var(--ivory); }
.obj-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.obj-reason { margin-top: .25rem; color: var(--maroon-deep, #541320); overflow-wrap: anywhere; }
@media (max-width: 480px) { .obj-card { grid-template-columns: 1fr; } .obj-card img { max-height: 14rem; } }

.pic-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.pic-actions .btn-sm { min-height: 2.25rem; padding: .2rem .6rem; font-size: .8rem; }

.pic-actions .icon-btn { width: 2.25rem; height: 2.25rem; }
.pic-actions .icon-btn.is-on { background: var(--maroon-tint, #f6e6ea); color: var(--maroon-deep, #541320); }
.pic-actions .icon-danger:hover, .pic-actions .icon-danger.is-armed { background: #FBEDEA; color: #B3261E; border-color: #B3261E; }
.pic-comment-form { margin-top: .5rem; }
.pic-comment-form textarea { font-size: .85rem; }

/* ---- Profiles, Team, conversations ---- */
.avatar { display: inline-block; border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; background: var(--maroon-tint, #f1dde1); }
.avatar-sm { width: 1.75rem; height: 1.75rem; }
.avatar-md { width: 2.75rem; height: 2.75rem; }
.avatar-lg { width: 5rem; height: 5rem; }
.avatar-initial { display: inline-flex; align-items: center; justify-content: center; color: var(--maroon-deep, #541320); font-weight: 600; font-size: .75em; }
.avatar-sm.avatar-initial { font-size: .7rem; }
.avatar-md.avatar-initial { font-size: 1rem; }
.avatar-lg.avatar-initial { font-size: 1.6rem; }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; line-height: 0; }
.avatar-btn:focus-visible, .person-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.topbar-avatar { margin-left: auto; line-height: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .7); }
.switch-role + .topbar-avatar { margin-left: .5rem; }
.rail-profile { display: inline-block; margin-bottom: .4rem; line-height: 0; }
.pf { position: fixed; inset: 0; z-index: 2100; background: rgba(15, 8, 10, .6); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.pf-card { position: relative; background: #fff; color: var(--ink); width: 100%; max-width: 26rem; max-height: 90vh; overflow-y: auto; border-radius: 18px; padding: 1.25rem; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.pf-x { position: absolute; top: .6rem; right: .6rem; background: rgba(0, 0, 0, .08); color: var(--ink); }
.pf-head { text-align: center; display: grid; gap: .25rem; justify-items: center; }
.pf-head h2 { margin: .4rem 0 0; }
.pf-list { margin: 1rem 0; display: grid; gap: .5rem; }
.pf-row { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .5rem; }
.pf-row dt { color: var(--ink-soft); font-weight: 500; }
.pf-row dd { margin: 0; overflow-wrap: anywhere; }
.pf-actions { display: grid; gap: .75rem; margin-top: 1rem; }
.pf-upi { border: 1px solid var(--gold-soft); border-radius: 12px; padding: .75rem; }
.pf-edit-photo { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.who-chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; border-radius: 999px; padding: .15rem .6rem .15rem .2rem; margin: 0 .3rem .3rem 0; }
.pv-who-row { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem; }
.pv-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.team-group { margin-top: 1.25rem; }
.team-group h2 small { color: var(--ink-soft); font-weight: 400; }
.carousel { display: flex; gap: .75rem; overflow-x: auto; scroll-snap-type: x proximity; padding: .25rem .1rem .75rem; -webkit-overflow-scrolling: touch; }
.person-card { flex: 0 0 8.5rem; scroll-snap-align: start; display: grid; justify-items: center; gap: .3rem; text-align: center; padding: .75rem .5rem; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 14px; cursor: pointer; font: inherit; color: inherit; }
.person-card strong { overflow-wrap: anywhere; }
.person-card small { color: var(--ink-soft); }
.thread-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.thread { display: flex; align-items: center; gap: .75rem; width: 100%; text-align: left; padding: .6rem; border: 1px solid var(--gold-soft); border-radius: 12px; background: var(--ivory); font: inherit; color: inherit; }
.thread-body { display: grid; min-width: 0; flex: 1; }
.thread-last { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.chat-log { height: min(60vh, 32rem); overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; padding: .6rem; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; }
.bubble { max-width: 80%; padding: .45rem .7rem; border-radius: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble small { display: block; opacity: .65; font-size: .7rem; margin-top: .15rem; }
.bubble.mine { align-self: flex-end; background: var(--maroon, #7A1F2B); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: #fff; border: 1px solid var(--gold-soft); border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: .5rem; margin-top: .6rem; align-items: flex-end; }
.chat-form textarea { flex: 1; }

/* ---- Money: transfers between devotees ---- */
.xfer-list { display: grid; gap: .75rem; }
.xfer { border: 1px solid var(--gold-soft); border-radius: 14px; background: var(--ivory); padding: .75rem; display: grid; gap: .4rem; }
.xfer-top { display: flex; align-items: center; gap: .6rem; }
.xfer-who { display: grid; flex: 1; min-width: 0; }
.xfer-who small { color: var(--ink-soft); }
.xfer-dir { font-weight: 600; }
.xfer-dir.sent { color: #B3261E; }
.xfer-dir.received { color: #1E7B45; }
.xfer-note { font-style: italic; overflow-wrap: anywhere; }
.xfer-shot img { display: block; max-width: 12rem; max-height: 12rem; border-radius: 10px; border: 1px solid var(--gold-soft); }
.xfer-results { display: grid; gap: .35rem; margin-top: .4rem; }
.xfer-chosen { display: flex; align-items: center; gap: .6rem; }

/* ---- Counts on menu tabs ---- */
.nav-link-app { position: relative; }
.t-head-actions { display: inline-flex; align-items: center; gap: .75rem; flex-wrap: wrap; } .t-editbar { position: sticky; top: .5rem; z-index: 5; } .row-changed td { background: #FFF3D6 !important; } .t-view { font-weight: 600; } /* Targets: edit mode and Save all */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem .75rem; margin-bottom: .5rem; border-radius: 12px; background: var(--maroon-tint); } .pick-cell { width: 2.2rem; } .row-picked td { background: #FFF3D6 !important; } /* Alerts & Issues: tick problems, then act on them */
.err-people { list-style: none; padding: 0; margin: 0; } .err-people li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--gold-soft); } /* Alerts & Issues: who a problem happened to */
.chip-badge { width: auto; min-width: 1.3rem; height: 1.3rem; padding: 0 .35rem; margin-left: .35rem; border-radius: 999px; background: #D32F2F; color: #fff; font-size: .72rem; vertical-align: middle; } /* Alerts & Issues tab: the same count as the Dashboard menu item */
.nav-badge { position: absolute; top: .15rem; right: .35rem; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px; background: #D32F2F; color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.15rem; text-align: center; }
@media (min-width: 992px) { .nav-badge { position: static; margin-left: auto; } }
@media (max-width: 991.98px) {
  .nav-links { overflow-x: auto; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links li { flex: 1 0 4.4rem; }
}

/* ---- Picture viewer: Back button, high resolution, load failure ---- */
.pv-back { background: rgba(255, 255, 255, .18); border: 0; color: #fff; border-radius: 999px; padding: .5rem 1rem; min-height: 2.5rem; font-weight: 600; }
.iv { align-items: stretch; }
.iv-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 1rem; }
.iv-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; }
.iv-loading { position: absolute; color: #fff; opacity: .8; }
.iv-fail { text-align: center; color: #fff; padding: 1rem; }
.pv-slide .iv-fail { background: rgba(255, 255, 255, .08); border-radius: 10px; margin-top: .6rem; }
.iv-caption { text-align: center; color: #fff; padding: .25rem 1rem; overflow-wrap: anywhere; }
.iv-tools { display: flex; justify-content: center; flex-wrap: wrap; gap: .6rem; padding: .6rem 1rem calc(.8rem + env(safe-area-inset-bottom, 0px)); }
.iv-tools .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .45); }
.pv-tools { padding: .5rem 0 0; justify-content: flex-start; }
.iv-nav { display: block; }

/* ---- Personal QR code and the scanner ---- */
.qr-box { display: grid; justify-items: center; gap: .4rem; }
.qr-box svg { width: 100%; max-width: 15rem; height: auto; background: #fff; padding: .4rem; border-radius: 12px; border: 1px solid var(--gold-soft); }
.qr-name { font-weight: 600; text-align: center; overflow-wrap: anywhere; }
.qs { align-items: stretch; }
.qs-stage { position: relative; flex: 1; min-height: 0; margin: 0 1rem; border-radius: 14px; overflow: hidden; background: #000; }
.qs-video { width: 100%; height: 100%; object-fit: cover; }
.qs-frame { position: absolute; inset: 18% 15%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 18px; pointer-events: none; }
.qs-msg { color: #fff; text-align: center; padding: .6rem 1rem 0; margin: 0; overflow-wrap: anywhere; }

/* ---- Date and time range filter, Excel export ---- */
.dt-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin: .75rem 0 .4rem; }
.dt-field { display: grid; gap: .2rem; flex: 1 1 13rem; font-size: .85rem; color: var(--ink-soft); }
.dt-field .form-control { min-height: 2.75rem; }

/* ---- All Records: the accounts check of UPI payments ---- */
.rtable-wrap.rtable-fancy .rtable tr.acc-verified { background: #F6FCF8; }
.rtable-wrap.rtable-fancy .rtable tr.acc-rejected { background: #FDF6F6; }
@media (min-width: 992px) {
  .rtable-wrap.rtable-fancy .rtable tbody tr.acc-verified td { background: #F6FCF8; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.acc-rejected td { background: #FDF6F6; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.acc-verified:hover td { background: #EDF8F1; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.acc-rejected:hover td { background: #FBEBEB; }
}
.pd-verify { border: 1px solid var(--gold-soft); border-radius: 12px; padding: .75rem; margin-bottom: 1rem; }
.pd-verify-verified { background: #F6FCF8; border-color: #A9DBBE; }
.pd-verify-queried { background: #FDF6F6; border-color: #EEB2B2; }
.pd-verify h3 { font-size: 1rem; margin: 0 0 .4rem; }
.pd-vbuttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.pd-rejectform { margin-top: .5rem; }
.pd-shot img { display: block; max-width: 100%; max-height: 16rem; border-radius: 10px; border: 1px solid var(--gold-soft); margin-top: .5rem; }

.pd-result { border-radius: 10px; padding: .55rem .75rem; margin-bottom: .6rem; font-weight: 600; background: #EEF1F6; color: #33415C; }
.pd-result-verified { background: #DDF3E5; color: #17653A; }
.pd-result-queried { background: #FBE3E3; color: #8A1F1F; }

/* ---- Language choice ---- */
.lang-options { display: grid; gap: .6rem; }
.lang-option { display: flex; gap: .65rem; align-items: flex-start; padding: .65rem .75rem; border: 1px solid var(--line, #E3DCEF); border-radius: 12px; cursor: pointer; }
.lang-option:has(input:checked) { border-color: var(--maroon, #6B2A8C); background: var(--maroon-tint, #F4EEFA); }
.lang-option input { margin-top: .3rem; }
.lang-option > span { display: grid; gap: .15rem; }
.lang-example { font-size: .9rem; font-style: italic; }

/* ---- Targets: totals and the tree ---- */
.t-totals { display: flex; flex-wrap: wrap; gap: .6rem; margin: .5rem 0 .75rem; }
.t-total { flex: 1 1 9rem; padding: .6rem .8rem; border-radius: 12px; background: var(--maroon-tint, #F4EEFA); color: var(--ink-soft, #555); font-size: .85rem; }
.t-total span { display: block; font-size: 1.5rem; font-weight: 700; color: var(--ink, #222); }
.t-sort { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.tt-list { list-style: none; margin: 0; padding: 0; counter-reset: tt; }
.tt-list > li { counter-increment: tt; position: relative; padding-left: 1.9rem; }
.tt-list > li::before { content: counter(tt); position: absolute; left: 0; top: .85rem; font-weight: 600; color: var(--ink-soft, #666); width: 1.6rem; text-align: right; }
.tt-node { border-left: 2px solid var(--line, #E3DCEF); margin: .25rem 0; }
.tt-node > summary { cursor: pointer; list-style: none; padding: .35rem .5rem; }
.tt-node > summary::-webkit-details-marker { display: none; }
.tt-node > summary::before { content: '▸'; float: left; margin-right: .4rem; color: var(--ink-soft, #777); }
.tt-node[open] > summary::before { content: '▾'; }
.tt-children { margin-left: 1rem; }
.tt-leaf { padding: .35rem .5rem .35rem 1.2rem; border-left: 2px solid var(--line, #E3DCEF); margin: .25rem 0; }
.tt-line { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; justify-content: space-between; }
.tt-name { display: grid; min-width: 9rem; }
.tt-nums { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; }
.tt-done { white-space: nowrap; font-size: .9rem; }
.tt-leader > summary { font-size: 1.02rem; background: var(--maroon-tint, #F4EEFA); border-radius: 8px; }

.t-rolled { font-weight: 600; }
.t-rolled .cell-sub { display: block; font-weight: 400; }

.tt-cell { display: inline-flex; align-items: flex-start; gap: .4rem; }
.tt-toggle { width: 1.5rem; height: 1.5rem; flex: none; border: 1px solid var(--line, #D8CFE6); border-radius: 6px; background: #fff; cursor: pointer; padding: 0; line-height: 1; color: var(--ink, #333); }
.tt-toggle[data-toggle]::before { content: '+'; font-weight: 700; }
.tt-toggle[aria-expanded="true"]::before { content: '−'; }
.tt-none { border-color: transparent; background: none; cursor: default; }
.tt-table tr[data-depth="0"] td { background: var(--maroon-tint, #F4EEFA); }

/* ---- All Records: QR payments that are not paid ---- */
.rtable-wrap.rtable-fancy .rtable tr.pay-row-pending { background: #FFF7E0; }
.rtable-wrap.rtable-fancy .rtable tr.pay-row-dropped { background: #FDEDE0; }
.rtable-wrap.rtable-fancy .rtable tr.pay-row-failed { background: #FCE4E4; }
@media (min-width: 992px) {
  .rtable-wrap.rtable-fancy .rtable tbody tr.pay-row-pending td { background: #FFF7E0; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.pay-row-dropped td { background: #FDEDE0; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.pay-row-failed td { background: #FCE4E4; }
}

/* ---- All Records: bold dark maroon filters, and the export choice ---- */
.rec-filters .form-control, .rec-filters .form-select, .rec-filters .chip, .rec-filters .btn-ghost,
.dt-row.rec-filters .dt-field, .rec-filters::placeholder { font-weight: 700; color: var(--maroon-deep); }
.rec-filters .form-control::placeholder { font-weight: 600; color: var(--maroon); opacity: .75; }
.rec-filters .chip.active { color: #fff; }
.export-box { display: grid; gap: .6rem; justify-items: start; margin-top: 1rem; }
.mini-switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 700; color: var(--maroon-deep); }
.mini-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mini-track { position: relative; width: 2.4rem; height: 1.35rem; border-radius: 999px; background: #CDBFC0; flex: none; transition: background .15s; }
.mini-track::after { content: ''; position: absolute; top: .15rem; left: .15rem; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.mini-switch input:checked + .mini-track { background: var(--maroon, #7A1F2B); }
.mini-switch input:checked + .mini-track::after { transform: translateX(1.05rem); }
.mini-switch input:focus-visible + .mini-track { outline: 3px solid #D9A441; outline-offset: 2px; }

/* ---- All Records: one colour per payment status, the same as the status droplet ---- */
.rtable-wrap.rtable-fancy .rtable tbody tr.row-st-success, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-success:nth-child(even) { background: #E3F6E8; }
.rtable-wrap.rtable-fancy .rtable tbody tr.row-st-pending, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-pending:nth-child(even) { background: #FFF6DA; }
.rtable-wrap.rtable-fancy .rtable tbody tr.row-st-user_dropped, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-user_dropped:nth-child(even) { background: #F1E8F8; }
.rtable-wrap.rtable-fancy .rtable tbody tr.row-st-failed, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-failed:nth-child(even) { background: #FCE3E1; }
.rtable-wrap.rtable-fancy .rtable tbody tr.row-st-deemed_failed, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-deemed_failed:nth-child(even) { background: #EEECE8; }
.rtable-wrap.rtable-fancy .rtable tbody tr.row-st-queried, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-queried:nth-child(even) { background: #E6ECFB; }
.rtable-wrap.rtable-fancy .rtable tbody tr.row-st-none, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-none:nth-child(even) { background: #F2F2F2; }
@media (min-width: 992px) {
  .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-success td, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-success:nth-child(even) td { background: #E3F6E8; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-pending td, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-pending:nth-child(even) td { background: #FFF6DA; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-user_dropped td, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-user_dropped:nth-child(even) td { background: #F1E8F8; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-failed td, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-failed:nth-child(even) td { background: #FCE3E1; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-deemed_failed td, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-deemed_failed:nth-child(even) td { background: #EEECE8; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-queried td, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-queried:nth-child(even) td { background: #E6ECFB; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-none td, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-none:nth-child(even) td { background: #F2F2F2; }
  .rtable-wrap.rtable-fancy .rtable tbody tr[class*='row-st-']:hover td { filter: brightness(.97); }
}

/* My Profile: family members and friends */
.fm-rows { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .5rem; }
.fm-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .5rem .65rem; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; }
.fm-row .fm-name { flex: 1 1 8rem; font-weight: 600; color: var(--maroon-deep); min-width: 0; overflow-wrap: anywhere; }
.fm-row .form-control { flex: 1 1 10rem; min-width: 0; }
.fm-row .btn-app, .fm-row .btn-ghost { min-height: 36px; padding: 0 .85rem; font-size: .85rem; }

/* Offline / waiting-to-send bar, at the top of every screen */
.net-banner { box-shadow: 0 2px 8px rgba(84, 19, 32, .12); }
.net-banner.net-offline { background: #FFE8B3; color: #5A3A00; border: 1px solid #E2B24A; }
.net-banner.net-waiting { background: #FBE3EA; color: var(--maroon-deep); border: 1px solid #F4B6C8; }
.net-send { margin-left: .4rem; min-height: 30px; padding: 0 .75rem; border-radius: 999px; border: 1px solid var(--maroon); background: var(--maroon); color: var(--cream); font-weight: 700; font-size: .8rem; }

/* My Profile: every section has a dark maroon header, and a flower line separates one section from the next */
.profile-page .card-app { overflow: hidden; }
.profile-page .card-app > h2 {
  background: var(--maroon-deep); color: var(--cream); font-size: 1.1rem; letter-spacing: .02em;
  margin: -1rem -1rem 1rem; padding: .7rem 1rem; border-bottom: 3px solid var(--gold);
}
.profile-page .card-app + .card-app { margin-top: 0; }
.flower-rule { display: flex; align-items: center; gap: .6rem; margin: 1.1rem 0; color: var(--gold); font-size: 1.4rem; line-height: 1; }
.flower-rule i { flex: 1; height: 2px; background: linear-gradient(90deg, var(--gold), var(--maroon) 50%, var(--gold)); border-radius: 2px; }

/* Move and zoom a picture before it becomes the profile photo */
.crop-card { text-align: center; display: grid; justify-items: center; gap: .75rem; width: auto; max-width: 100%; }
.crop-card h2 { margin: 0; }
.crop-frame { position: relative; border-radius: 12px; overflow: hidden; background: #fff; touch-action: none; }
.crop-frame canvas { display: block; cursor: grab; touch-action: none; }
.crop-frame canvas:active { cursor: grabbing; }
.crop-ring { position: absolute; inset: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 999px rgba(84, 19, 32, .45); border: 2px solid #fff; }
.crop-zoom { display: flex; align-items: center; gap: .6rem; width: 100%; font-size: 1.3rem; color: var(--maroon-deep); }
.crop-zoom input { flex: 1; accent-color: var(--maroon); }
.crop-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

.hist-list { list-style: none; margin: 0; padding: 0; }
.hist-list li { padding: .6rem 0; border-top: 1px solid var(--line, #e6d5d9); }
.hist-list li:first-child { border-top: 0; }
.hist-chg { display: inline-block; margin: .15rem .4rem 0 0; padding: .1rem .5rem; border-radius: 999px; background: var(--maroon-tint, #f6e9ec); font-size: .85rem; }

.del-zone { border-top: 1px solid var(--line, #e6d5d9); padding-top: .75rem; }
.btn-danger-solid { background: #b3261e; border-color: #b3261e; color: #fff; }

/* Help */
.help-media { display: block; width: 100%; max-height: 70vh; border-radius: var(--radius); background: #000; margin-top: .5rem; }
/* Help › Tutorial: questions that open to show the answer */
.help-tabs { margin-bottom: 1rem; }
.faq-section h2 { margin-bottom: .4rem; }
.faq { border-top: 1px solid var(--gold-soft); }
.faq:first-of-type { border-top: 0; }
.faq > summary { display: flex; gap: .5rem; align-items: flex-start; padding: .7rem 0; cursor: pointer; font-weight: 600; color: var(--maroon-deep); list-style: none; }
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::before { content: '+'; flex: none; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--maroon-tint); color: var(--maroon); display: grid; place-items: center; font-weight: 700; line-height: 1; }
.faq[open] > summary::before { content: '−'; background: var(--maroon); color: var(--cream); }
.faq-answer { padding: 0 0 .8rem 1.8rem; }
.faq-answer p, .faq-answer ol, .faq-answer ul { margin: 0 0 .4rem; }
.faq-answer li { margin-bottom: .25rem; }
.help-shot img { display: block; max-width: 100%; max-height: 260px; border-radius: .5rem; border: 1px solid var(--gold-soft); margin-top: .5rem; }
.help-ticket { margin-bottom: .5rem; }
.help-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.help-head small { margin-left: auto; color: var(--ink-soft); }
.help-who { margin-bottom: .5rem; }
.help-msg { padding: .55rem .75rem; border-radius: .6rem; margin: .4rem 0; background: #f6f1ee; }
.help-from-support { background: var(--maroon-tint, #f6e9ec); border-left: 3px solid var(--maroon); }
.help-from-system { background: #eaf4ee; }
.help-by { font-size: .8rem; color: var(--ink-soft); margin-bottom: .2rem; }
.help-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.help-reply { margin-top: .5rem; }
.help-reply-row { display: flex; gap: .5rem; align-items: center; justify-content: space-between; margin-top: .4rem; flex-wrap: wrap; }
.help-attach { margin: 0; cursor: pointer; } .help-attach-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.help-sep { border: 0; border-top: 2px dashed var(--gold-soft); margin: 1rem 0; }
.help-ticket.is-unread .help-head strong { color: var(--maroon); }

.totals-key { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.total-key { background: linear-gradient(135deg, var(--maroon-deep), var(--maroon)); border: 2px solid var(--gold); padding: .8rem 1rem; }
.total-key .total-label { color: var(--gold-soft); font-weight: 600; letter-spacing: .02em; }
.total-key .total-value { font-family: var(--font-head); color: #F4D58A; }
.total-key .total-value { font-size: 1.6rem; }

.total-note { display: block; font-size: .72rem; color: var(--ink-soft); margin-top: .1rem; }

.split-sold { background: #C0727A; }
.split-sponsored { background: #C8982E; }

/* Action, call and WhatsApp buttons stay in view while the wide table scrolls sideways on a computer. */
@media (min-width: 768px) {
  .rtable .sticky-col { position: sticky; left: 0; z-index: 3; background: #fff; box-shadow: 2px 0 0 var(--gold-soft); }
  .rtable thead .sticky-col { z-index: 5; background: var(--t-band, #EDE6FA); }
  .rtable .row-actions { flex-wrap: nowrap; justify-content: flex-start; gap: .35rem; }
}
.icon-wa { background: #E3F4E8; color: #1E7A3C; }

/* Admin screens: menu tabs and figure cards swipe sideways; with Compress on, tables are one row per person that also swipes sideways. */
.compact-toggle { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--maroon-deep); background: var(--maroon-tint); border: 1px solid var(--gold-soft); border-radius: 999px; padding: .3rem .9rem; margin: 0 0 .6rem; width: fit-content; cursor: pointer; }
.compact-toggle input { width: 1.1rem; height: 1.1rem; accent-color: var(--maroon); }

@media (max-width: 767px) {
.admin-screen .chips { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: .15rem; }
.admin-screen .chips::-webkit-scrollbar { display: none; }
.admin-screen .chip { flex: none; white-space: nowrap; scroll-snap-align: start; }
}

.page.compact .page-title, .page.compact h1 { font-size: 1.15rem; margin: 0 0 .4rem; }
.page.compact .field-hint, .page.compact .page-inner > p, .page.compact .total-note, .page.compact .target-bar { display: none; }
.page.compact .card-app { padding: .6rem .8rem; margin-bottom: .55rem; }

/* Figure cards in one row that swipes sideways */
@media (max-width: 767px) {
.page.compact .totals { display: flex; gap: .5rem; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; padding: 0 0 .4rem; margin-bottom: .5rem; scrollbar-width: thin; }
.page.compact .total { flex: 0 0 auto; min-width: 7rem; padding: .4rem .75rem; scroll-snap-align: start; }
.page.compact .total-label { font-size: .72rem; white-space: nowrap; }
.page.compact .total-value { font-size: 1.05rem; white-space: nowrap; }
}

/* Search above every table */
.compact-search { display: none; margin: 0 0 .5rem; }
.page.compact .compact-search { display: block; }
.compact-search input { width: 100%; padding: .45rem .8rem; border: 1px solid var(--gold-soft); border-radius: 999px; background: #fff; font-size: .9rem; }

/* Tables: a header row and one tidy row per entry; swipe sideways for the rest, the first column stays in view */
.page.compact .rtable-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid var(--t-line, #CDBEF0); border-radius: 14px; box-shadow: 0 3px 10px rgba(84, 19, 32, .07); max-height: none; }
.page.compact .rtable { display: table; width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.page.compact .rtable thead { display: table-header-group; }
.page.compact .rtable tbody { display: table-row-group; }
.page.compact .rtable-wrap .rtable tr { display: table-row; background: none; border: 0; border-radius: 0; padding: 0; }
.page.compact .rtable th { padding: .4rem .7rem; font-size: .72rem; white-space: nowrap; background: var(--t-band, #EDE6FA); color: var(--t-ink, #4A2F86); border-bottom: 2px solid var(--t-line, #CDBEF0); text-align: left; }
.page.compact .rtable td { display: table-cell; padding: .4rem .7rem; font-size: .82rem; white-space: nowrap; text-align: left; border-top: 1px solid #EFEAE0; vertical-align: middle; overflow-wrap: normal; background: #fff; }
.page.compact .rtable td::before { content: none; }
.page.compact .rtable td.num, .page.compact .rtable th.num { text-align: right; }
.page.compact .rtable tbody tr:nth-child(even) td { background: var(--t-alt, #F8F5FE); }
.page.compact .rtable th:first-child, .page.compact .rtable td:first-child { position: sticky; left: 0; z-index: 1; box-shadow: 2px 0 4px rgba(84, 19, 32, .07); }
.page.compact .rtable th:first-child { z-index: 3; background: var(--t-band, #EDE6FA); }
.page.compact .rtable td.cell-wrap { white-space: normal; min-width: 12rem; }
.page.compact .rtable .cell-sub { display: none; }
.page.compact .row-actions { display: inline-flex; gap: .2rem; }
.page.compact .btn-app, .page.compact .btn-ghost { padding: .1rem .6rem; min-height: 0; font-size: .8rem; }

.proxy-banner { background: var(--maroon-tint, #f6e9ea); border: 1px solid var(--maroon, #7b1e2b); border-radius: 8px; padding: .5rem .75rem; margin-bottom: .75rem; font-size: .9rem; }
.proxy-row { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; }
.proxy-row > span { flex: 1; }

.fm-strip { display: flex; align-items: center; gap: .5rem; }
.fm-chips { flex: 1; min-width: 0; display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: .1rem 0; }
.fm-chips::-webkit-scrollbar { display: none; }
.fm-chip { flex: none; white-space: nowrap; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 999px; padding: .3rem .8rem; color: var(--maroon-deep); font-weight: 600; font-size: .9rem; }
.fm-chip.active { background: var(--maroon); border-color: var(--maroon); color: var(--cream); }
.fm-chip small { font-weight: 400; opacity: .8; }
.fm-plus { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 0; background: var(--maroon); color: var(--cream); font-size: 1.5rem; line-height: 1; }
.fm-panel { margin-top: .6rem; padding: .6rem; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; }
.fm-panel .link-row { flex-wrap: wrap; }

.lang-pick { margin-left: auto; min-height: 36px; border: 1px solid var(--gold-soft); border-radius: 999px; background: var(--cream, #fff); color: var(--maroon-deep); font-weight: 600; font-size: .8rem; padding: 0 .5rem; max-width: 7rem; }
.lang-pick + .switch-role { margin-left: 0; }
.nav-rail-user .lang-pick { display: block; width: 100%; max-width: none; margin: .6rem 0 0; }

.lang-toggle { display: inline-flex; align-items: center; gap: .4rem; margin-left: auto; cursor: pointer; font-weight: 700; font-size: .8rem; color: var(--cream, #fff); }
.lang-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.lang-toggle i { position: relative; width: 2.4rem; height: 1.4rem; border-radius: 999px; background: #b9a9a0; transition: background .15s; flex: none; }
.lang-toggle i::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; transition: transform .15s; }
.lang-toggle input:checked + i { background: var(--gold, #C8982E); }
.lang-toggle input:checked + i::after { transform: translateX(1rem); }
.lang-toggle input:focus-visible + i { outline: 2px solid var(--gold, #C8982E); outline-offset: 2px; }
.lang-toggle + .switch-role { margin-left: .5rem; }
.nav-rail-user .lang-toggle { display: flex; margin: .6rem 0 0; color: var(--maroon-deep); }
.lang-toggle-big { color: var(--maroon-deep); margin: 0 0 .4rem; font-size: 1rem; }

/* English on the left (yellow), Hindi on the right (pink) */
.lang-toggle i { background: #E8B923; }
.lang-toggle input:checked + i { background: #E7739A; }
.lang-toggle input:checked + i::after { transform: translateX(1rem); }
.lang-toggle span { opacity: .7; }
.lang-toggle:has(input:not(:checked)) span:first-child, .lang-toggle:has(input:checked) span:last-child { opacity: 1; }

/* My Records and Statistics: the figure blocks swipe sideways on a phone; on larger screens they stay a grid */
@media (max-width: 767px) {
.page[data-view="records"] .totals, .page[data-view="stats"] .totals, .page[data-view="teamstats"] .totals {
  display: flex; gap: .5rem; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; padding-bottom: .4rem; scrollbar-width: thin; }
.page[data-view="records"] .total, .page[data-view="stats"] .total, .page[data-view="teamstats"] .total {
  flex: 0 0 auto; min-width: 8.5rem; scroll-snap-align: start; }
.page[data-view="records"] .total-label, .page[data-view="stats"] .total-label, .page[data-view="teamstats"] .total-label { white-space: nowrap; }
}

/* Desktop: in the title bar the language toggle comes right after the profile circle, at the far right */
@media (min-width: 992px) {
  .topbar .topbar-avatar { order: 1; margin-left: auto; }
  .topbar .lang-toggle { order: 2; margin-left: .9rem; }
}

/* The page itself never scrolls sideways on a phone or tablet: long pills wrap, wide controls shrink, and only the
   menu tabs, figure cards and table frames (each in its own box) swipe. */
@media (max-width: 991.98px) {
  html, body { max-width: 100%; overflow-x: clip; }
  .page, .page-inner, main, .card-app, .field, .props-grid > * { min-width: 0; max-width: 100%; }
  .pill-call, .pill-wa, .pill-pay, .pill-book, .pill-date, .pill-time { white-space: normal; max-width: 100%; }
  input, select, textarea, .form-control { max-width: 100%; min-width: 0; }
  input[type="datetime-local"], input[type="date"], input[type="time"] { width: 100%; min-width: 0; }
  .rtable td, .record-card { overflow-wrap: anywhere; }
  img, video, canvas, svg { max-width: 100%; }
}

/* Phone: the title is the first line; English/Hindi, the switch button and the profile circle share the second line */
@media (max-width: 767px) {
  .topbar { flex-wrap: wrap; row-gap: .45rem; }
  .topbar .brand-title { flex: 0 0 100%; }
  .topbar .brand-line1, .topbar .brand-line2 { display: inline; font-size: inherit; opacity: 1; }
  .topbar .brand-line2::before { content: ' '; }
  .topbar .lang-toggle { margin-left: 0; }
}

/* Phone: the title is centred; BOOK DISTRIBUTION in shiny orange */
@media (max-width: 767px) {
  .topbar .brand-title { text-align: center; }
  .topbar .brand-line2 {
    text-transform: uppercase; font-weight: 800; letter-spacing: .06em;
    background: linear-gradient(180deg, #FFC15A 0%, #FF9A1F 45%, #FF7A00 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #FF9A1F;
    text-shadow: 0 0 10px rgba(255, 154, 31, .35);
  }
}

/* Phone: the whole title in one yellow (replaces the orange of BOOK DISTRIBUTION) */
@media (max-width: 767px) {
  .topbar .brand-title, .topbar .brand-line1, .topbar .brand-line2 { color: #FFD43B; }
  .topbar .brand-line2 { background: none; -webkit-background-clip: border-box; background-clip: border-box; -webkit-text-fill-color: currentColor; text-shadow: none; }
}

/* Notifications: the bell beside the profile circle, and the list */
.notif-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; margin-left: auto; color: var(--cream); text-decoration: none; }
.switch-role ~ .notif-bell { margin-left: .5rem; }
.notif-bell + .topbar-avatar { margin-left: .4rem; }
.notif-count { position: absolute; top: 0; right: -.1rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem; border-radius: 999px; background: #D32F2F; color: #fff; font-size: .65rem; font-weight: 700; line-height: 1.05rem; text-align: center; }
@media (min-width: 992px) {
  .topbar .notif-bell { order: 1; margin-left: auto; }
  .topbar .topbar-avatar { order: 2; margin-left: .5rem; }
  .topbar .lang-toggle { order: 3; }
}
.nt-actions { text-align: right; margin-bottom: .5rem; }
.nt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.nt-item { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem .9rem; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; cursor: pointer; }
.nt-item.unread { background: #FFF1CC; border-color: #F0D98C; }
.nt-item small { color: var(--ink-soft); }
.nt-icon { flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--maroon-tint); color: var(--maroon); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

/* All Records: show All / Pending / Successful */
.radio-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .75rem; }
.radio-pill { cursor: pointer; }
.radio-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-pill span { display: inline-block; padding: .35rem 1rem; border-radius: 999px; border: 1px solid var(--gold-soft); background: var(--ivory); color: var(--maroon-deep); font-weight: 600; }
.radio-pill input:checked + span { background: var(--maroon); color: var(--cream); border-color: var(--maroon); }
.radio-pill input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Phone: choice buttons (Cash / UPI / Manual and the other groups) are separate tabs with a clear border and a line below */
@media (max-width: 767px) {
  .seg { background: none; padding: 0; gap: .4rem; border-bottom: 3px solid var(--maroon); border-radius: 0; align-items: flex-end; }
  .seg label {
    flex: 1 1 0; min-width: 0; min-height: 44px; padding: .3rem .35rem; text-align: center; line-height: 1.15; font-size: .9rem;
    background: var(--ivory); border: 1.5px solid var(--maroon); border-bottom: 0; border-radius: 10px 10px 0 0;
  }
  .seg label span { display: block; overflow-wrap: anywhere; }
  .seg label:has(input:checked) { background: var(--maroon); }

  /* header: a little tighter so the bell and the profile circle stay on the second line */
  .topbar { column-gap: .4rem; }
  .topbar .lang-toggle { font-size: .72rem; gap: .3rem; }
  .topbar .switch-role { font-size: .72rem; padding: 0 .65rem; min-height: 32px; }
  .topbar .notif-bell { width: 1.9rem; }
}

/* Alerts & Issues */
.issue-block { margin: 0 0 1.5rem; }
.issue-block > h2 { margin-bottom: .6rem; }
.log-switch { margin: 0 0 .25rem; font-weight: 600; }
details > pre.log-detail { white-space: pre-wrap; max-height: 12rem; overflow: auto; font-size: .75rem; margin: .3rem 0 0; }

/* Alerts & Issues: requests and errors open in their own tabs */
.issue-tabs { display: flex; gap: .3rem; border-bottom: 3px solid var(--maroon); margin: 0 0 1rem; overflow-x: auto; scrollbar-width: thin; }
.issue-tab { display: inline-flex; align-items: stretch; flex: none; background: var(--ivory); border: 1.5px solid var(--maroon); border-bottom: 0; border-radius: 10px 10px 0 0; }
.issue-tab button { background: none; border: 0; padding: .45rem .8rem; font-weight: 600; color: var(--maroon); white-space: nowrap; cursor: pointer; }
.issue-tab .issue-x { padding: .45rem .55rem .45rem .1rem; font-size: 1.1rem; line-height: 1; opacity: .75; }
.issue-tab.active { background: var(--maroon); }
.issue-tab.active button { color: var(--cream); }
.link-btn { background: none; border: 0; padding: 0; color: var(--maroon); font: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(122, 31, 43, .35); }
.link-btn:hover { text-decoration-color: currentColor; }
.issue-detail pre.log-detail { white-space: pre-wrap; max-height: 20rem; overflow: auto; font-size: .78rem; }

/* Sign-ups: grouping switch */
.group-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .25rem 0 .75rem; }
.group-bar .check-row { margin: 0; }

/* All Records: transaction number column (fixed beside the date) and purge mode */
.tx-wrap { --tx-w: 4rem; }
.tx-wrap.tx-purge { --tx-w: 6rem; }
.rtable th.tx-col, .rtable td.tx-cell { width: var(--tx-w); min-width: var(--tx-w); max-width: var(--tx-w); box-sizing: border-box; padding-left: .45rem; padding-right: .45rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rtable td.tx-cell { font-weight: 600; color: var(--ink-soft, #555); }
.tx-pick { display: inline-flex; align-items: center; gap: .35rem; margin: 0; cursor: pointer; }
.tx-pick input { width: 1.1rem; height: 1.1rem; }
.page.compact .tx-wrap .rtable th:nth-child(2), .page.compact .tx-wrap .rtable td:nth-child(2) { position: sticky; left: var(--tx-w); z-index: 1; box-shadow: 2px 0 4px rgba(84, 19, 32, .07); }
.page.compact .tx-wrap .rtable th:nth-child(2) { z-index: 3; background: var(--t-band, #EDE6FA); }
.purge-bar { margin: .25rem 0 .6rem; }
.purge-on { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem .8rem; border: 1px solid #EDB8B2; background: #FCEDEA; border-radius: 10px; }
.purge-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-left: auto; }
.purged-box { margin-top: 2rem; }

/* Payment never started (the QR was shown, nobody paid or even began) */
.st-not_attempted { background: #EEF0F3; color: #4B5563; border-color: #D5D9E0; }
.st-manual { background: #E6F0FA; color: #1F4E79; border-color: #C3D9EF; }
.rtable-wrap.rtable-fancy .rtable tbody tr.row-st-manual, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-manual:nth-child(even) { background: #EEF5FC; }
.rtable-wrap.rtable-fancy .rtable tbody tr.row-st-not_attempted, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-not_attempted:nth-child(even) { background: #F3F4F6; }
@media (min-width: 992px) {
  .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-not_attempted td, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-not_attempted:nth-child(even) td { background: #F3F4F6; }
  .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-manual td, .rtable-wrap.rtable-fancy .rtable tbody tr.row-st-manual:nth-child(even) td { background: #EEF5FC; }
}

/* All Records: the transaction number and the date stay in view while the table scrolls sideways */
.tx-wrap { --tx-w: 5.2rem; }
.tx-wrap.tx-purge { --tx-w: 7.4rem; }
@media (min-width: 768px) {
  .tx-wrap .rtable th:nth-child(1), .tx-wrap .rtable td:nth-child(1),
  .tx-wrap .rtable th:nth-child(2), .tx-wrap .rtable td:nth-child(2) { position: sticky; z-index: 1; background: inherit; }
  .tx-wrap .rtable th:nth-child(1), .tx-wrap .rtable td:nth-child(1) { left: 0; }
  .tx-wrap .rtable th:nth-child(2), .tx-wrap .rtable td:nth-child(2) { left: var(--tx-w); box-shadow: 2px 0 4px rgba(84, 19, 32, .08); }
  .tx-wrap .rtable thead th:nth-child(1), .tx-wrap .rtable thead th:nth-child(2) { z-index: 5; background: var(--t-band, #EDE6FA); }
}

/* ---- Special Meeting screen ---- */
.meeting-open { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .25rem 0 1rem; }
body.mt-open { overflow: hidden; }
.mt-stage { position: fixed; inset: 0; z-index: 3000; overflow-y: auto; overflow-x: hidden; color: #F6E7C0;
  background: radial-gradient(ellipse at 50% -10%, #8a2433 0%, #561421 42%, #260912 100%); font-family: var(--font-head, Georgia, serif); }
.mt-stage::before { content: ''; position: fixed; inset: 10px; border: 1px solid rgba(217, 164, 65, .55); border-radius: 6px; pointer-events: none; z-index: 2; }
.mt-stage::after { content: ''; position: fixed; inset: 16px; border: 1px solid rgba(217, 164, 65, .25); border-radius: 4px; pointer-events: none; z-index: 2; }
.mt-pillar { position: fixed; top: 0; bottom: 0; width: clamp(46px, 7vw, 92px); display: flex; flex-direction: column; z-index: 1; }
.mt-left { left: clamp(18px, 3vw, 44px); } .mt-right { right: clamp(18px, 3vw, 44px); }
.mt-cap { width: 100%; height: auto; flex: none; margin-top: 18px; }
.mt-shaft { flex: 1; width: 64%; margin: 0 auto; border-left: 1px solid #D9A441; border-right: 1px solid #D9A441;
  background: linear-gradient(90deg, rgba(0, 0, 0, .4), rgba(255, 235, 170, .14) 32%, rgba(0, 0, 0, .3)), repeating-linear-gradient(90deg, rgba(217, 164, 65, .85) 0 1.5px, transparent 1.5px 9px); }
.mt-base { flex: none; margin-bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.mt-base i { display: block; height: 8px; border: 1px solid #D9A441; border-radius: 2px; background: rgba(217, 164, 65, .18); }
.mt-base i:nth-child(1) { width: 72%; } .mt-base i:nth-child(2) { width: 86%; } .mt-base i:nth-child(3) { width: 100%; height: 11px; }
.mt-tools { position: fixed; top: 24px; right: clamp(80px, 11vw, 150px); z-index: 6; display: flex; gap: .5rem; }
.mt-tool { background: rgba(36, 8, 18, .75); color: #F6DE9A; border: 1px solid #D9A441; border-radius: 999px; padding: .35rem .9rem; font: 600 .85rem/1.2 var(--font-body, sans-serif); cursor: pointer; }
.mt-tool:hover { background: #D9A441; color: #3b0d16; }
.mt-main { position: relative; z-index: 3; max-width: 1180px; margin: 0 auto; padding: 1.5rem clamp(74px, 12vw, 160px) 3rem; text-align: center; }
.mt-dome { width: min(560px, 78%); margin: 1.5rem auto 0; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .45)); }
.mt-dome-svg { display: block; width: 100%; height: auto; }
.mt-title { margin: .2rem 0 0; font-size: clamp(2rem, 5.2vw, 3.8rem); letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  background: linear-gradient(180deg, #FFF0BD, #D9A441 60%, #A9741F); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mt-sub { margin: .3rem 0 1.6rem; color: #E9CF93; letter-spacing: .06em; font-family: var(--font-body, sans-serif); font-size: clamp(.8rem, 1.6vw, 1.05rem); }
.mt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: clamp(.8rem, 2vw, 1.6rem); }
.mt-card { position: relative; padding: 1rem 1rem 1.2rem; border: 2px solid #D9A441; border-radius: 18px; background: linear-gradient(180deg, #6a1727, #3a0c17);
  box-shadow: 0 0 0 4px rgba(217, 164, 65, .15), 0 14px 34px rgba(0, 0, 0, .45), inset 0 0 28px rgba(217, 164, 65, .12); }
.mt-card::before, .mt-card::after { content: ''; position: absolute; width: 22px; height: 22px; border: 2px solid #F6DE9A; opacity: .8; }
.mt-card::before { top: 7px; left: 7px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.mt-card::after { bottom: 7px; right: 7px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.mt-label { text-transform: uppercase; letter-spacing: .12em; color: #F2D88F; font: 600 clamp(.75rem, 1.4vw, 1rem)/1.3 var(--font-body, sans-serif); margin-bottom: .6rem; }
.mt-flip { position: relative; height: clamp(5.4rem, 14vw, 9.6rem); perspective: 900px; }
.mt-face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: linear-gradient(180deg, #2d0a14 0 50%, #240810 50% 100%); font-size: clamp(3.2rem, 9vw, 7.4rem); font-weight: 700; font-variant-numeric: tabular-nums;
  color: #F6DE9A; text-shadow: 0 0 22px rgba(246, 222, 154, .35); transition: transform .5s ease; transform-origin: 50% 50%; box-shadow: inset 0 0 0 1px rgba(217, 164, 65, .35); }
.mt-face::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: rgba(0, 0, 0, .55); }
.mt-front { transform: rotateX(0deg); } .mt-back { transform: rotateX(180deg); }
.mt-card.flipping .mt-front { transform: rotateX(-180deg); } .mt-card.flipping .mt-back { transform: rotateX(0deg); }
.mt-card.no-anim .mt-face { transition: none; }
.mt-just { max-width: 760px; margin: 2rem auto 0; text-align: left; }
.mt-just h2 { font-size: 1rem; letter-spacing: .16em; text-transform: uppercase; color: #E9CF93; border-bottom: 1px solid rgba(217, 164, 65, .5); padding-bottom: .4rem; margin: 0 0 .3rem; }
.mt-just ul { list-style: none; margin: 0; padding: 0; }
.mt-just li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .2rem; border-bottom: 1px solid rgba(217, 164, 65, .18); font-family: var(--font-body, sans-serif); font-size: clamp(.95rem, 1.8vw, 1.2rem); }
.mt-just li strong { color: #FFF0BD; } .mt-just li span { color: #E9CF93; text-align: right; }
.mt-just li:first-child:not(.mt-wait) { animation: mt-glow 1.6s ease-out 1; }
.mt-just .mt-wait { color: #B9A06A; justify-content: center; }
@keyframes mt-glow { from { background: rgba(246, 222, 154, .35); } to { background: transparent; } }
.mt-banner-host { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 5; }
.mt-banner { animation: mt-pop .38s cubic-bezier(.2, 1.4, .4, 1) both; max-width: 94vw; }
.mt-banner.out { animation: mt-out .3s ease-in both; }
.mt-ribbon { display: flex; align-items: center; gap: clamp(.6rem, 2vw, 1.6rem); padding: clamp(.8rem, 2vw, 1.5rem) clamp(1.2rem, 4vw, 3rem); border-radius: 16px; border: 4px solid #7A1F2B;
  background: linear-gradient(90deg, #B5701F, #F6DE9A 18%, #FFF0BD 50%, #F6DE9A 82%, #B5701F); color: #3b0d16; box-shadow: 0 0 0 3px #D9A441, 0 24px 60px rgba(0, 0, 0, .6); }
.mt-who { font-weight: 800; font-size: clamp(1.8rem, 6vw, 4.4rem); line-height: 1.1; }
.mt-what { font: 700 clamp(1.1rem, 3vw, 2.3rem)/1.2 var(--font-body, sans-serif); margin-top: .2rem; }
.mt-claps { font-size: clamp(2.2rem, 6vw, 4.6rem); animation: mt-clap .45s ease-in-out infinite alternate; }
@keyframes mt-clap { from { transform: rotate(-14deg) scale(.95); } to { transform: rotate(12deg) scale(1.1); } }
@keyframes mt-pop { from { opacity: 0; transform: scale(.5) translateY(30px); } to { opacity: 1; transform: none; } }
@keyframes mt-out { to { opacity: 0; transform: scale(1.12) translateY(-24px); } }
.mt-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
@media (max-width: 640px) {
  .mt-pillar { display: none; }
  .mt-main { padding-left: 16px; padding-right: 16px; }
  .mt-tools { right: 18px; top: 18px; }
}
@media (prefers-reduced-motion: reduce) { .mt-face, .mt-banner, .mt-claps { transition: none; animation: none; } }

/* Special Meeting: smaller dome, two boxes on top, the books box wide underneath */
.mt-dome { width: min(250px, 42%); margin-top: .4rem; }
.mt-title { font-size: clamp(1.8rem, 4.4vw, 3.2rem); }
.mt-sub { margin: .2rem 0 1rem; }
.mt-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mt-cards .mt-flip { height: clamp(4.4rem, 11vh, 7rem); }
.mt-cards .mt-face { font-size: clamp(2.6rem, 6.4vw, 5.2rem); }
.mt-books { margin-top: clamp(.8rem, 2vw, 1.6rem); }
.mt-wide .mt-flip { height: clamp(6rem, 21vh, 12rem); }
.mt-wide .mt-face { font-size: clamp(3.6rem, 12vw, 9.6rem); letter-spacing: .02em; }
.mt-face { white-space: nowrap; overflow: hidden; }
.mt-just { margin-top: 1.4rem; }
.mt-rehearsal { position: fixed; top: 26px; left: clamp(80px, 11vw, 150px); z-index: 6; background: #F6DE9A; color: #3b0d16; border-radius: 999px; padding: .3rem .9rem; font: 700 .8rem/1.2 var(--font-body, sans-serif); letter-spacing: .04em; }
@media (max-width: 560px) { .mt-cards { grid-template-columns: 1fr; } }

.mt-banner-host { align-items: flex-end; padding-bottom: clamp(1rem, 5vh, 3.5rem); }

/* Special Meeting, final layout: a vine border instead of pillars and dome; two round counters either side of the books */
.mt-stage::after { display: none; }
.mt-stage::before { inset: 8px; border-color: rgba(217, 164, 65, .45); }
.mt-vine { position: fixed; z-index: 1; pointer-events: none; background-repeat: repeat; opacity: .95; }
.mt-vine-top, .mt-vine-bottom { left: 40px; right: 40px; height: 44px; background-image: var(--vine-h); background-repeat: repeat-x; background-position: center; }
.mt-vine-top { top: 12px; } .mt-vine-bottom { bottom: 12px; transform: scaleY(-1); }
.mt-vine-left, .mt-vine-right { top: 40px; bottom: 40px; width: 44px; background-image: var(--vine-v); background-repeat: repeat-y; background-position: center; }
.mt-vine-left { left: 12px; } .mt-vine-right { right: 12px; transform: scaleX(-1); }
.mt-corner { position: fixed; z-index: 1; width: 64px; height: 64px; background-image: var(--vine-corner); background-size: contain; pointer-events: none; }
.mt-c1 { top: 4px; left: 4px; } .mt-c2 { top: 4px; right: 4px; } .mt-c3 { bottom: 4px; left: 4px; } .mt-c4 { bottom: 4px; right: 4px; }
.mt-tools { top: 64px; right: 64px; }
.mt-rehearsal { top: 66px; left: 64px; }
.mt-main { max-width: 1320px; padding: 1.2rem 72px 2.4rem; }
.mt-org { margin-top: .4rem; font: 600 clamp(.9rem, 1.8vw, 1.3rem)/1.2 var(--font-body, sans-serif); letter-spacing: .5em; text-transform: uppercase; color: #F2D88F; text-indent: .5em; }
.mt-title { margin: .25rem auto 0; max-width: 18em; font-size: clamp(1.7rem, 4.1vw, 3.4rem); letter-spacing: .05em; line-height: 1.12; }
.mt-sub { margin: .4rem 0 1rem; }
.mt-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr) minmax(0, 1fr); gap: clamp(.8rem, 2.4vw, 2rem); align-items: center; }
.mt-orbbox { display: flex; flex-direction: column; align-items: center; gap: .7rem; }
.mt-orb { width: min(100%, 250px); aspect-ratio: 1; border-radius: 50%; padding: 11%; display: block;
  background: radial-gradient(circle at 50% 35%, #7a1c2c, #3a0c17); }
.mt-orb::before, .mt-orb::after { display: none; }
.mt-orb .mt-flip { height: 100%; }
.mt-orb .mt-face { border-radius: 50%; font-size: clamp(2.2rem, 5.2vw, 4.6rem); background: linear-gradient(180deg, #2d0a14 0 50%, #240810 50% 100%); }
.mt-orbbox .mt-label { margin: 0; text-align: center; }
.mt-wide .mt-flip { height: clamp(7rem, 24vh, 13rem); }
.mt-wide .mt-face { font-size: clamp(3.6rem, 10vw, 9.6rem); }
.mt-banner-host { position: static; inset: auto; display: flex; align-items: center; justify-content: center; min-height: clamp(150px, 23vh, 230px); pointer-events: none; margin-top: .6rem; }
.mt-who { font-size: clamp(1.7rem, 4.6vw, 3.6rem); } .mt-what { font-size: clamp(1.1rem, 2.5vw, 1.9rem); }
.mt-claps { font-size: clamp(2rem, 4.6vw, 3.6rem); }
.mt-just { margin-top: .6rem; }
@media (max-width: 900px) {
  .mt-row { grid-template-columns: 1fr 1fr; }
  .mt-wide { grid-column: 1 / -1; grid-row: 1; }
  .mt-main { padding-left: 62px; padding-right: 62px; }
}
@media (max-width: 560px) { .mt-main { padding-left: 54px; padding-right: 54px; } .mt-tools { right: 54px; flex-wrap: wrap; } .mt-vine-top, .mt-vine-bottom, .mt-vine-left, .mt-vine-right, .mt-corner { opacity: .8; } }
.mt-banner-host { padding-bottom: 0; }
.mt-main { padding-top: 6.2rem; padding-bottom: 4.8rem; }
.mt-tools { top: 62px; right: 66px; } .mt-rehearsal { top: 64px; left: 66px; }
.mt-tool { opacity: .75; } .mt-tool:hover { opacity: 1; }
.mt-org { margin-top: 0; }
.mt-title { font-size: clamp(1.6rem, 3.6vw, 3rem); }
.mt-sub { margin: .3rem 0 .8rem; }
.mt-orb { width: min(100%, 215px); }
.mt-wide .mt-flip { height: clamp(6rem, 19vh, 11rem); }
.mt-banner-host { min-height: clamp(130px, 19vh, 190px); }

/* Diwali lights (Special Meeting border) */
.dl { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.dl-wire { position: absolute; inset: 21px; border: 1.5px solid rgba(255, 226, 150, .35); border-radius: 8px; }
.dl-pt { position: absolute; width: 0; height: 0; }
.dl-bulb { position: absolute; left: -6px; top: 0; width: 12px; height: 17px; border-radius: 50% 50% 46% 46% / 40% 40% 60% 60%;
  background: radial-gradient(circle at 38% 32%, #fff 0 10%, var(--c, #fff) 38%, rgba(0, 0, 0, .35) 120%); opacity: .22; transition: opacity .16s, box-shadow .16s; }
.dl-bulb::before { content: ''; position: absolute; left: 2px; top: -4px; width: 8px; height: 5px; background: #8a6a2a; border-radius: 2px 2px 0 0; }
.dl-bulb.lit { opacity: 1; box-shadow: 0 0 9px 3px var(--c), 0 0 22px 6px color-mix(in srgb, var(--c) 45%, transparent); }

/* The Special Meeting panel on the Targets page */
.mt-launch { margin: .5rem 0 1.4rem; padding: 1.2rem 1.2rem 1.4rem; border: 2px solid var(--gold-soft, #EAD9AE); border-radius: 20px; text-align: center;
  background: radial-gradient(ellipse at 50% 0, #fff7e6, #fbefd6); }
.mt-launch h2 { margin: 0 0 .2rem; font-size: 1.35rem; }
.mt-launch-grid { display: grid; gap: .9rem 1.4rem; max-width: 820px; margin: .8rem auto 0; align-items: center; justify-items: center;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: '. top .' 'left go right'; }
.mt-opt-top { grid-area: top; } .mt-opt-left { grid-area: left; } .mt-opt-right { grid-area: right; } .mt-go { grid-area: go; }
.mt-opt { display: block; width: 100%; max-width: 250px; cursor: pointer; margin: 0; }
.mt-opt input { position: absolute; opacity: 0; pointer-events: none; }
.mt-opt-body { display: flex; flex-direction: column; gap: .3rem; padding: .7rem .8rem; border: 2px solid var(--gold-soft, #EAD9AE); border-radius: 14px; background: #fff; text-align: center; height: 100%; }
.mt-opt-body strong { color: var(--maroon-deep, #541320); }
.mt-opt-body small { color: var(--ink-soft, #6b5a50); font-size: .76rem; line-height: 1.3; }
.mt-opt:hover .mt-opt-body { border-color: var(--gold, #C8982E); }
.mt-opt input:checked + .mt-opt-body { border-color: var(--maroon, #7A1F2B); box-shadow: 0 0 0 3px rgba(122, 31, 43, .18); }
.mt-opt input:focus-visible + .mt-opt-body { outline: 3px solid #D9A441; outline-offset: 2px; }
.mt-opt-strip { display: block; height: 44px; border-radius: 8px; background: #4a0f1b; background-repeat: repeat-x; background-position: left center; overflow: hidden; }
.mt-opt-lights { display: flex; align-items: center; justify-content: space-around; padding: 0 .3rem; }
.mt-opt-lights i { width: 10px; height: 14px; border-radius: 50%; background: #ff3b3b; box-shadow: 0 0 8px 2px currentColor; color: #ff3b3b; animation: mt-blink 1.4s infinite; }
.mt-opt-lights i:nth-child(4n+2) { background: #ffe14d; color: #ffe14d; animation-delay: .35s; }
.mt-opt-lights i:nth-child(4n+3) { background: #3ddc84; color: #3ddc84; animation-delay: .7s; }
.mt-opt-lights i:nth-child(4n) { background: #2ec5ff; color: #2ec5ff; animation-delay: 1.05s; }
@keyframes mt-blink { 0%, 55% { opacity: 1; } 70%, 100% { opacity: .2; } }
.mt-go { width: clamp(150px, 22vw, 190px); aspect-ratio: 1; border-radius: 50%; border: 4px solid #F6DE9A; cursor: pointer; color: #FFF0BD;
  background: radial-gradient(circle at 50% 30%, #9a2b3c, #541320); box-shadow: 0 0 0 3px #C8982E, 0 10px 26px rgba(84, 19, 32, .4); font: 700 1.1rem/1.25 var(--font-head, Georgia, serif); }
.mt-go:hover { filter: brightness(1.12); transform: translateY(-1px); }
.mt-go:focus-visible { outline: 3px solid #D9A441; outline-offset: 4px; }
@media (max-width: 700px) {
  .mt-launch-grid { grid-template-columns: 1fr; grid-template-areas: 'top' 'left' 'right' 'go'; }
  .mt-opt { max-width: 340px; }
}

/* Diwali lights, final: small glowing dots that swell and shrink, no wire */
.dl-wire { display: none; }
.dl-bulb { left: -2.5px; top: -2.5px; width: 5px; height: 5px; border-radius: 50%; opacity: .12; transition: opacity .2s;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--c, #888) 55%, #fff) 0, var(--c, #888) 55%, color-mix(in srgb, var(--c, #888) 60%, #000) 100%); box-shadow: none; }
.dl-bulb::before { display: none; }
.dl-bulb.lit { opacity: 1; box-shadow: 0 0 5px 1px var(--c), 0 0 12px 3px color-mix(in srgb, var(--c) 40%, transparent); animation: dl-pulse 1.6s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes dl-pulse { 0%, 100% { transform: scale(.8); } 50% { transform: scale(1.75); } }
.mt-opt-lights i { width: 5px; height: 5px; box-shadow: 0 0 5px 1px currentColor; animation: dl-pulse 1.6s ease-in-out infinite; }
.mt-opt-lights i:nth-child(4n+2) { animation-delay: .4s; } .mt-opt-lights i:nth-child(4n+3) { animation-delay: .8s; } .mt-opt-lights i:nth-child(4n) { animation-delay: 1.2s; }
.mt-opt-lights i { background: #e11d2e; color: #e11d2e; }
.mt-opt-lights i:nth-child(4n+2) { background: #f2c200; color: #f2c200; } .mt-opt-lights i:nth-child(4n+3) { background: #16a34a; color: #16a34a; } .mt-opt-lights i:nth-child(4n) { background: #0b8fd8; color: #0b8fd8; }

/* Diwali lights: all lit, all the same size, only the colours move */
.dl-bulb.lit { animation: none; transform: scale(1.15); }
.mt-opt-lights i { animation: none; }

/* Diwali lights: never any size change or twinkle */
.dl-bulb, .dl-bulb.lit { animation: none !important; transform: none !important; width: 6px; height: 6px; left: -3px; top: -3px; opacity: 1; transition: none; }

/* Special Meeting: the count-in */
.mt-count { position: fixed; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; pointer-events: none; background: rgba(36, 8, 18, .55); }
.mt-count span { display: block; font-family: var(--font-head, Georgia, serif); font-weight: 700; color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(180deg, #FFF0BD, #D9A441 60%, #A9741F); animation: mt-count-pop .9s cubic-bezier(.2, 1.3, .4, 1) both; text-shadow: 0 0 40px rgba(246, 222, 154, .35); }
.mt-ready { font-size: clamp(3.5rem, 12vw, 9rem); letter-spacing: .08em; text-transform: uppercase; }
.mt-num { font-size: clamp(7rem, 30vw, 20rem); line-height: 1; }
@keyframes mt-count-pop { from { opacity: 0; transform: scale(.4); } 25% { opacity: 1; transform: scale(1.08); } to { opacity: .0; transform: scale(1.5); } }

.mt-tools { right: 96px; } .mt-rehearsal { left: 96px; }

/* ---- Live: feed, map, areas, playback ---- */
.lv-totals { margin: .5rem 0 .75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.lv-row { display: flex; gap: .6rem; justify-content: space-between; align-items: flex-start; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 12px; padding: .55rem .75rem; }
.lv-row.lv-new { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 152, 46, .25); animation: lv-in .6s ease-out; }
@keyframes lv-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.lv-main { min-width: 0; }
.lv-who { color: var(--maroon-deep); }
.lv-books { font-size: .8rem; color: var(--ink-soft); }
.lv-items { font-size: .85rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.lv-where { color: var(--maroon); font-weight: 600; font-size: .9rem; }
.lv-zone, .lv-gl { color: var(--ink-soft); font-weight: 400; font-size: .8rem; }
.lv-time { font-size: .75rem; color: var(--ink-soft); white-space: nowrap; }
.lv-note { margin-top: .5rem; }
.lv-map { height: 52vh; min-height: 300px; }
.lv-sheet { background: #fff; border: 1px solid var(--gold-soft); border-radius: 12px; padding: .5rem .75rem; margin-top: .6rem; }
.lv-sheet-title { font: 700 .8rem var(--font-body); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.lv-recent-row, .lv-area { display: flex; justify-content: space-between; gap: .6rem; padding: .3rem 0; border-bottom: 1px dashed var(--gold-soft); }
.lv-recent-row:last-child { border-bottom: 0; }
.lv-flower { background: none; border: 0; font-size: 20px; line-height: 26px; text-align: center; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.lv-flower.lv-bloom span { display: inline-block; animation: lv-bloom 2.4s ease-out both; }
@keyframes lv-bloom { 0% { transform: scale(.1); opacity: 0; } 20% { transform: scale(1.7); opacity: 1; } 45%, 100% { transform: scale(1.1); opacity: 1; } }
.lv-zone-h { display: flex; justify-content: space-between; font: 700 .8rem var(--font-body); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); margin: .9rem 0 .2rem; }
.lv-zone-h span { color: var(--maroon); }
.lv-area-name { flex: 1; min-width: 0; }
.lv-bar { display: block; height: 7px; border-radius: 4px; background: var(--gold-soft); overflow: hidden; margin-top: 3px; }
.lv-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--maroon)); }
.lv-days { align-items: center; }
.lv-date { max-width: 10.5rem; }
.lv-play-wrap { position: relative; margin-top: .5rem; }
.lv-play-hud { position: absolute; left: .5rem; top: .5rem; z-index: 500; background: rgba(255, 253, 246, .93); border: 1px solid var(--gold-soft); border-radius: 10px; padding: .25rem .6rem; display: flex; flex-direction: column; font-size: .8rem; }
.lv-play-hud b { font: 700 1.15rem var(--font-head); color: var(--maroon); }
.lv-play-now { position: absolute; left: .5rem; bottom: .5rem; z-index: 500; background: rgba(122, 31, 43, .92); color: #fff; border-radius: 999px; padding: .2rem .7rem; font-size: .85rem; }
.lv-controls { margin-top: .6rem; }
.lv-spark { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.lv-spark i { flex: 1; background: var(--gold); opacity: .85; border-radius: 2px 2px 0 0; }
.lv-scrub { width: 100%; accent-color: var(--maroon); }
.lv-buttons { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .3rem; }
.live-banner { display: block; text-decoration: none; background: linear-gradient(135deg, #7A1F2B, #A83245); color: #fff; border-radius: 12px; padding: .6rem .8rem; margin-bottom: .75rem; }
.live-banner b { display: block; font: 700 1rem var(--font-head); }
.live-banner small { opacity: .92; }
.topbar-help { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid currentColor; color: inherit; font-weight: 700; text-decoration: none; flex: none; }
.lv-ann { width: 100%; font-size: .9rem; }
.lv-rank { width: 2rem; text-align: right; }
@media (prefers-reduced-motion: reduce) { .lv-row.lv-new, .lv-flower.lv-bloom span { animation: none; } }

.pl-row { padding: .35rem 0; border-bottom: 1px dashed var(--gold-soft); }
.pl-line { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pl-books { margin-left: auto; font-size: .8rem; color: var(--ink-soft); }
.pl-edit { margin: .4rem 0; padding: .6rem; background: var(--ivory); border: 1px solid var(--gold-soft); border-radius: 10px; }
.pl-cities > summary { cursor: pointer; margin: 1rem 0 .4rem; font-weight: 600; }
.lv-area-block { margin-bottom: .3rem; }

/* ---- The role menu (the current role as a small pill) ---- */
.role-menu { position: relative; display: inline-block; margin-left: auto; }
.role-menu .switch-role { margin-left: 0; }
.nav-rail-user .role-menu { display: block; width: 100%; }
.role-pop { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 3000; min-width: 15rem; background: #fff; color: var(--ink); border: 1px solid var(--gold-soft); border-radius: 12px; padding: .3rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.nav-rail-user .role-pop { left: 0; right: auto; top: auto; bottom: calc(100% + .35rem); width: 100%; }
.role-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: .5rem .65rem; border-radius: 8px; font-weight: 700; color: var(--maroon-deep); }
.role-item small { font-weight: 400; color: var(--ink-soft); }
.role-item:hover, .role-item:focus-visible { background: var(--maroon-tint); }
.role-item.on { background: #FBF1CF; box-shadow: inset 3px 0 0 var(--gold-active); }
.topbar-avatar.is-here { border-color: var(--gold-active); box-shadow: 0 0 0 2px var(--gold-active); }
.rail-profile.is-here .avatar, .rail-profile.is-here { outline: 3px solid var(--gold-active); outline-offset: 2px; border-radius: 50%; }
.pf-photo-buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .4rem; }

.lv-top { list-style: none; margin: 0; padding: 0; }
.lv-top-row { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px dashed var(--gold-soft); }
.lv-top-row.lv-podium { background: linear-gradient(90deg, rgba(226, 179, 27, .14), transparent); border-radius: 10px; padding-left: .3rem; }
.lv-rank-badge { width: 2rem; text-align: center; font: 700 1.05rem var(--font-head); color: var(--ink-soft); flex: none; }
.lv-top-name { flex: 1; min-width: 0; }
.lv-top-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-top-name small { color: var(--ink-soft); }
.lv-top-row > b { font: 700 1.15rem var(--font-head); color: var(--maroon); }

.lv-main-chips { gap: .3rem; }
.lv-main-chips .chip { padding: .3rem .6rem; font-size: .82rem; min-height: 0; }

.live-levels { display: grid; gap: .75rem; }
.live-level.on { border-color: var(--gold-active); box-shadow: 0 0 0 2px rgba(226, 179, 27, .35); }
.live-level h3 { margin: 0 0 .25rem; font-size: 1.1rem; }
.live-level-facts { padding-left: 1.1rem; font-size: .9rem; color: var(--ink-soft); }

.lv-cal { position: relative; overflow: hidden; cursor: pointer; display: inline-flex; align-items: center; }
.lv-cal-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* ---- App screen time table: a real table that scrolls sideways on a phone ---- */
.st-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .5rem; margin: .6rem 0; }
.st-bar input { grid-column: 1 / -1; }
.st-tile { font-size: 1.15rem; overflow-wrap: anywhere; }
.st-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--gold-soft); border-radius: 10px; background: #fff; max-width: 100%; }
.st-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: .85rem; }
.st-table th, .st-table td { padding: .4rem .65rem; border-bottom: 1px solid var(--gold-soft); white-space: nowrap; text-align: left; background: #fff; }
.st-table th { position: sticky; top: 0; background: var(--maroon-tint); color: var(--maroon-deep); font-weight: 700; cursor: pointer; user-select: none; }
.st-table th.on { background: #FBF1CF; }
.st-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.st-table .st-sticky { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--gold-soft); }
.st-table th.st-sticky { z-index: 2; }
.st-table tbody tr:nth-child(even) td { background: #FFFDF6; }
.st-danger { color: var(--danger); border-color: var(--danger); }
.st-purge-buttons { flex-wrap: wrap; }

.st-live { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: #2F9E4F; box-shadow: 0 0 0 0 rgba(47, 158, 79, .6); animation: st-pulse 1.8s infinite; vertical-align: middle; }
@keyframes st-pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 158, 79, .55); } 70% { box-shadow: 0 0 0 .45rem rgba(47, 158, 79, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 158, 79, 0); } }
@media (prefers-reduced-motion: reduce) { .st-live { animation: none; } }

.st-refresh { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .4rem 0; }
.st-refresh label { font-weight: 600; margin: 0; }
.st-refresh select { width: auto; min-width: 7rem; }

.st-live.st-recent { background: #E0A800; animation: none; box-shadow: none; }
.st-table tfoot td { background: var(--maroon-tint); border-top: 2px solid var(--gold-soft); border-bottom: 0; }

/* ---- who is distributing now / on the app: a pulsing green blip and colour ---- */
.blip { position: relative; display: inline-block; width: .9rem; height: .9rem; flex: none; }
.blip i { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9BF5A8, #22B14C 60%, #138A38); box-shadow: 0 0 .5rem rgba(34, 177, 76, .85); }
.blip::before, .blip::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #22B14C; animation: blip 1.8s ease-out infinite; }
.blip::after { animation-delay: .9s; }
@keyframes blip { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(3); opacity: 0; } }
.blip.cool i { background: radial-gradient(circle at 35% 30%, #D6F5DC, #7BCF92 60%, #55B06E); box-shadow: 0 0 .3rem rgba(85, 176, 110, .6); }
.blip.cool::before, .blip.cool::after { border-color: #7BCF92; animation-duration: 3s; }
.blip.big { width: 1.2rem; height: 1.2rem; }
.lv-people-head { display: flex; align-items: center; gap: .9rem; margin: .5rem 0 .7rem; padding: .6rem .8rem; border-radius: 14px; background: linear-gradient(135deg, #E6F8EA, #FFF8E7); border: 1px solid #BFE6C8; }
.lv-big { display: flex; align-items: center; gap: .6rem; }
.lv-big b { font: 700 2rem/1 var(--font-head); color: #138A38; }
.lv-people-title { font-size: 1.1rem; margin: 0; color: var(--maroon-deep); }
.lv-person { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; border-radius: 12px; background: #fff; border: 1px solid var(--gold-soft); border-left: 4px solid hsl(var(--zh, 140) 60% 45%); }
.lv-person.lv-app { border-left-color: #22B14C; }
.lv-sub { color: var(--ink-soft); }
.lv-chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; vertical-align: middle; }
.lv-chip-books { background: #FBF1CF; color: #8A5A00; }
.lv-chip-dist { background: #E6F8EA; color: #138A38; }
.lv-area-chip { display: inline-block; padding: .05rem .55rem; border-radius: 999px; background: hsl(var(--zh, 140) 70% 92%); color: hsl(var(--zh, 140) 60% 25%); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .blip::before, .blip::after { animation: none; opacity: .35; } }

/* ---- small person cards (distributing now, on the app, active today) ---- */
.pc-grid { list-style: none; margin: .5rem 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.pc-grid.pc-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 576px) { .pc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .pc-grid.pc-2 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 992px) { .pc-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } .pc-grid.pc-2 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pc { display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; padding: .65rem .35rem .6rem; background: #fff; border: 1px solid var(--gold-soft); border-radius: 14px; box-shadow: 0 1px 3px rgba(60, 30, 20, .06); min-width: 0; }
.pc.pc-dist { border-top: 3px solid hsl(var(--zh, 140) 60% 50%); }
.pc-av { position: relative; display: inline-block; line-height: 0; }
.pc-av .avatar-lg { width: 3.4rem; height: 3.4rem; }
.pc-blip { position: absolute; right: -.1rem; bottom: -.1rem; width: .85rem; height: .85rem; background: #fff; border-radius: 50%; padding: 0; box-shadow: 0 0 0 2px #fff; }
.pc-name { max-width: 100%; font-size: .85rem; line-height: 1.2; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-area { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.pc-none { font-size: .72rem; color: var(--ink-soft); }
.pc-time { font-size: .72rem; color: var(--ink-soft); }
.lv-people-small { margin-top: 1rem; padding: .45rem .7rem; background: var(--ivory); border-color: var(--gold-soft); }
.lv-people-small .lv-big b { font-size: 1.4rem; color: var(--maroon); }

.pc-av .avatar-initial { background: linear-gradient(135deg, hsl(var(--ah, 20) 72% 62%), hsl(calc(var(--ah, 20) + 35) 70% 46%)); color: #fff; font-size: 1.25rem; font-weight: 700; }
