/* Thanvi Temple Cloud — app styles. Mobile first; sidebar from 900px. */
:root {
  --maroon: #7a2516; --maroon-2: #9b3a22; --gold: #b98323; --gold-soft: #f3e3c2;
  --bg: #f7f2e9; --surface: #fffdf9; --surface-2: #f3ece0; --ink: #24180f; --muted: #6b5a48; --line: #e4d6bf;
  --accent: var(--maroon); --accent-ink: #fff; --ok: #2f6b3a; --danger: #b3261e; --focus: #c8902e;
  --radius: 12px; --shadow: 0 1px 2px rgba(60,30,10,.06), 0 4px 16px rgba(60,30,10,.06);
  --font: "Noto Sans", "Noto Sans Tamil", system-ui, sans-serif;
  --top-h: 56px; --tab-h: 64px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #15100c; --surface: #1f1813; --surface-2: #2a2119; --ink: #f2e8da; --muted: #b9a68f; --line: #3b2f24;
  --accent: #d97a5c; --accent-ink: #1a0f0a; --gold-soft: #3a2c18; --ok: #7cc18a; --danger: #f08a80;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; display: flex; align-items: center; gap: .4rem; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .82rem; display: block; margin-top: .2rem; }
.ic { flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* layout helpers */
.stack > * + * { margin-top: 1rem; }
.stack-s > * + * { margin-top: .4rem; }
.row { display: flex; align-items: center; }
.row.gap, .gap { gap: .6rem; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.center { text-align: center; }
.grid2, .grid3 { display: grid; gap: .8rem 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: 1fr 1.4fr 1fr; } }
.grid2.tight { gap: .4rem .8rem; }
.span2 { grid-column: 1 / -1; }
.center-screen { min-height: 100vh; display: grid; place-items: center; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
fieldset.card { margin-left: 0; margin-right: 0; margin-bottom: 0; min-width: 0; }
fieldset.card > legend { float: left; width: 100%; padding: 0; margin: 0 0 .2rem; font-weight: 700; font-size: 1.05rem; color: var(--accent); }
fieldset.card > legend + * { clear: both; }
.card.error, .error { color: var(--danger); }
.notice { background: var(--gold-soft); border-radius: 10px; padding: .7rem .9rem; }
.narrow { max-width: 460px; margin: 2rem auto; }
.wide-form { max-width: 860px; }

/* forms */
.field { display: block; }
.lbl { display: block; font-size: .86rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.lbl em { font-weight: 400; font-style: normal; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; min-height: 46px;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: 2px solid color-mix(in srgb, var(--gold) 35%, transparent); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
input[readonly] { background: var(--surface-2); }
input:user-invalid { border-color: var(--danger); }
.check { display: flex; gap: .6rem; align-items: center; min-height: 40px; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex: none; }
.geo { display: grid; gap: .5rem; align-items: end; grid-template-columns: 1fr; }
@media (min-width: 640px) { .geo { grid-template-columns: 1fr auto; } .geo .btn { margin-bottom: 1.45rem; } }

/* segmented */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg.wide { display: flex; }
.seg label, .seg > button { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg > button { display: block; white-space: nowrap; text-align: center; padding: .55rem .9rem; min-height: 42px; font: inherit; font-size: .9rem; border: 0; background: none; color: var(--ink); cursor: pointer; }
.seg label + label, .seg > button + button { border-left: 1px solid var(--line); }
.seg input:checked + span, .seg > button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 600;
  border-radius: 10px; padding: .65rem 1.1rem; min-height: 46px; border: 1px solid transparent; cursor: pointer;
  text-decoration: none; background: var(--surface-2); color: var(--ink);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.whatsapp { background: #1f8f4e; color: #fff; }
.btn.google { width: 100%; background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: .3rem .7rem; font-size: .88rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.busy { position: relative; color: transparent !important; pointer-events: none; }
.busy::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.primary.busy::after { border-color: #fff transparent #fff transparent; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: .3rem 0; text-decoration: underline; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; border: 0; background: transparent; color: inherit; cursor: pointer; list-style: none; }
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.icon-btn.danger { color: var(--danger); font-weight: 700; }
.chip { border: 1px solid color-mix(in srgb, currentColor 35%, transparent); background: transparent; color: inherit; border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .85rem; cursor: pointer; min-height: 34px; }
.file-btn { cursor: pointer; }
.actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.actions.sticky { position: sticky; bottom: calc(var(--tab-h) + 8px); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); padding: .6rem 0; z-index: 5; }
@media (min-width: 900px) { .actions.sticky { bottom: 0; } }

/* spinner & toasts */
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; margin: 1rem auto; }
.spinner.small { width: 22px; height: 22px; border-width: 2px; margin: .5rem 0; }
@keyframes spin { to { transform: rotate(360deg); } }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 16px); z-index: 1000; display: grid; gap: .5rem; width: min(92vw, 420px); }
.toast { background: #2a2018; color: #fff; padding: .75rem 1rem; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); transition: opacity .4s, transform .4s; }
.toast-error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* shell */
.emu { background: #ffe9a8; color: #5b4300; text-align: center; font-size: .78rem; padding: .2rem; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: .4rem; padding: 0 .5rem 0 .75rem; background: var(--maroon); color: #fff; }
.brand { display: flex; align-items: center; gap: .55rem; min-width: 0; flex: 1; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.14); color: var(--gold-soft); }
[data-theme="dark"] .brand-mark { color: #f3d9a4; }
.brand-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: .25rem; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: #fff; font-weight: 700; font-size: .9rem; flex: none; }
.avatar.ghost { background: var(--surface-2); color: var(--muted); }
.menu { position: relative; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 46px; min-width: 240px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: .4rem; z-index: 50; }
.menu-who { padding: .5rem .6rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; display: grid; }
.menu-who small { color: var(--muted); }
.menu-item { display: flex; gap: .55rem; align-items: center; width: 100%; padding: .6rem; border-radius: 8px; background: none; border: 0; color: inherit; font: inherit; text-decoration: none; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); }

.shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: 264px; background: var(--surface); border-right: 1px solid var(--line); padding: calc(var(--top-h) + .6rem) .6rem 1rem; overflow-y: auto; transform: translateX(-100%); transition: transform .2s; }
.menu-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
.scrim { display: none; }
.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .62rem .75rem; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; min-height: 44px; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--gold-soft); color: var(--maroon); font-weight: 700; }
[data-theme="dark"] .nav-item.active { color: #f3d9a4; }
.nav-item.later { color: var(--muted); }
.nav-item em { margin-left: auto; font-style: normal; font-size: .7rem; border: 1px solid var(--line); border-radius: 999px; padding: 0 .45rem; }
.main { padding: 1rem 1rem calc(var(--tab-h) + 1.5rem); outline: none; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: var(--tab-h); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-size: .7rem; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0 2px; text-align: center; }
.tabbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabbar .active { color: var(--accent); font-weight: 700; }
.only-mobile { display: inline-grid; }
@media (min-width: 900px) {
  .sidebar { transform: none; top: var(--top-h); padding-top: .8rem; }
  .main { margin-left: 264px; padding: 1.5rem 2rem 2rem; }
  .tabbar, .only-mobile, .scrim { display: none !important; }
  #toasts { bottom: 24px; }
}
.bare-main { padding: 1rem; }

/* auth */
.auth { max-width: 440px; margin: 0 auto; padding: 1.5rem 0 3rem; }
.auth-brand { text-align: center; margin-bottom: 1.2rem; }
.auth-brand h1 { color: var(--accent); margin-top: .5rem; }
.auth-card > * + * { margin-top: 1rem; }
.or { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* temple picker */
.temple-list { display: grid; gap: .7rem; }
.temple-card { display: flex; gap: .9rem; align-items: center; width: 100%; text-align: left; padding: .9rem 1rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius); font: inherit; cursor: pointer; box-shadow: var(--shadow); }
.temple-card:hover { border-color: var(--gold); }
.tc-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--gold-soft); color: var(--maroon); flex: none; }
.tc-text { display: grid; }
.tc-text small { color: var(--muted); }

/* dashboard */
.hero { display: flex; gap: 1rem; align-items: center; }
.hero-logo { width: 72px; height: 72px; border-radius: 16px; background: var(--gold-soft); color: var(--maroon); display: grid; place-items: center; flex: none; overflow: hidden; }
.hero-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.tag { display: inline-block; font-size: .78rem; border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: .1rem .6rem; white-space: nowrap; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: .6rem; }
.progress span { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.checklist a { display: flex; gap: .6rem; align-items: center; padding: .55rem .4rem; border-radius: 8px; color: var(--ink); text-decoration: none; }
.checklist a:hover { background: var(--surface-2); }
.checklist li .ic { color: var(--muted); }
.checklist li.done .ic { color: var(--ok); }
.checklist li.done span { color: var(--muted); text-decoration: line-through; }
.ok-text { color: var(--ok); display: flex; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.soon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.soon-item { display: flex; gap: .5rem; align-items: center; padding: .6rem; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: .9rem; }
.big-icon { color: var(--gold); }

/* temple settings */
.logo-card { display: flex; gap: 1rem; align-items: center; }
.logo-box { width: 96px; height: 96px; border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--maroon); display: grid; place-items: center; flex: none; overflow: hidden; }
.logo-box img { width: 100%; height: 100%; object-fit: contain; }
.cropper { display: grid; gap: .6rem; justify-items: center; }
.cropper canvas { width: min(280px, 70vw); height: auto; aspect-ratio: 1; border-radius: 12px; touch-action: none; cursor: grab; border: 1px solid var(--line); }

/* receipt settings */
.split { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); align-items: start; } .preview-col { position: sticky; top: calc(var(--top-h) + 1rem); } }
.preview-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.preview-controls select { width: auto; min-height: 42px; }
.paper-stage { background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(0,0,0,.03) 10px 20px), var(--surface-2); border-radius: 10px; padding: 1rem; display: flex; justify-content: safe center; overflow: auto; max-height: 75vh; }
.paper-stage .rcpt { box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 8px 24px rgba(0,0,0,.08); }
.zoom-58mm .rcpt { zoom: 1.3; } .zoom-80mm .rcpt { zoom: 1.05; } .zoom-a4 .rcpt { zoom: .45; }

