/* ApnaRecord — the AeroGyan family look (tokens --ag-*, light + dark, phones first). "To collect" is green, "To pay"
   is red — always with a word and an arrow, never colour alone. */
:root {
  --ag-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", "Noto Sans", sans-serif;
  --ag-bg: #f7f8fb; --ag-surface: #ffffff; --ag-raised: #ffffff; --ag-line: rgba(15, 23, 42, .12); --ag-text: #0f172a; --ag-muted: #566074;
  --ag-accent: #c2410c; --ag-accent-contrast: #ffffff; --ag-accent-soft: rgba(194, 65, 12, .1);
  --ag-ok: #15803d; --ag-warn: #a16207; --ag-err: #c81e1e; --ag-info: #2563eb;
  --ag-ok-soft: rgba(21, 128, 61, .06); --ag-ok-ink: #166534; --ag-err-soft: rgba(200, 30, 30, .06);
  --ag-radius-sm: 8px; --ag-radius: 12px; --ag-radius-lg: 16px;
  --ag-shadow-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 1px rgba(15, 23, 42, .04);
  --ag-shadow-2: 0 8px 24px -6px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .06);
  --ag-ease: cubic-bezier(.2, .8, .2, 1);
  --bar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ag-bg: #0b0f17; --ag-surface: #121826; --ag-raised: #182033; --ag-line: rgba(255, 255, 255, .12); --ag-text: #e8ecf4; --ag-muted: #a3acc0;
    --ag-accent: #fb923c; --ag-accent-contrast: #1a0d04; --ag-accent-soft: rgba(251, 146, 60, .14);
    --ag-ok: #4ade80; --ag-warn: #fbbf24; --ag-err: #f87171; --ag-info: #60a5fa;
    --ag-ok-soft: rgba(74, 222, 128, .12); --ag-ok-ink: #4ade80; --ag-err-soft: rgba(248, 113, 113, .12); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ag-bg: #0b0f17; --ag-surface: #121826; --ag-raised: #182033; --ag-line: rgba(255, 255, 255, .12); --ag-text: #e8ecf4; --ag-muted: #a3acc0;
  --ag-accent: #fb923c; --ag-accent-contrast: #1a0d04; --ag-accent-soft: rgba(251, 146, 60, .14);
  --ag-ok: #4ade80; --ag-warn: #fbbf24; --ag-err: #f87171; --ag-info: #60a5fa;
  --ag-ok-soft: rgba(74, 222, 128, .12); --ag-ok-ink: #4ade80; --ag-err-soft: rgba(248, 113, 113, .12); color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ag-bg); color: var(--ag-text); font: 16px/1.5 var(--ag-font); overflow-x: hidden; }
a { color: var(--ag-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: .25rem 0 .5rem; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
.muted { color: var(--ag-muted); }
small { font-size: .85rem; }
.boot { display: grid; place-items: center; gap: 12px; min-height: 60vh; color: var(--ag-muted); }
.noscript { padding: 16px; }
:focus-visible { outline: 2px solid var(--ag-accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--ag-surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }

/* top bar (every width) + bottom bar (phones) */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--ag-surface) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--ag-line); }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 6px 12px; display: flex; align-items: center; gap: 6px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ag-text); font-size: 1.02rem; min-height: 44px; flex: none; }
.brand:hover { text-decoration: none; }
.bizsw { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; max-width: 220px; padding: 0 10px; border: 1px solid var(--ag-line); border-radius: 10px; background: var(--ag-surface); color: var(--ag-text); font: inherit; font-weight: 600; cursor: pointer; min-width: 0; }
.bizsw span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.topnav a, .navlink { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: var(--ag-radius-sm); color: var(--ag-text); min-height: 44px; white-space: nowrap; }
.topnav a:hover { background: var(--ag-accent-soft); text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--ag-accent); font-weight: 700; }
.lang-chip { font-size: .85rem; }
.syncdot { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: .78rem; color: var(--ag-muted); min-height: 44px; min-width: 44px; padding: 0 6px; border: 0; background: none; font-family: inherit; cursor: pointer; }
.syncdot i { width: 8px; height: 8px; border-radius: 50%; background: var(--ag-ok); display: inline-block; }
.syncdot.wait i { background: var(--ag-warn); }
.syncdot.off i { background: var(--ag-muted); }
.syncdot.err i { background: var(--ag-err); }
.page { max-width: 1180px; margin: 0 auto; padding: 12px 16px 96px; min-height: 70vh; }
.foot { max-width: 1180px; margin: 0 auto; padding: 20px 16px 110px; color: var(--ag-muted); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; border-top: 1px solid var(--ag-line); font-size: .9rem; }
.foot p { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.foot-links a, .legal-links a, .legal-note a { display: inline-block; padding: 6px 0; }
/* privacy policy and terms: one readable column */
.card.legal { max-width: 760px; margin: 16px auto; padding: 20px 20px 8px; overflow-wrap: anywhere; }
.legal section { margin: 0 0 4px; }
.legal h2 { margin: 18px 0 6px; }
.legal p { margin: 0 0 10px; }
.legal-note { margin: 14px 0 0; font-size: .92rem; }
.botbar { display: none; }
@media (max-width: 899px) {
  .topnav .wide { display: none; }
  .botbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--ag-surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--ag-line); }
  .botbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; min-height: 52px; color: var(--ag-muted); font-size: .72rem; border-radius: 10px; text-align: center; }
  .botbar a:hover { text-decoration: none; }
  .botbar a[aria-current="page"] { color: var(--ag-accent); font-weight: 700; }
  .botbar a.plus { color: var(--ag-accent-contrast); }
  .botbar a.plus .pl { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ag-accent); margin-top: -18px; box-shadow: var(--ag-shadow-2); }
  .botbar a.plus span { color: var(--ag-text); }
}
@media (min-width: 900px) { .narrow-only { display: none !important; } }
@media (max-width: 560px) { .hide-sm { display: none !important; } .bizsw { max-width: 150px; } .brand b { display: none; } }

