:root {
  --night: #0b2f29;
  --night-2: #123f37;
  --emerald: #0f5c4a;
  --emerald-dark: #0a4537;
  --brass: #c9a24f;
  --brass-light: #e6c777;
  --brass-ink: #8a6a22;
  --paper: #f7f2e7;
  --paper-2: #fffdf8;
  --rule: #e2d9c4;
  --ink: #1c2a26;
  --muted: #5c6a64;
  --on-night: #f4efe2;
  --on-night-2: #bfd0c8;
  --ok-bg: #dcefe4; --ok-ink: #0a4537;
  --wait-bg: #fbeecb; --wait-ink: #6e4f0c;
  --no-bg: #f9e0db; --no-ink: #8f2617;
  --display: "Tiro Devanagari Hindi", "Nirmala UI", "Mangal", serif;
  --body: "Mukta", "Nirmala UI", "Noto Sans Devanagari", "Mangal", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.6 var(--body); }
h1, h2, h3 { margin: 0; font-weight: 400; }
h2 { font: 400 clamp(1.8rem, 5vw, 2.6rem)/1.2 var(--display); }
h3 { font: 700 1.05rem/1.4 var(--body); }
a { color: inherit; }
.shell { max-width: 1080px; margin: 0 auto; padding-inline: 16px; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.eyebrow { margin: 0 0 8px; font-size: .86rem; font-weight: 700; letter-spacing: .08em; color: var(--brass-light); }
.eyebrow.dark { color: var(--brass-ink); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 24px;
  font: 700 1rem/1.2 var(--body); text-decoration: none; cursor: pointer; border: 1px solid transparent; border-radius: 4px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn.brass { background: var(--brass-light); color: #2b2206; border-color: var(--brass-light); }
.btn.brass:hover { background: #f1d78f; }
.btn.line { background: transparent; color: var(--on-night); border-color: rgba(244, 239, 226, .55); }
.btn.line:hover { background: rgba(244, 239, 226, .12); }
.btn.emerald { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.btn.emerald:hover { background: var(--emerald-dark); }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: .92rem; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }

/* ---- hero ---- */
.hero { position: relative; background: var(--night); color: var(--on-night); }
.hero-img { display: block; width: 100%; height: auto; aspect-ratio: 5 / 4; object-fit: cover; object-position: 50% 30%; }
.hero-body { position: relative; padding: 4px 16px 30px; margin-top: -56px; background: linear-gradient(to bottom, transparent, var(--night) 56px); }
.hero h1 { font: 400 clamp(2.7rem, 12vw, 5.4rem)/1.08 var(--display); }
.hero-lead { max-width: 30em; margin: 12px 0 0; color: var(--on-night-2); font-size: 1.08rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.pulse { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--night-2) url(/pattern.svg); color: var(--on-night); border-block: 1px solid rgba(201, 162, 79, .45); }
.pulse > div { padding: 14px 10px; min-width: 0; text-align: center; background: rgba(11, 47, 41, .86); }
.pulse > div + div { border-inline-start: 1px solid rgba(201, 162, 79, .3); }
.pulse span { display: block; font-size: .8rem; line-height: 1.3; color: var(--on-night-2); }
.pulse b { display: block; margin-top: 2px; font: 400 clamp(1.15rem, 5vw, 1.9rem)/1.2 var(--display); overflow-wrap: anywhere; }

/* ---- giving ---- */
.give { padding: 44px 0 52px; }
.stars { list-style: none; display: grid; gap: 28px; margin: 30px 0 34px; padding: 0 10px; }
.stars li { display: flex; align-items: center; gap: 22px; }
.stars i {
  position: relative; flex: none; display: grid; place-items: center; width: 46px; height: 46px;
  font: 400 1.25rem/1 var(--display); color: var(--on-night); background: var(--emerald); isolation: isolate;
}
.stars i::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--emerald); transform: rotate(45deg); }
.stars b { display: block; line-height: 1.3; }
.stars span { display: block; color: var(--muted); font-size: .93rem; line-height: 1.35; }

.give-grid { display: grid; gap: 22px; }

.niche-frame, .niche {
  clip-path: polygon(0.0% 100.0%, 0.0% 24.0%, 0.4% 21.5%, 1.7% 19.2%, 3.7% 17.1%, 6.4% 15.0%, 9.7% 13.2%, 13.4% 11.4%, 17.5% 9.8%, 21.9% 8.2%, 26.6% 6.7%, 31.3% 5.3%, 36.2% 3.9%, 40.9% 2.6%, 45.6% 1.3%, 50.0% 0.0%, 54.4% 1.3%, 59.1% 2.6%, 63.8% 3.9%, 68.7% 5.3%, 73.4% 6.7%, 78.1% 8.2%, 82.5% 9.8%, 86.6% 11.4%, 90.3% 13.2%, 93.6% 15.0%, 96.3% 17.1%, 98.3% 19.2%, 99.6% 21.5%, 100.0% 24.0%, 100.0% 100.0%);
}
.niche-frame { padding: 3px 3px 0; background: var(--brass); }
.niche {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 14px; height: 100%; min-height: 520px;
  padding: 118px 22px 28px; color: var(--on-night); text-align: center;
  background: linear-gradient(rgba(11, 47, 41, .9), rgba(11, 47, 41, .96)), var(--night) url(/pattern.svg);
}
.niche-title { margin: 0; font: 400 1.5rem/1.2 var(--display); }
.qr-tile { display: grid; place-items: center; width: min(100%, 264px); aspect-ratio: 1; padding: 12px; background: #fff; border-radius: 4px; }
.qr-tile img { display: block; width: 100%; height: auto; }
.qr-missing { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.4; }
.niche-note { margin: 0; max-width: 24em; font-size: .86rem; line-height: 1.4; color: var(--on-night-2); }

.sheet { padding: 24px 20px; background: var(--paper-2); border: 1px solid var(--rule); border-top: 4px solid var(--emerald); }
.sheet h3 { font: 400 1.5rem/1.25 var(--display); }
label { display: block; margin: 16px 0 5px; font-weight: 500; font-size: .95rem; }
input { width: 100%; min-height: 48px; padding: 10px 12px; font: 400 1.05rem/1.3 var(--body); color: var(--ink); background: #fff; border: 1px solid #b4ad9b; border-radius: 4px; }
input:focus { border-color: var(--emerald); }

.drop { position: relative; display: flex; align-items: center; gap: 14px; min-height: 96px; padding: 12px 14px; background: var(--paper); border: 1.5px dashed #a39b85; border-radius: 4px; transition: border-color .15s, background-color .15s; }
.drop:hover, .drop:focus-within { border-color: var(--emerald); background: #f1efe2; }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; opacity: 0; cursor: pointer; }
.drop:focus-within { outline: 3px solid var(--brass); outline-offset: 2px; }
.drop p { margin: 0; line-height: 1.35; overflow-wrap: anywhere; min-width: 0; }
.drop p span { font-size: .85rem; color: var(--muted); }
.preview { flex: none; width: 60px; height: 76px; object-fit: cover; border: 1px solid var(--rule); border-radius: 3px; }

.sheet .btn { margin-top: 18px; }
.fine { margin: 12px 0 0; font-size: .85rem; line-height: 1.45; color: var(--muted); }
.msg { margin: 12px 0 0; padding: 10px 12px; border-radius: 4px; line-height: 1.45; }
.msg.good { color: var(--ok-ink); background: var(--ok-bg); }
.msg.bad { color: var(--no-ink); background: var(--no-bg); }

/* ---- status ---- */
.check { padding: 46px 0 50px; color: var(--on-night); background: linear-gradient(rgba(11, 47, 41, .93), rgba(11, 47, 41, .93)), var(--night) url(/pattern.svg); }
.check-grid { display: grid; gap: 20px; }
.check-lead { margin: 8px 0 18px; color: var(--on-night-2); }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.months { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; margin: 0; padding: 0; }
.months li { padding: 9px 11px; font-size: .9rem; line-height: 1.3; border-radius: 3px; }
.months span, .months b { display: block; }
.months b { font-weight: 700; }
.ok { background: var(--ok-bg); color: var(--ok-ink); }
.wait { background: var(--wait-bg); color: var(--wait-ink); }
.no { background: var(--no-bg); color: var(--no-ink); }
.none { background: rgba(244, 239, 226, .1); color: var(--on-night-2); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; font-size: .8rem; }
.legend li { padding: 2px 9px; border-radius: 3px; }

/* ---- ledger ---- */
.ledger-wrap { padding: 50px 0 60px; }
.ledger-lead { max-width: 40em; margin: 10px 0 22px; color: var(--muted); }
.ledger { background: var(--paper-2); border: 1px solid var(--rule); border-inline-start: 5px solid var(--emerald); }
.ledger-totals { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 3px double var(--ink); }
.ledger-totals > div { padding: 16px 12px; min-width: 0; }
.ledger-totals > div + div { border-inline-start: 1px solid var(--rule); }
.ledger-totals span { display: block; font-size: .85rem; color: var(--muted); }
.ledger-totals b { display: block; font: 400 clamp(1.25rem, 5vw, 2.1rem)/1.2 var(--display); overflow-wrap: anywhere; }
.ledger-totals .sum b { color: var(--emerald); }
.ledger-cols { display: grid; gap: 26px; padding: 22px 14px 26px; }
.ledger-cols h3 { margin-bottom: 6px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .98rem; }
th, td { padding: 9px 8px; text-align: start; border-bottom: 1px solid var(--rule); }
th { font-size: .82rem; font-weight: 500; color: var(--muted); border-bottom: 1.5px solid var(--ink); }
.n { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { margin: 8px 0 0; padding: 14px 0; color: var(--muted); border-block: 1px solid var(--rule); }

/* ---- footer ---- */
.foot { padding: 26px 0 30px; color: var(--on-night); background: var(--night); border-top: 3px solid var(--brass); }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 24px; }
.foot b { display: block; font: 400 1.25rem/1.3 var(--display); }
.foot span { font-size: .82rem; color: var(--on-night-2); }
.foot a { display: inline-block; padding: 8px 0; font-size: .92rem; color: var(--brass-light); }

/* ---- khajanchi panel ---- */
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; color: var(--on-night); background: var(--night); border-bottom: 3px solid var(--brass); }
.bar b { font: 400 1.3rem/1.2 var(--display); }
.bar .link { color: var(--on-night); }
.card { padding: 18px 16px; margin-bottom: 14px; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 4px; }
.card h2 { margin: 0 0 10px; font: 400 1.45rem/1.25 var(--display); }
.card .btn, .review .btn { margin-top: 14px; }
.btn:not(.brass, .line, .emerald, .ghost, .wa) { color: #fff; background: var(--emerald); border-color: var(--emerald); }
.btn:not(.brass, .line, .emerald, .ghost, .wa):hover { background: var(--emerald-dark); }
.btn.ghost { color: var(--emerald); background: transparent; border-color: var(--emerald); }
.btn.ghost:hover { background: var(--ok-bg); }
.btn.wa { min-height: 42px; margin: 0; padding: 7px 12px; font-size: .9rem; color: #fff; background: #157347; border-color: #157347; }
.btn.wa:hover { background: #0f5c38; }
.link { padding: 6px; font: inherit; font-size: .9rem; color: var(--emerald); background: none; border: 0; text-decoration: underline; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.totals.two { grid-template-columns: repeat(2, 1fr); margin-top: 14px; }
.totals div { min-width: 0; padding: 10px; background: var(--paper); border-radius: 3px; }
.totals span { display: block; font-size: .85rem; color: var(--muted); }
.totals b { display: block; font: 400 1.3rem/1.25 var(--display); overflow-wrap: anywhere; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { flex: 1; min-height: 46px; padding: 8px 6px; font: 500 1rem var(--body); color: var(--ink); background: var(--paper-2); border: 1px solid var(--rule); border-radius: 4px; cursor: pointer; }
.tabs button[aria-pressed="true"] { color: #fff; background: var(--emerald); border-color: var(--emerald); }
.pill { display: inline-block; min-width: 22px; padding: 0 6px; font-size: .8rem; text-align: center; color: #2b2206; background: var(--brass-light); border-radius: 11px; }
.review .shot { display: block; margin-bottom: 8px; }
.review .shot img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: var(--paper); border-radius: 3px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.people, .entries { list-style: none; margin: 0; padding: 0; }
.people li, .entries li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.people li:last-child, .entries li:last-child { border-bottom: 0; }
.people li > div, .entries li > div { min-width: 0; overflow-wrap: anywhere; }
.people .paid b { color: var(--emerald-dark); }
.people .wait, .people .paid, .people .due { background: none; color: inherit; }
.people .wait .row span { color: var(--wait-ink); font-size: .9rem; }

/* ---- wider screens ---- */
@media (min-width: 620px) {
  .review { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
  .stars { grid-template-columns: repeat(3, 1fr); gap: 20px; }
}

@media (min-width: 860px) {
  .hero { display: grid; grid-template-columns: minmax(0, 40fr) minmax(0, 60fr); min-height: min(86vh, 720px); }
  .hero-img { grid-column: 2; grid-row: 1; aspect-ratio: auto; width: 100%; height: 100%; min-height: 0; object-position: 50% 42%; }
  .hero::after { content: ""; grid-column: 2; grid-row: 1; width: 170px; background: linear-gradient(to right, var(--night), transparent); }
  .hero-body { grid-column: 1; grid-row: 1; align-self: center; margin: 0; padding-block: 40px; padding-inline: max(32px, calc((100vw - 1048px) / 2)) 12px; background: none; }
  .hero h1 { font-size: clamp(3rem, 5.6vw, 5rem); }
  .pulse > div { padding: 18px 12px; }
  .give { padding: 72px 0 80px; }
  .give-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 36px; align-items: stretch; }
  .sheet { padding: 34px 32px; align-self: end; }
  .check { padding: 72px 0; }
  .check-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px 36px; align-items: start; }
  .months { grid-template-columns: repeat(3, 1fr); grid-column: 2; grid-row: 1 / span 2; }
  .legend { grid-column: 1; }
  .ledger-wrap { padding: 76px 0 90px; }
  .ledger-cols { grid-template-columns: 2fr 3fr; gap: 40px; padding: 28px 30px 34px; }
  .ledger-totals > div { padding: 22px 30px; }
}

/* ---- language switch ---- */
.lang { position: absolute; z-index: 5; top: 12px; inset-inline-end: 12px; display: flex; padding: 3px; background: rgba(6, 28, 26, .78); border: 1px solid rgba(230, 199, 119, .55); border-radius: 6px; }
.lang button { min-width: 62px; min-height: 40px; padding: 4px 12px; font: 500 .95rem/1.2 var(--body); color: var(--on-night); background: none; border: 0; border-radius: 4px; cursor: pointer; }
.lang button[lang="ur"] { font-family: "Noto Nastaliq Urdu", serif; font-size: .9rem; line-height: 1.6; }
.lang button[aria-pressed="true"] { color: #2b2206; background: var(--brass-light); }

/* ---- months ---- */
.tap-hint { margin: 0 0 10px; font-size: .88rem; color: var(--muted); }
.month-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.month-list > li { border-bottom: 1px solid var(--rule); }
.month-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; width: 100%; min-height: 54px; padding: 10px 6px; font: inherit; color: inherit; text-align: start; background: none; border: 0; cursor: pointer; }
.month-row:hover { background: var(--paper); }
.m-name { flex: 1 1 auto; font-weight: 500; }
.month-row small { order: 3; flex-basis: 100%; font-size: .82rem; color: var(--muted); }
.month-row b { font: 400 1.2rem/1.2 var(--display); font-variant-numeric: tabular-nums; }
.month-row i { width: 9px; height: 9px; border-inline-end: 2px solid var(--emerald); border-block-end: 2px solid var(--emerald); transform: rotate(45deg); transition: transform .15s; }
.month-row[aria-expanded="true"] { background: var(--ok-bg); }
.month-row[aria-expanded="true"] i { transform: rotate(-135deg); }
.month-panel { padding: 6px 6px 14px; background: var(--paper); }
.month-panel .count { margin: 6px 0 2px; font-size: .85rem; color: var(--muted); }
.month-panel .empty { border: 0; }
.month-panel h4 { margin: 14px 0 2px; font-size: .95rem; }
.givers { list-style: none; margin: 0; padding: 0; }
.givers li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px dotted #c9c1ac; }
.givers span { min-width: 0; overflow-wrap: anywhere; }
.givers small { color: var(--muted); }
.givers b { flex: none; font-variant-numeric: tabular-nums; }
.givers .summary span { font-style: italic; color: var(--muted); }
.giver-total { display: flex; justify-content: space-between; padding: 9px 0 0; font-weight: 700; border-top: 3px double var(--ink); }

/* ---- Urdu ---- */
html[lang="ur"] { --display: "Noto Nastaliq Urdu", serif; --body: "Noto Nastaliq Urdu", "Mukta", serif; }
html[lang="ur"] body { font-size: 15.5px; line-height: 2.1; }
html[lang="ur"] .eyebrow { letter-spacing: 0; }
html[lang="ur"] h1 { line-height: 1.75; font-size: clamp(2rem, 8vw, 3.6rem); }
html[lang="ur"] h2 { line-height: 1.8; font-size: clamp(1.45rem, 4vw, 2.1rem); }
html[lang="ur"] .sheet h3 { line-height: 1.9; font-size: 1.25rem; }
html[lang="ur"] .btn { line-height: 2; padding-block: 6px; font-size: .92rem; }
html[lang="ur"] input { line-height: 1.8; }
html[lang="ur"] input[dir="ltr"], html[lang="ur"] .givers span, html[lang="ur"] .givers b,
html[lang="ur"] .pulse b, html[lang="ur"] .ledger-totals b, html[lang="ur"] .month-row b, html[lang="ur"] .totals b { font-family: "Mukta", sans-serif; font-weight: 500; }
html[lang="ur"] .pulse span, html[lang="ur"] .ledger-totals span { line-height: 1.9; }
html[lang="ur"] .givers .summary span { font-family: var(--body); font-style: normal; }
html[lang="ur"] .niche-title { line-height: 1.9; }
html[dir="rtl"] .stars i::after { transform: rotate(45deg); }
@media (min-width: 860px) {
  html[dir="rtl"] .hero::after { background: linear-gradient(to left, var(--night), transparent); }
}
