/* Hisab Kitab v2.7 - Developed by Govind Jangra · SEO Lands */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #f1ede6;
  --ink: #1d2422;
  --ink-2: #55605c;
  --ink-3: #8a938f;
  --line: #e4ded4;
  --brand: #0b5d56;
  --brand-2: #0e766d;
  --brand-soft: #e2f1ee;
  --accent: #e8891c;
  --accent-soft: #fdf0de;
  --red: #c2410c;
  --red-soft: #fdece4;
  --green: #15803d;
  --green-soft: #e3f4e8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(30, 25, 15, .06), 0 4px 14px rgba(30, 25, 15, .06);
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111615; --surface: #1a201f; --surface-2: #222a28; --ink: #ecf0ee; --ink-2: #a9b4b0; --ink-3: #75817c;
    --line: #2c3533; --brand: #3fb5a8; --brand-2: #52c4b7; --brand-soft: #173430; --accent: #f0a043; --accent-soft: #3a2a14;
    --red: #f2895c; --red-soft: #3b2219; --green: #5bc985; --green-soft: #17311f; --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --switch-off: #3a4441;
  --bg: #111615; --surface: #1a201f; --surface-2: #222a28; --ink: #ecf0ee; --ink-2: #a9b4b0; --ink-3: #75817c;
  --line: #2c3533; --brand: #3fb5a8; --brand-2: #52c4b7; --brand-soft: #173430; --accent: #f0a043; --accent-soft: #3a2a14;
  --red: #f2895c; --red-soft: #3b2219; --green: #5bc985; --green-soft: #17311f; --shadow: 0 1px 2px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }
.view { padding: 12px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); }
.view.no-tabs { padding-bottom: 32px; }

.splash { min-height: 80vh; display: grid; place-content: center; text-align: center; color: var(--ink-2); }
.logo-big { width: 76px; height: 76px; border-radius: 22px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 40px; font-weight: 700; margin: 0 auto 10px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 10px 16px 6px; display: flex; align-items: center; gap: 10px; }
.topbar h1 { font-size: 19px; margin: 0; flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 0; text-align: left; cursor: pointer; }
.book-btn .bname { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-btn .chev { color: var(--ink-3); font-size: 13px; }
.member-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 10px 5px 5px; font-size: 14px; cursor: pointer; max-width: 46%; }
.member-chip .dot, .avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.member-chip span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; font-size: 20px; color: var(--ink); }
.icon-btn:active { background: var(--surface-2); }
.offline-pill { font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 9px; font-weight: 600; }

/* tab bar */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--ink-3); font-size: 11.5px; font-weight: 600; padding: 6px 0; }
.tabbar a .ti { font-size: 21px; line-height: 1; filter: grayscale(1); opacity: .8; }
.tabbar a.on { color: var(--brand); }
.tabbar a.on .ti { filter: none; opacity: 1; }
.tabbar .fab { justify-self: center; width: 58px; height: 58px; margin-top: -26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 32px; font-weight: 400;
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(11, 93, 86, .35); border: 4px solid var(--bg); text-decoration: none; }