/* buttons + inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--ag-line);
  background: var(--ag-surface); color: var(--ag-text); font: inherit; font-weight: 600; cursor: pointer; transition: transform .12s var(--ag-ease), background .12s; text-decoration: none; }
.btn:hover { text-decoration: none; background: var(--ag-accent-soft); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ag-accent); color: var(--ag-accent-contrast); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { background: transparent; color: var(--ag-err); border-color: color-mix(in srgb, var(--ag-err) 45%, transparent); }
.btn.gave { background: var(--ag-err-soft); color: var(--ag-err); border-color: color-mix(in srgb, var(--ag-err) 40%, transparent); }
.btn.got { background: var(--ag-ok-soft); color: var(--ag-ok-ink); border-color: color-mix(in srgb, var(--ag-ok) 40%, transparent); }
.btn.small { min-height: 44px; padding: 0 12px; font-size: .9rem; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.iconbtn { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--ag-text); border-radius: var(--ag-radius-sm); cursor: pointer; font: inherit; }
.iconbtn:hover { background: var(--ag-accent-soft); }
.iconbtn.on { color: var(--ag-accent); }
.inp { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--ag-text) 28%, transparent); border-radius: 10px; background: var(--ag-surface); color: var(--ag-text); font: inherit; min-width: 0; }
.inp:focus { outline: 2px solid var(--ag-accent); outline-offset: 0; border-color: transparent; }
textarea.inp { min-height: 72px; resize: vertical; }
.inp.amt { font-size: 1.4rem; font-weight: 700; }
.field { display: grid; gap: 4px; margin: 0 0 12px; min-width: 0; }
.field > span { font-weight: 600; font-size: .92rem; }
.hint { color: var(--ag-muted); }
.check { display: flex; gap: 10px; align-items: center; margin: 6px 0; cursor: pointer; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--ag-accent); flex: none; }
.form-err { color: var(--ag-err); min-height: 1.2em; margin: 6px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .grid2.stack-sm { grid-template-columns: 1fr; } }

/* cards, chips, layout */
.card { background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: var(--ag-radius-lg); padding: 16px; margin: 0 0 12px; box-shadow: var(--ag-shadow-1); min-width: 0; }
.card.narrow { max-width: 460px; margin: 24px auto; }
.card.attn { border-color: var(--ag-warn); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.spread { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.toolbar { margin: 8px 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--ag-accent-soft); color: var(--ag-text); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--ag-ok-soft); color: var(--ag-ok-ink); }
.chip.err { background: var(--ag-err-soft); color: var(--ag-err); }
.chip.off { background: color-mix(in srgb, var(--ag-muted) 16%, transparent); color: var(--ag-muted); }
.chip.warn { background: color-mix(in srgb, var(--ag-warn) 16%, transparent); color: var(--ag-warn); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.chip-btn { flex: none; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ag-line); background: var(--ag-surface); color: var(--ag-text); font: inherit; cursor: pointer; }
.chip-btn.on { background: var(--ag-accent); color: var(--ag-accent-contrast); border-color: transparent; }
.banner { padding: 10px 14px; border-radius: var(--ag-radius); margin: 0 0 12px; border: 1px solid; }
.banner.warn { border-color: color-mix(in srgb, var(--ag-warn) 50%, transparent); background: color-mix(in srgb, var(--ag-warn) 10%, transparent); }
.banner.info { border-color: color-mix(in srgb, var(--ag-info) 45%, transparent); background: color-mix(in srgb, var(--ag-info) 9%, transparent); }
.banner.err { border-color: color-mix(in srgb, var(--ag-err) 50%, transparent); background: color-mix(in srgb, var(--ag-err) 9%, transparent); }
.empty { display: grid; place-items: center; gap: 8px; padding: 32px 16px; color: var(--ag-muted); text-align: center; }
.empty p { margin: 0; max-width: 40ch; }
.sec-h { margin: 20px 0 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; }
.kv dt { color: var(--ag-muted); } .kv dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--ag-line); border-radius: 12px; padding: 3px; gap: 3px; background: var(--ag-surface); max-width: 100%; flex-wrap: wrap; }
@media (max-width: 560px) { .seg { display: flex; } .seg-btn { flex: 1 1 auto; justify-content: center; } }
.seg-btn { min-height: 44px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ag-text); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.seg-btn.on { background: var(--ag-accent); color: var(--ag-accent-contrast); }
.seg-btn.on.gave { background: var(--ag-err); color: #fff; }
.seg-btn.on.got { background: var(--ag-ok); color: #fff; }
:root[data-theme="dark"] .seg-btn.on.gave, :root[data-theme="dark"] .seg-btn.on.got { color: #0b0f17; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-btn.on.gave, :root:not([data-theme="light"]) .seg-btn.on.got { color: #0b0f17; } }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--ag-line); margin: 4px 0 12px; scrollbar-width: none; }
.tab { display: inline-flex; gap: 6px; align-items: center; padding: 10px 12px; min-height: 44px; border: 0; border-bottom: 2px solid transparent; white-space: nowrap; background: none; color: var(--ag-text); font: inherit; cursor: pointer; }
.tab.on { border-color: var(--ag-accent); color: var(--ag-accent); font-weight: 700; }
.tbl-wrap { overflow-x: auto; max-width: 100%; }
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl td, .tbl th { padding: 8px 6px; border-bottom: 1px solid var(--ag-line); text-align: left; vertical-align: top; }
.tbl th { font-size: .82rem; color: var(--ag-muted); font-weight: 600; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tr.total td { font-weight: 800; border-bottom: 0; }
.tbl tr.sub td { color: var(--ag-muted); }

/* money */
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.collect { color: var(--ag-ok-ink); }
.pay { color: var(--ag-err); }
.bal { display: inline-grid; justify-items: end; line-height: 1.2; }
.bal b { font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bal small { font-size: .74rem; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.bal.settled { color: var(--ag-muted); }
.sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.sum-tile { border-radius: var(--ag-radius-lg); padding: 12px 14px; border: 1px solid var(--ag-line); background: var(--ag-surface); display: grid; gap: 2px; min-width: 0; }
.sum-tile b { font-size: clamp(1.15rem, 4.6vw, 1.6rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sum-tile span { display: inline-flex; gap: 4px; align-items: center; font-weight: 600; font-size: .9rem; }
.sum-tile.collect { background: var(--ag-ok-soft); border-color: color-mix(in srgb, var(--ag-ok) 35%, transparent); }
.sum-tile.pay { background: var(--ag-err-soft); border-color: color-mix(in srgb, var(--ag-err) 35%, transparent); }
.sum-tile.plain { color: var(--ag-text); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 0 0 12px; }
.stat { background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: var(--ag-radius); padding: 10px 12px; display: grid; min-width: 0; }
.stat b { font-size: 1.15rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat span { color: var(--ag-muted); font-size: .85rem; }

/* quick entry */
.qe { display: flex; gap: 6px; align-items: center; background: var(--ag-surface); border: 1px solid var(--ag-line); border-radius: 14px; padding: 4px 4px 4px 12px; margin: 0 0 4px; }
.qe-hint { display: block; margin: 0 4px 12px; font-size: .85rem; line-height: 1.4; overflow-wrap: anywhere; }
.qe .inp { border: 0; padding-left: 0; background: transparent; }
.qe .inp:focus { outline: 0; }
.qe:focus-within { outline: 2px solid var(--ag-accent); }
.qe .iconbtn.rec { color: var(--ag-err); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.draft { border: 2px solid var(--ag-accent); }

/* lists */
.searchrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.searchrow .inp { flex: 1 1 200px; }
.searchrow select.inp { flex: 0 1 200px; }
.vlist { position: relative; overflow-y: auto; border: 1px solid var(--ag-line); border-radius: var(--ag-radius-lg); background: var(--ag-surface); contain: strict; }
.vlist-in { position: relative; }
.vrow { position: absolute; left: 0; right: 0; }
.plist .vrow, .prow { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--ag-line); color: var(--ag-text); min-height: 64px; }
.prow:hover, .plist .vrow:hover { background: var(--ag-accent-soft); text-decoration: none; }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ag-accent-soft); color: color-mix(in srgb, var(--ag-accent) 75%, var(--ag-text)); font-weight: 800; flex: none; }
.av.s { background: color-mix(in srgb, var(--ag-info) 14%, transparent); color: color-mix(in srgb, var(--ag-info) 75%, var(--ag-text)); }
.pmain { display: grid; min-width: 0; flex: 1; }
.pmain b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmain small { color: var(--ag-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erow { display: grid; grid-template-columns: 1fr 7.5em 7.5em; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--ag-line); min-height: 64px; cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; font: inherit; color: var(--ag-text); }
.erow:hover { background: var(--ag-accent-soft); }
.erow .num { text-align: right; font-variant-numeric: tabular-nums; }
.erow .gv { color: var(--ag-err); font-weight: 700; } .erow .gt { color: var(--ag-ok-ink); font-weight: 700; }
.erow .emain { display: grid; min-width: 0; }
.erow .emain small { color: var(--ag-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ehead { display: grid; grid-template-columns: 1fr 7.5em 7.5em; gap: 8px; padding: 6px 12px; font-size: .8rem; color: var(--ag-muted); font-weight: 600; }
.ehead .num { text-align: right; }
/* phones: one amount column (red ↖ gave, green ↘ got) so the note and running balance keep their width */
@media (max-width: 420px) {
  .erow, .ehead { grid-template-columns: 1fr auto; gap: 8px; padding-left: 10px; padding-right: 10px; }
  .erow .num:empty, .ehead .num { display: none; }
  .erow .gv::before { content: '↖ '; font-weight: 400; } .erow .gt::before { content: '↘ '; font-weight: 400; }
}
.lrow { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--ag-line); min-height: 56px; color: var(--ag-text); }
.lrow:last-child { border-bottom: 0; }
a.lrow:hover, button.lrow:hover { background: var(--ag-accent-soft); text-decoration: none; }
button.lrow { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; text-align: left; cursor: pointer; }
.lrow .grow small { display: block; color: var(--ag-muted); }
.listcard { padding: 0; overflow: hidden; }
.listcard > h2 { padding: 12px 12px 0; }

/* party page */
.phead { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.phead .bigbal { margin-left: auto; text-align: right; }
.bigbal b { font-size: 1.6rem; font-variant-numeric: tabular-nums; display: block; }
.bigbal span { font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.gg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.gg .btn { min-height: 52px; font-size: 1.02rem; }
.sticky-gg { position: sticky; bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); z-index: 5; background: var(--ag-bg); padding: 8px 0; margin: 0; }
@media (min-width: 900px) { .sticky-gg { bottom: 0; } }

/* dialogs and toasts */
.dlg { border: 1px solid var(--ag-line); border-radius: var(--ag-radius-lg); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--ag-raised); color: var(--ag-text); box-shadow: var(--ag-shadow-2); }
.dlg.wide { width: min(980px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(2, 6, 23, .5); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 0 16px; position: sticky; top: 0; background: var(--ag-raised); z-index: 1; }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: 8px 16px; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 16px 16px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--ag-raised); }
@media (max-width: 560px) { .dlg { margin: auto 0 0; width: 100vw; max-width: 100vw; max-height: 92vh; border-radius: 16px 16px 0 0; } .dlg-foot .btn { flex: 1 1 auto; } }
.toasts { position: fixed; z-index: 60; left: 50%; bottom: 96px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast { padding: 10px 12px 10px 14px; border-radius: var(--ag-radius); background: var(--ag-text); color: var(--ag-bg); box-shadow: var(--ag-shadow-2); display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.toast button { background: none; border: 1px solid currentColor; color: inherit; border-radius: 8px; min-height: 44px; padding: 0 12px; font: inherit; font-weight: 700; cursor: pointer; }
.toast.err { background: var(--ag-err); color: #fff; }
@media (min-width: 900px) { .toasts { left: auto; right: 24px; transform: none; bottom: 24px; } }

/* QR, photos */
.qrbox { display: grid; justify-items: center; gap: 8px; margin: 12px 0; text-align: center; }
.qr { background: #fff; border-radius: 8px; max-width: 100%; height: auto; }
.thumb { max-width: 100%; max-height: 50vh; border-radius: var(--ag-radius); display: block; margin: 8px 0; }

/* attendance */
.att { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
/* phones: 7 days of at least 44 px fit in 360 px only when the card uses nearly the full width */
@media (max-width: 420px) { .card.att-card { margin-inline: -12px; padding-inline: 6px; border-radius: 0; border-inline: 0; } .att { gap: 2px; } }
.att .wd { font-size: .72rem; color: var(--ag-muted); text-align: center; }
.att button { min-height: 44px; border-radius: 8px; border: 1px solid var(--ag-line); background: var(--ag-surface); color: var(--ag-text); font: inherit; cursor: pointer; display: grid; place-items: center; line-height: 1.1; padding: 2px; }
.att button small { font-size: .7rem; font-weight: 700; }
.att button.P { background: var(--ag-ok-soft); color: var(--ag-ok-ink); border-color: color-mix(in srgb, var(--ag-ok) 40%, transparent); }
.att button.A { background: var(--ag-err-soft); color: var(--ag-err); border-color: color-mix(in srgb, var(--ag-err) 40%, transparent); }
.att button.H { background: color-mix(in srgb, var(--ag-warn) 14%, transparent); color: var(--ag-warn); }
.att button.today { outline: 2px solid var(--ag-accent); }

/* charts */
.chart { width: 100%; height: auto; max-height: 280px; display: block; }
.chart text { fill: var(--ag-muted); font: 12px var(--ag-font); }
.chart .bar { fill: var(--ag-accent); }
.chart .bar2 { fill: var(--ag-ok); }
.hbar { display: grid; grid-template-columns: minmax(6em, 10em) 1fr auto; gap: 8px; align-items: center; margin: 6px 0; font-size: .92rem; }
.hbar .track { height: 12px; border-radius: 6px; background: var(--ag-accent-soft); overflow: hidden; }
.hbar .fill { display: block; height: 100%; background: var(--ag-accent); border-radius: 6px; }
.hbar span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* bill editor */
.bline { display: grid; grid-template-columns: 2fr .8fr .8fr 1fr .7fr .7fr 1fr 44px; gap: 6px; align-items: end; padding: 8px 0; border-bottom: 1px solid var(--ag-line); }
.bline .field { margin: 0; }
.bline .field > span { font-size: .78rem; font-weight: 600; }
.bline .lt { text-align: right; font-weight: 700; padding-bottom: 10px; font-variant-numeric: tabular-nums; }
@media (max-width: 899px) { .bline { grid-template-columns: 1fr 1fr 1fr; } .bline .nm { grid-column: 1 / -1; } .bline .lt { grid-column: 1 / 3; text-align: left; } }
.totals { margin-left: auto; max-width: 380px; }

/* lock screen */
.lock { position: fixed; inset: 0; z-index: 90; background: var(--ag-bg); display: grid; place-items: center; padding: 16px; }
.lock .card { width: min(360px, 100%); text-align: center; }
.pinrow { font-size: 1.6rem; letter-spacing: .4em; text-align: center; }

/* share page */
.share-head { display: grid; gap: 4px; text-align: center; padding: 12px 0; }
.share-bal { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* menus (More) */
.menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.menu a, .menu button { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--ag-radius-lg); background: var(--ag-surface); border: 1px solid var(--ag-line); color: var(--ag-text); min-height: 56px; font: inherit; text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover { text-decoration: none; background: var(--ag-accent-soft); }
.menu .mi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--ag-accent-soft); color: var(--ag-accent); flex: none; }
.menu small { display: block; color: var(--ag-muted); }
.hero { padding: 28px 0 12px; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); max-width: 22ch; }
.lead { color: var(--ag-muted); font-size: 1.05rem; max-width: 60ch; }
.feat { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 16px 0; }
.feat .card { margin: 0; }
.feat .card .mi { color: var(--ag-accent); }
.ag-india-row { display: flex; justify-content: center; padding: 8px 0; }
@media print { body { background: #fff; } .topbar, .botbar, .foot, .noprint, .toasts { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
/* a plain list (reminder history, stock moves, advances, audit rows): no bullets, rows split by a line */
ul.plain { list-style: none; margin: 8px 0 0; padding: 0; }
ul.plain > li { padding: 8px 0; border-bottom: 1px solid var(--ag-line); gap: 8px; }
ul.plain > li:last-child { border-bottom: 0; }
ul.plain > li.row { flex-wrap: nowrap; }
ul.plain > li.row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
/* ‹ date › on the cashbook: one line, the date box only as wide as a date */
.daynav { flex-wrap: nowrap; } .daynav .inp { width: 11.5em; flex: 0 1 auto; min-width: 0; }
