/* रामलीला और ख़र्च ऐप का साझा मोबाइल-first डिज़ाइन। रंग हर ऐप की theme.css में। */
:root {
    --brand: #4f46e5; --brand-dark: #3f37c9; --brand-soft: #eef0ff; --on-brand: #fff;
    --bg: #f5f6f8; --card: #fff; --text: #1d2433; --muted: #5d6677; --line: #e4e7ec;
    --good: #15803d; --good-soft: #e8f7ee; --bad: #c62828; --bad-soft: #fdecec; --warn-soft: #fff5dc;
    --radius: 18px; --tap: 50px;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #11141a; --card: #1b2029; --text: #eef1f6; --muted: #a4adbd; --line: #2d3440; --brand-soft: #262a45; --good: #4ade80; --good-soft: #17301f; --bad: #f87171; --bad-soft: #3a1e1e; --warn-soft: #3a3016; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 "Noto Sans Devanagari", "Nirmala UI", system-ui, -apple-system, sans-serif; }
body.with-nav { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
a { color: var(--brand); }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 18px; line-height: 1.6; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); background: var(--brand); color: var(--on-brand); }
.top h1 { flex: 1; font-size: 19px; line-height: 1.6; }
.top-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,.18); color: inherit; font-size: 22px; text-decoration: none; }
.top-end { font-size: 13px; background: rgba(0,0,0,.25); padding: 2px 10px; border-radius: 99px; }

.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 14px; display: grid; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap-row { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.center { text-align: center; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 25px; line-height: 1.5; }
.stat span { font-size: 14px; color: var(--muted); }
.stat.good b { color: var(--good); }
.stat.bad b { color: var(--bad); }
.stat.brand { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.stat.brand span { color: inherit; opacity: .9; }

label.f { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); font: inherit; font-size: 17px; line-height: 1.6; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
input[type=checkbox] { width: 26px; height: 26px; min-height: 0; accent-color: var(--brand); flex: none; }
input.amount { font-size: 30px; font-weight: 700; color: var(--bad); }
form.stack { display: grid; gap: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 18px; border: 0; border-radius: 14px; background: var(--brand); color: var(--on-brand); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.line { background: transparent; border: 1.5px solid var(--line); color: var(--text); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.mini { min-height: 42px; padding: 6px 14px; font-size: 15px; }
.sticky-save { position: sticky; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 20; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 6px 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 15px; text-decoration: none; cursor: pointer; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.badge { display: inline-block; padding: 0 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 600; line-height: 1.8; }
.badge.gray { background: var(--bg); color: var(--muted); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.list { display: grid; gap: 10px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; display: grid; gap: 8px; }
.ava { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 20px; object-fit: cover; }
.ava.round { border-radius: 50%; }
.ava.big { width: 72px; height: 72px; font-size: 26px; }
.center > .ava { margin-inline: auto; }
details summary { list-style: none; cursor: pointer; margin-bottom: 10px; }
details summary::-webkit-details-marker { display: none; }
.ava.bad { background: var(--bad-soft); color: var(--bad); }
.ava.good { background: var(--good-soft); color: var(--good); }
.amt { font-weight: 700; font-size: 18px; white-space: nowrap; }
.amt.bad { color: var(--bad); }
.amt.good { color: var(--good); }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 34px 14px; }

.bar-track { fill: var(--line); }
.bar-a { fill: var(--brand); }
.bar-b { fill: var(--bad); }
.bar-over { fill: var(--bad); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }

nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: space-around; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
nav.bottom a { flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1.5; }
nav.bottom .ic { font-size: 22px; line-height: 1.3; }
nav.bottom a.on { color: var(--brand); font-weight: 700; }
nav.bottom a.fab .ic { display: grid; place-items: center; width: 56px; height: 56px; margin-top: -26px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-size: 30px; border: 4px solid var(--bg); }

body.bare { display: grid; min-height: 100vh; place-items: center; background: var(--brand); }
body.bare .wrap { max-width: 420px; }
.login-logo { width: 88px; height: 88px; border-radius: 50%; margin: 0 auto; object-fit: cover; }

.toast { position: fixed; left: 14px; right: 14px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60; max-width: 520px; margin: 0 auto; padding: 13px 16px; border-radius: 14px; background: #1d2433; color: #fff; text-align: center; }
.toast.bad { background: var(--bad); color: #fff; }
.sheet-bg { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.45); }
.sheet { width: 100%; max-width: 520px; background: var(--card); border-radius: 22px 22px 0 0; padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.sheet .acts { display: grid; grid-template-columns: 1fr 1fr; }
.notice-box { background: var(--warn-soft); border-radius: var(--radius); padding: 14px; }

@media (min-width: 900px) {
    body.with-nav { padding-bottom: 20px; padding-top: 0; }
    .wrap { max-width: 860px; }
    nav.bottom { position: sticky; top: 58px; bottom: auto; justify-content: center; gap: 8px; border-top: 0; border-bottom: 1px solid var(--line); padding: 4px; order: -1; }
    nav.bottom a { flex: 0 0 110px; }
    nav.bottom a.fab .ic { width: 36px; height: 36px; margin: 0; font-size: 22px; border: 0; }
    .sticky-save { bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
    .top, nav.bottom, .no-print, .toast { display: none !important; }
    body { background: #fff; color: #000; padding: 0 !important; }
    .wrap { max-width: none; }
    .item, .stat, .card { break-inside: avoid; }
}