/* staff */
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: .7rem; padding: .65rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.people li:last-child { border-bottom: 0; }
.people .who { display: grid; flex: 1; min-width: 160px; }
.people .who small { color: var(--muted); overflow-wrap: anywhere; }
.people .who em { font-weight: 400; color: var(--muted); }
.people select { width: auto; min-height: 40px; }
.linkbox { background: var(--surface-2); border-radius: 8px; padding: .6rem; margin: .6rem 0; overflow-wrap: anywhere; font-size: .82rem; }

/* dialog */
dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(94vw, 460px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.modal.wide { width: min(94vw, 720px); }
dialog.modal::backdrop { background: rgba(20,10,5,.5); }
dialog.modal form { padding: 1.2rem; }
.modal-body { margin: .6rem 0 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Phase 2: billing ---------- */
.inline-field { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); font-weight: 600; }
.inline-field select, .inline-field input { width: auto; min-height: 40px; padding: .4rem .6rem; }
.pos-head h1 { margin: 0; }
.pos-cats { margin: .8rem 0; }
.pos-grid { display: grid; gap: 1rem; margin-top: .8rem; }
@media (min-width: 900px) { .pos-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .cart { position: sticky; top: calc(var(--top-h) + 1rem); } }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; align-content: start; }
.svc-btn { position: relative; display: grid; gap: .15rem; text-align: left; min-height: 96px; padding: .8rem .85rem; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; box-shadow: var(--shadow); touch-action: manipulation; }
.svc-btn b { font-size: 1.02rem; line-height: 1.3; }
.svc-btn span { font-size: .8rem; color: var(--muted); }
.svc-btn i { font-style: normal; font-weight: 800; color: var(--accent); margin-top: auto; }
.svc-btn em { position: absolute; top: -8px; right: -8px; min-width: 28px; height: 28px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-style: normal; font-weight: 800; display: grid; place-items: center; padding: 0 6px; }
.svc-btn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.svc-btn:active { transform: scale(.98); }
.cart > * + * { margin-top: .8rem; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-lines li { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.cart-lines .who { display: grid; } .cart-lines .who small { color: var(--muted); }
.qty { display: inline-flex; align-items: center; gap: .1rem; } .qty b { min-width: 1.6rem; text-align: center; }
.qty .icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); font-size: 1.2rem; font-weight: 700; }
.amt { font-weight: 700; min-width: 5.2rem; text-align: right; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.25rem; border-top: 2px solid var(--ink); padding-top: .5rem; }
.cart-total b { font-size: 1.6rem; }
.devotee summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: .3rem 0; }
.devotee summary em { font-weight: 400; font-style: normal; }
.devotee .grid2 { margin-top: .5rem; }
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.pay-row .span2 { grid-column: 1 / -1; }
.btn.big { min-height: 60px; font-size: 1.05rem; }
.btn.cash { background: #2f6b3a; color: #fff; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: .6rem .9rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; min-height: 44px; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.list-head { padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.bill-list { list-style: none; margin: 0; padding: 0; }
.bill-list li { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.bl-main { display: grid; } .bl-main small { color: var(--muted); } .bl-main .reason { color: var(--danger); }
.bl-amt { display: grid; justify-items: end; gap: .2rem; }
.bl-act { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: .1rem .55rem; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.st-upi-pending { background: #fff1c2; color: #7a5a00; } .st-upi-verified, .st-upi-cash { background: #dff0e2; color: #2f6b3a; }
.st-cancel_requested { background: #ffe1d6; color: #9b3a22; } .st-cancelled { background: #f6d6d3; color: var(--danger); text-decoration: line-through; }
[data-theme="dark"] .st-upi-pending, [data-theme="dark"] .st-upi-verified, [data-theme="dark"] .st-upi-cash, [data-theme="dark"] .st-cancel_requested, [data-theme="dark"] .st-cancelled { filter: brightness(.85); }
.svc-list { list-style: none; margin: 0; padding: 0; }
.svc-list li { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.svc-list li:last-child { border-bottom: 0; }
.svc-list .who { display: grid; flex: 1; min-width: 140px; } .svc-list .who small { color: var(--muted); }
.svc-list .price { font-weight: 700; }
.svc-list li.off { opacity: .6; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; display: grid; gap: .2rem; }
.kpi small { color: var(--muted); font-weight: 600; } .kpi b { font-size: 1.25rem; }
.kpi.hl { background: var(--maroon); color: #fff; border-color: var(--maroon); } .kpi.hl small { color: #f3d9a4; }
.kpi.warn b { color: #9a6b00; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.tbl .num { text-align: right; white-space: nowrap; }
.verify { margin-top: 2rem; } .verify-mark { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: #fff; background: var(--ok); }
.verify.bad .verify-mark { background: var(--danger); }
.kv-plain { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; text-align: left; margin: 0; }
.kv-plain dt { color: var(--muted); } .kv-plain dd { margin: 0; }

/* ---------- Phase 3 ---------- */
.donate { max-width: 520px; }
.don-head { text-align: center; margin-bottom: 1rem; }
.don-head img { width: 84px; height: 84px; object-fit: contain; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.don-head h1 { color: var(--accent); margin-top: .5rem; }
.chips-select { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips-select label { position: relative; }
.chips-select input { position: absolute; opacity: 0; pointer-events: none; }
.chips-select span { display: grid; padding: .55rem .8rem; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); min-height: 44px; }
.chips-select small { color: var(--muted); font-size: .75rem; }
.chips-select input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.chips-select input:focus-visible + span { outline: 3px solid var(--focus); }
.don-amt { font-size: 2rem; font-weight: 800; color: var(--accent); }
.don-qr svg { width: min(260px, 70vw); height: auto; }
.only-mobile-flex { display: flex; }
@media (min-width: 900px) { .only-mobile-flex { display: none; } }
.denoms { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.denoms label { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .5rem; }
.denoms b { min-width: 3.5rem; }
.count-total { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 800; border-top: 2px solid var(--ink); padding-top: .5rem; }
.cmp { width: 100%; border-collapse: collapse; }
.cmp td, .cmp th { padding: .35rem .4rem; border-bottom: 1px solid var(--line); text-align: right; }
.cmp td:first-child, .cmp th:first-child { text-align: left; }
.cmp .diff { color: var(--danger); font-weight: 700; }
.att { display: inline-flex; gap: .3rem; align-items: center; font-size: .85rem; }
.btn.primary small, .btn.primary .muted { color: inherit; opacity: .85; }

/* ---------- Phase 4 ---------- */
.table-wrap { overflow-x: auto; }
.tbl tfoot th { border-top: 2px solid var(--ink); }
.export-btns .btn { min-height: 36px; }
.don-ref { font-size: 1.6rem; font-weight: 800; letter-spacing: .08em; color: var(--accent); }
.adj-line { align-items: end; }

/* ---------- phones ---------- */
@media (max-width: 639px) {
  /* choice buttons wrap into a grid instead of running off the screen */
  .seg { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); width: 100%; }
  .seg label, .seg > button { flex: 1 1 auto; min-width: calc(33% - 1px); }
  .seg label + label, .seg > button + button { border-left: 0; }
  .seg span, .seg > button { background: var(--surface); padding: .55rem .5rem; }
  .tbl { font-size: .84rem; }
  .tbl th, .tbl td { padding: .45rem .3rem; }
  .tbl .hide-sm { display: none; }
  /* tables marked stack-sm become one card per row */
  .tbl.stack-sm thead { display: none; }
  .tbl.stack-sm tr { display: block; padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .tbl.stack-sm td { display: flex; justify-content: space-between; gap: .8rem; border: 0; padding: .2rem 0; text-align: right; }
  .tbl.stack-sm td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; }
  .tbl.stack-sm td.full { display: block; text-align: left; }
  .tbl.stack-sm td.full::before { display: block; margin-bottom: .3rem; }
  .tbl.stack-sm td.full input { max-width: none !important; flex: 1; }
}