/* generic */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 8px; }
.section-title h2 { font-size: 15px; margin: 0; color: var(--ink-2); font-weight: 700; letter-spacing: .01em; }
.section-title a, .link-btn { font-size: 14px; color: var(--brand); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 4px; font-weight: 600; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.red { color: var(--red); }
.green { color: var(--green); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; color: var(--ink-3); padding: 28px 12px; }
.empty .big { font-size: 38px; display: block; margin-bottom: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; cursor: pointer; background: var(--brand); color: #fff; min-height: 48px; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* month switcher */
.month-sw { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); margin-bottom: 12px; }
.month-sw button { border: 0; background: transparent; width: 40px; height: 36px; border-radius: 999px; font-size: 18px; cursor: pointer; color: var(--ink-2); }
.month-sw button:disabled { opacity: .3; }
.month-sw .mlabel { flex: 1; min-width: 0; font-weight: 700; border: 0; background: transparent; cursor: pointer; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-sw > span, .month-sw > button[data-d] { flex: none; }

/* summary */
.hero { background: linear-gradient(145deg, var(--brand) 0%, #0a4a44 100%); color: #fff; border-radius: 20px; padding: 18px; margin-bottom: 12px; position: relative; overflow: hidden; }
:root[data-theme="dark"] .hero { background: linear-gradient(145deg, #145b54, #0c3a36); }
.hero .lbl { font-size: 13.5px; opacity: .85; }
.hero .amt { font-size: 34px; font-weight: 800; letter-spacing: -.01em; margin: 2px 0 10px; }
.hero .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hero .grid3 div { background: rgba(255, 255, 255, .12); border-radius: 12px; padding: 8px 10px; }
.hero .grid3 b { display: block; font-size: 15px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .grid3 small { font-size: 11.5px; opacity: .85; }
.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; background: #ffd08a; border-radius: 99px; }
.bar.light { background: var(--surface-2); }
.bar.light i { background: var(--brand); }
.bar.over i { background: var(--red) !important; }

/* quick categories */
.qgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.qcat { background: var(--surface); border: 0; border-radius: 14px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; box-shadow: var(--shadow); min-width: 0; }
.qcat .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; }
.qcat .nm { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qcat.sel { outline: 2.5px solid var(--brand); }

/* entries list */
.day-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); font-weight: 700; margin: 14px 4px 6px; }
.elist { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.eitem { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; background: none; width: 100%; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.eitem:last-child { border-bottom: 0; }
.eitem:active { background: var(--surface-2); }
.eitem .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; }
.eitem .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eitem .t2 { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eitem .amt { font-weight: 700; text-align: right; white-space: nowrap; }
.eitem .amt small { display: block; font-size: 11.5px; font-weight: 600; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); vertical-align: 1px; }
.tag.due { background: var(--red-soft); color: var(--red); }
.tag.ok { background: var(--green-soft); color: var(--green); }
.tag.sync { background: var(--accent-soft); color: var(--accent); }

/* filters */
.searchbox { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 0 12px; box-shadow: var(--shadow); margin-bottom: 10px; }
.searchbox input { border: 0; outline: 0; background: transparent; flex: 1; height: 46px; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px 6px; font-weight: 700; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.kind button.on.exp { color: var(--red); }
.seg.kind button.on.inc { color: var(--green); }
.seg.kind button.on.trf { color: var(--brand); }

.sumstrip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.sumstrip div { background: var(--surface); border-radius: 12px; padding: 9px 10px; box-shadow: var(--shadow); min-width: 0; }
.sumstrip small { font-size: 11.5px; color: var(--ink-3); display: block; }
.sumstrip b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* table view */
.tablewrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
table.ledger { border-collapse: collapse; font-size: 13px; min-width: 760px; width: 100%; }
table.ledger th, table.ledger td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.ledger th { background: var(--surface-2); font-size: 12px; color: var(--ink-2); position: sticky; top: 0; }
table.ledger td.n, table.ledger th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.ledger td.wrap { white-space: normal; min-width: 120px; max-width: 200px; }
table.ledger tr.click { cursor: pointer; }
table.ledger tfoot td { font-weight: 800; background: var(--surface-2); }

/* forms */
.field { margin-bottom: 14px; }
.field > label, .lbl2 { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 0 6px 2px; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 13px; min-height: 48px; outline: none; }
.input:focus { border-color: var(--brand); }
textarea.input { min-height: 74px; resize: vertical; }
.amount-wrap { display: flex; align-items: center; gap: 6px; border: 2px solid var(--line); border-radius: 16px; padding: 4px 14px; background: var(--surface); }
.amount-wrap:focus-within { border-color: var(--brand); }
.amount-wrap .cur { font-size: 28px; font-weight: 700; color: var(--ink-3); }
.amount-wrap input { border: 0; outline: 0; background: transparent; font-size: 32px; font-weight: 800; width: 100%; min-width: 0; padding: 6px 0; }
.calc-hint { font-size: 13px; color: var(--brand); margin: 4px 4px 0; min-height: 18px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3f { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 13px; cursor: pointer; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: var(--switch-off, #b9c1bd); border: 2px solid var(--ink-2); border-radius: 99px; transition: .2s; }
.switch i::after { content: ""; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--brand); border-color: var(--brand); }
.switch input:focus-visible + i { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch-row { color: var(--ink); }
.field > label.switch-row { display: flex; font-size: 15px; font-weight: 400; color: var(--ink); margin: 0; }
.switch-row > span:first-child { flex: 1; min-width: 0; }
.switch-row .tiny { color: var(--ink-2); }
.switch input:checked + i::after { transform: translateX(20px); }
.more-toggle { width: 100%; background: none; border: 1.5px dashed var(--line); color: var(--ink-2); border-radius: 12px; padding: 11px; font-weight: 700; cursor: pointer; margin-bottom: 14px; }
.cat-pick { display: flex; align-items: center; gap: 10px; width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 12px; min-height: 52px; cursor: pointer; text-align: left; }
.cat-pick .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; flex: none; }
.err { color: var(--red); font-size: 13.5px; margin: 6px 2px; min-height: 0; font-weight: 600; }
.sticky-save { position: sticky; bottom: 0; padding: 10px 0 calc(10px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); margin-top: 8px; }
.ac-list { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 0; scrollbar-width: none; }
.ac-list::-webkit-scrollbar { display: none; }
.ac-list button { flex: none; border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 5px 11px; font-size: 13px; cursor: pointer; }

/* auth */
.auth { min-height: 100vh; padding: 28px 20px 40px; display: flex; flex-direction: column; justify-content: center; }
.auth .brand { text-align: center; margin-bottom: 22px; }
.auth .brand h1 { margin: 8px 0 4px; font-size: 26px; }
.auth .brand p { margin: 0; color: var(--ink-2); }
.auth .info { background: var(--brand-soft); color: var(--brand); border-radius: 12px; padding: 11px 13px; font-size: 13.5px; margin-bottom: 16px; font-weight: 600; }
.credit { text-align: center; font-size: 12.5px; color: var(--ink-3); margin-top: 22px; }
.credit b { color: var(--ink-2); }

/* sheets */
.sheet-bg { position: fixed; inset: 0; background: rgba(10, 15, 14, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 88vh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: up .2s ease-out; }
.sheet-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px 8px; }
.sheet-h h3 { margin: 0; font-size: 17px; flex: 1; }
.sheet-b { overflow-y: auto; padding: 4px 16px calc(18px + var(--safe-b)); }
.grabber { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 8px auto 0; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.pick-list { display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.pick-list button { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; width: 100%; }
.pick-list button:last-child { border-bottom: 0; }
.pick-list button.on { background: var(--brand-soft); font-weight: 700; }
.pick-list .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; flex: none; }

/* detail */
.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; font-size: 14.5px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
.big-amt { font-size: 30px; font-weight: 800; }

/* reports */
.donut-wrap { display: flex; gap: 14px; align-items: center; }
.donut-wrap svg { flex: none; }
.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.legend div { display: flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend b { font-variant-numeric: tabular-nums; }
.hbar { margin-bottom: 11px; }
.hbar .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; margin-bottom: 4px; }
.hbar .top span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-box { width: 100%; overflow: hidden; }
.chart-box svg { display: block; width: 100%; height: auto; }

/* settings */
.menu { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.menu a, .menu button { display: flex; align-items: center; gap: 12px; padding: 14px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; text-decoration: none; color: var(--ink); cursor: pointer; font-size: 15.5px; }
.menu a:last-child, .menu button:last-child { border-bottom: 0; }
.menu .mi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); font-size: 18px; flex: none; }
.menu .arrow { color: var(--ink-3); margin-left: auto; }
.menu .danger { color: var(--red); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-row button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.color-row button.on { border-color: var(--ink); }
.emoji-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-row button { aspect-ratio: 1; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 20px; cursor: pointer; padding: 0; }
.emoji-row button.on { border-color: var(--brand); background: var(--brand-soft); }

.due-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.due-item:last-child { border-bottom: 0; }
.due-item .right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); transform: translateX(-50%) translateY(20px); background: #1d2422; color: #fff;
  padding: 11px 18px; border-radius: 12px; font-size: 14.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--red); }

.loading { text-align: center; padding: 30px; color: var(--ink-3); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 420px) { .qgrid { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.lang-sw { width: auto; padding: 3px; }
.lang-sw button { padding: 6px 14px; flex: none; font-size: 13.5px; }

/* guide */
details.guide { padding: 0; overflow: hidden; }
details.guide summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px; cursor: pointer; font-size: 15px; }
details.guide summary::-webkit-details-marker { display: none; }
details.guide summary::after { content: "▾"; margin-left: auto; color: var(--ink-3); transition: .2s; }
details.guide[open] summary::after { transform: rotate(180deg); }
details.guide .gic { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); display: grid; place-items: center; font-size: 19px; flex: none; }
details.guide ol { margin: 0; padding: 0 16px 14px 42px; color: var(--ink-2); line-height: 1.55; }
details.guide li { margin-bottom: 6px; }
/* dark mode polish */
:root[data-theme="dark"] .toast { background: #ecf0ee; color: #111615; }
:root[data-theme="dark"] .toast.err { background: var(--red); color: #111; }
:root[data-theme="dark"] .info { background: var(--brand-soft); color: var(--brand-2); }
:root[data-theme="dark"] .btn.accent, :root[data-theme="dark"] .btn:not(.ghost):not(.outline):not(.danger) { color: #0b1a18; }
:root[data-theme="dark"] .tabbar .fab { color: #0b1a18; }
:root[data-theme="dark"] .logo-big { color: #0b1a18; }
:root[data-theme="dark"] .chip.on { color: #0b1a18; }
:root[data-theme="dark"] .bar i { background: #ffd08a; }
:root[data-theme="dark"] .bar.light i { background: var(--brand); }
.seg button { white-space: nowrap; }

/* ================= UI refresh 2.2 - calmer colours, clearer hierarchy, smoother touch feedback ================= */
:root {
  --bg: #f3f5f2; --surface-2: #eef1ed; --line: #e2e6e1;
  --ink: #15201d; --ink-2: #4b5753; --ink-3: #838e89;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 24, 22, .05), 0 8px 24px -8px rgba(16, 24, 22, .10);
  --shadow-lg: 0 18px 40px -12px rgba(16, 24, 22, .28);
  --ring: 0 0 0 4px rgba(11, 93, 86, .16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
}
html { -webkit-tap-highlight-color: transparent; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; letter-spacing: -.005em; }
.num, .hero, .val { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.topbar { background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: saturate(170%) blur(14px); backdrop-filter: saturate(170%) blur(14px); padding-top: 12px; padding-bottom: 8px; }
.topbar h1 { font-weight: 750; letter-spacing: -.02em; }
.icon-btn { transition: transform .12s ease, background .2s ease; }
.icon-btn:active { transform: scale(.94); }

.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; }
.section-title h2 { font-weight: 700; letter-spacing: -.01em; }

.hero { border-radius: 24px; padding: 20px; background: radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, 0) 46%), linear-gradient(150deg, #0f7d72 0%, #0b5d56 48%, #073c37 100%); box-shadow: 0 18px 34px -16px rgba(11, 93, 86, .65); }

.btn { border-radius: 14px; font-weight: 650; letter-spacing: .005em; transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease, opacity .2s ease; }
.btn:not(.ghost):not(.outline):not(.danger):not(.accent) { background: linear-gradient(180deg, var(--brand-2) 0%, var(--brand) 100%); box-shadow: 0 8px 18px -8px rgba(11, 93, 86, .7); }
.btn:active { transform: scale(.98); }
.btn:disabled { box-shadow: none; }
.btn.ghost { background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16, 24, 22, .04); }
.btn.danger { box-shadow: 0 8px 18px -10px rgba(194, 65, 12, .7); }
.btn.accent { box-shadow: 0 8px 18px -10px rgba(232, 137, 28, .8); }

.input, input.input, select.input, textarea.input { border-radius: 13px; border: 1.5px solid var(--line); background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease; }
.input:focus, input.input:focus, select.input:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.field label { font-weight: 650; letter-spacing: .01em; }

.menu { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tag { border-radius: 999px; font-weight: 650; }

.tabbar { background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: saturate(170%) blur(18px); backdrop-filter: saturate(170%) blur(18px); box-shadow: 0 -8px 28px -14px rgba(16, 24, 22, .25); }
.tabbar a { position: relative; transition: color .15s ease; }
.tabbar a.on::before { content: ""; position: absolute; top: 0; left: 50%; width: 26px; height: 3px; margin-left: -13px; border-radius: 0 0 4px 4px; background: var(--brand); }
.tabbar .fab { background: linear-gradient(160deg, var(--brand-2) 0%, var(--brand) 100%); box-shadow: 0 12px 24px -8px rgba(11, 93, 86, .6); transition: transform .12s ease; }
.tabbar .fab:active { transform: scale(.94); }

.sheet { border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg); }
.toast { border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* v2.5 - language picker + right-to-left (Urdu / Arabic) */
.lang-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.lang-sel { font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 230px; }
html[dir="rtl"] .arrow { display: inline-block; transform: scaleX(-1); }
html[dir="rtl"] input[type="number"], html[dir="rtl"] input[inputmode="decimal"], html[dir="rtl"] .amt, html[dir="rtl"] .money { direction: ltr; unicode-bidi: plaintext; }

/* App feel: no tap highlight. Zoom, pull-to-refresh and text selection stay on. */
html, body { -webkit-tap-highlight-color: transparent; }


/* ---- Fonts: Mukta (Ek Type, OFL) self-hosted so the app looks the same offline ---- */
@font-face { font-family: "Mukta"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/mukta-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Mukta"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/mukta-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Mukta"; font-style: normal; font-weight: 600 700; font-display: swap; src: url(fonts/mukta-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Mukta"; font-style: normal; font-weight: 800 900; font-display: swap; src: url(fonts/mukta-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Mukta"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/mukta-devanagari-400-normal.woff2) format("woff2"); unicode-range: U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20B9,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF; }
@font-face { font-family: "Mukta"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/mukta-devanagari-500-normal.woff2) format("woff2"); unicode-range: U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20B9,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF; }
@font-face { font-family: "Mukta"; font-style: normal; font-weight: 600 700; font-display: swap; src: url(fonts/mukta-devanagari-700-normal.woff2) format("woff2"); unicode-range: U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20B9,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF; }
@font-face { font-family: "Mukta"; font-style: normal; font-weight: 800 900; font-display: swap; src: url(fonts/mukta-devanagari-800-normal.woff2) format("woff2"); unicode-range: U+0900-097F,U+1CD0-1CF9,U+200C-200D,U+20A8,U+20B9,U+20F0,U+25CC,U+A830-A839,U+A8E0-A8FF; }

/* ---- v2.7 tokens: maroon "bahi-khata" palette, warm paper, gold ---- */
:root {
  --bg: #f7f3ee; --surface: #ffffff; --surface-2: #f2ece5; --ink: #1f1a1b; --ink-2: #5a5052; --ink-3: #8f8587;
  --line: #e9e1d8; --line-2: #dacfc3;
  --brand: #7a1f2b; --brand-2: #932a38; --brand-soft: #f6e8ea; --ring: 0 0 0 4px rgba(122, 31, 43, .16);
  --brass: #c08a2c; --brass-soft: #f8eed8; --accent: #b7791f; --accent-soft: #f8eed8;
  --red: #d0402b; --red-soft: #fdecea; --green: #17804a; --green-soft: #e3f4ea;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(31, 26, 27, .04), 0 1px 3px rgba(31, 26, 27, .05);
  --shadow-lg: 0 12px 30px -14px rgba(122, 31, 43, .45);
  --tabbar-h: 66px;
  --font: "Mukta", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121011; --surface: #1b1718; --surface-2: #241f20; --ink: #f1ecec; --ink-2: #b6aaab; --ink-3: #7f7375;
    --line: #2d2627; --line-2: #3b3233; --brand: #f08e9b; --brand-2: #f6a9b3; --brand-soft: #3a1d22; --brass: #e8b85e; --brass-soft: #362a12;
    --accent: #e8b85e; --accent-soft: #362a12; --red: #ff8a78; --red-soft: #3c1c18; --green: #6bd39a; --green-soft: #15301f;
    --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 12px 30px -14px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --bg: #121011; --surface: #1b1718; --surface-2: #241f20; --ink: #f1ecec; --ink-2: #b6aaab; --ink-3: #7f7375;
  --line: #2d2627; --line-2: #3b3233; --brand: #f08e9b; --brand-2: #f6a9b3; --brand-soft: #3a1d22; --brass: #e8b85e; --brass-soft: #362a12;
  --accent: #e8b85e; --accent-soft: #362a12; --red: #ff8a78; --red-soft: #3c1c18; --green: #6bd39a; --green-soft: #15301f;
  --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 12px 30px -14px rgba(0,0,0,.7);
}

/* =====================================================================
   v3 refresh: calmer, print-like "khata" look. Hairline borders instead of
   floating shadows, real line icons, tabular figures, one accent colour.
   ===================================================================== */
html, body { font-size: 16.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { font-feature-settings: "tnum" 1; }
.svgi { display: block; flex: none; }
h1, h2, h3, b, strong { letter-spacing: -.005em; }

/* top bar */
.topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); padding: 10px 16px 8px; border-bottom: 1px solid transparent; }
.topbar h1, .book-btn .bname { font-size: 20px; font-weight: 700; }
.book-btn .chev { color: var(--ink-3); display: inline-grid; }
.member-chip { border-color: var(--line); padding: 4px 12px 4px 4px; font-weight: 600; box-shadow: var(--shadow); }
.member-chip .dot, .avatar { font-weight: 700; letter-spacing: .02em; }
.icon-btn { border-radius: 12px; color: var(--ink); }
.icon-btn:hover { background: var(--surface-2); }

/* tab bar: line icons + brass indicator */
.tabbar { background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.tabbar a { font-size: 11.5px; font-weight: 600; color: var(--ink-3); position: relative; gap: 3px; padding-top: 8px; }
.tabbar a .ti { filter: none; opacity: 1; font-size: 0; }
.tabbar a.on { color: var(--brand); }
.tabbar a.on::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brass); }
.tabbar .fab { width: 56px; height: 56px; margin-top: -24px; border-radius: 18px; background: var(--brand); color: #fff; box-shadow: var(--shadow-lg); border: 4px solid var(--bg); }
.tabbar .fab:active { transform: scale(.96); }

/* cards: hairline, flatter */
.card, .elist, .menu, .pick-list, .tablewrap, .sumstrip div, .qcat, .searchbox, .month-sw { box-shadow: var(--shadow); border: 1px solid var(--line); }
.card { border-radius: var(--radius); padding: 15px; }
.section-title { margin: 22px 2px 9px; }
.section-title h2 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; }
.section-title a, .link-btn { font-size: 14px; font-weight: 600; color: var(--brand); }

/* month switcher */
.month-sw { border-radius: 14px; padding: 4px; }
.month-sw button { display: inline-grid; place-items: center; color: var(--ink-2); border-radius: 10px; }
.month-sw button:hover:not(:disabled) { background: var(--surface-2); }
.month-sw .mlabel { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 16px; font-weight: 700; }
.month-sw .mlabel .svgi { color: var(--ink-3); }

/* hero: ruled "khata" page in ink green */
.hero { background: var(--brand); border-radius: 18px; padding: 18px 18px 16px; box-shadow: var(--shadow-lg); isolation: isolate; }
:root[data-theme="dark"] .hero { background: #4a1820; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: #4a1820; } }
.hero .lbl { font-size: 13.5px; opacity: .8; font-weight: 500; }
.hero .amt { font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 4px 0 14px; }
.hero .grid3 { gap: 0; background: rgba(0,0,0,.14); border-radius: 12px; overflow: hidden; }
.hero .grid3 div { background: transparent; border-radius: 0; padding: 9px 11px; border-left: 1px solid rgba(255,255,255,.1); }
.hero .grid3 div:first-child { border-left: 0; }
.hero .grid3 small { font-size: 11.5px; opacity: .75; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.hero .grid3 b { font-size: 16px; font-weight: 700; }
.hero a { color: #f3d58e; }
.bar { height: 6px; background: rgba(255,255,255,.16); }
.bar i, :root[data-theme="dark"] .bar i { background: #e9c46a; }

/* quick add grid */
.qgrid { gap: 10px; }
.qcat { border-radius: 14px; padding: 12px 4px 10px; gap: 6px; transition: transform .12s, border-color .12s; }
.qcat:active { transform: scale(.97); }
.qcat:hover { border-color: var(--line-2); }
.qcat .ic { width: 44px; height: 44px; border-radius: 13px; font-size: 22px; }
.qcat .nm { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.qcat.sel { outline: 2px solid var(--brand); outline-offset: -1px; }

/* entry lists */
.day-head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 18px 4px 7px; }
.eitem { padding: 12px 14px; gap: 12px; }
.eitem .ic, .cat-pick .ic, .pick-list .ic { border-radius: 12px; }
.eitem .t1 { font-weight: 600; font-size: 15.5px; }
.eitem .amt { font-weight: 700; font-size: 15.5px; }
.tag { font-weight: 600; letter-spacing: .01em; padding: 1px 8px; }

/* buttons & inputs */
.btn { border-radius: 12px; font-weight: 700; letter-spacing: .005em; transition: background .15s, transform .1s; }
@media (hover: hover) { .btn:not(.ghost):not(.outline):not(.danger):not(.accent):hover { background: var(--brand-2); } .btn.ghost:hover { background: var(--line); } }
.btn.outline { border: 1px solid var(--line-2); }
.input, select.input, textarea.input, .cat-pick, .switch-row { border: 1px solid var(--line-2); border-radius: 12px; }
.input:focus, .amount-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.amount-wrap { border: 1px solid var(--line-2); border-radius: 16px; }
.amount-wrap input { font-weight: 800; letter-spacing: -.02em; }
.field > label, .lbl2 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; }
.chip { border: 1px solid var(--line-2); font-weight: 600; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.seg { border-radius: 12px; }
.seg button.on { box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* more menu */
.menu a, .menu button { padding: 13px 14px; font-size: 15.5px; }
.menu .mi { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.menu .mi.mi-danger { background: var(--red-soft); color: var(--red); }
.menu .arrow { color: var(--ink-3); display: inline-grid; }

/* auth + logo */
.logo-big { width: 76px; height: 76px; border-radius: 20px; display: block; margin: 0 auto 12px; box-shadow: var(--shadow-lg); background: none; }
.auth .brand h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.auth .info { border-radius: 12px; font-weight: 500; }

/* sheets */
.sheet { border-radius: 20px 20px 0 0; }
.sheet-bg { background: rgba(8, 14, 13, .5); backdrop-filter: blur(2px); }

.toast { border-radius: 12px; font-weight: 600; background: var(--ink); color: var(--bg); }
/* Devanagari: no letter-spacing / caps tricks (they break conjuncts) */
html[lang="hi"] .section-title h2, html[lang="hi"] .day-head, html[lang="hi"] .field > label, html[lang="hi"] .lbl2, html[lang="hi"] .hero .grid3 small { letter-spacing: 0; text-transform: none; font-size: 13.5px; }

/* ---- v2.7: book selector pill + compact month bar (owner feedback) ---- */
.book-btn { flex: 0 1 auto; max-width: 62%; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.book-btn .bicon { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.book-btn .bname { font-size: 16.5px; font-weight: 700; }
.book-btn .chev { color: var(--ink-3); margin-left: -2px; }
.book-btn:active { transform: scale(.98); }
.topbar { justify-content: space-between; }
.topbar .offline-pill { margin-right: auto; }
.month-sw { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; height: 46px; padding: 4px; border-radius: 14px; background: var(--surface); }
.month-sw button[data-d], .month-sw > span { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); color: var(--ink); }
.month-sw button[data-d]:disabled { background: transparent; color: var(--ink-3); opacity: .5; }
.month-sw > span { background: transparent; }
.month-sw .mlabel { width: 100%; min-width: 0; padding: 0 8px; height: 38px; font-size: 15.5px; font-weight: 700; color: var(--ink); border-radius: 10px; gap: 7px; }
.month-sw .mlabel .svgi { color: var(--brand); }
.month-sw .mlabel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .chip.on, :root[data-theme="dark"] .btn:not(.ghost):not(.outline):not(.danger), :root[data-theme="dark"] .tabbar .fab { color: #1b0e10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.on, :root:not([data-theme="light"]) .tabbar .fab { color: #1b0e10; } }
.hero { background: var(--brand); }
.hero .grid3 { background: rgba(0,0,0,.16); }
.toast { background: #1f1a1b; color: #fff; }
