/* BNI Jodhpur & North Rajasthan — Ledger Book */
:root {
  --red: #CF2030; --red-d: #A8172A; --ink: #16181C; --ink2: #3F444C; --muted: #6B7280; --line: #E5E7EB; --line2: #EEF0F3;
  --bg: #F4F5F7; --card: #FFFFFF; --side: #1D2024; --side2: #2A2E34;
  --in: #0F7A4C; --in-bg: #E7F5EE; --out: #B42318; --out-bg: #FDECEA; --tr: #475569;
  --warn: #9A6100; --warn-bg: #FFF4DB; --ok: #0F7A4C; --blue: #1D5FB4; --blue-bg: #E8F0FB;
  --r: 10px; --sh: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --side-w: 248px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 6px; line-height: 1.25; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 14px; margin-top: 18px; }
input, select, textarea, button { font: inherit; color: inherit; }
.muted { color: var(--muted); } .sm { font-size: 13px; } .xs { font-size: 11.5px; } .right { text-align: right; } .center { text-align: center; } .left { text-align: left; }
.mb { margin-bottom: 12px; } .nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; } .row.gap { gap: 8px; } .row.end { justify-content: flex-end; } .row.center { justify-content: center; } .row.between { justify-content: space-between; } .row.wrap, .wrap { flex-wrap: wrap; }
.err { color: var(--out); font-weight: 500; min-height: 1em; margin: 6px 0; } .err-t { color: var(--out); font-weight: 600; } .warn-t { color: var(--warn); font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.in { color: var(--in); } .out { color: var(--out); }

/* ── shell ── */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); background: var(--side); color: #E5E7EB; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 18px; border-bottom: 1px solid var(--side2); }
.brand img { height: 30px; }
.brand b { display: block; font-size: 15px; color: #fff; } .brand span { font-size: 11.5px; color: #9CA3AF; }
.nav { padding: 12px 10px; flex: 1; overflow: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #D1D5DB; font-weight: 500; margin-bottom: 2px; text-decoration: none; }
.nav a:hover { background: var(--side2); color: #fff; }
.nav a.on { background: var(--red); color: #fff; }
.ni { width: 20px; text-align: center; font-size: 15px; opacity: .9; }
.badge { margin-left: auto; background: #FBBF24; color: #111; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--side2); }
.me { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.me b { display: block; color: #fff; font-size: 13px; } .me span { font-size: 11.5px; color: #9CA3AF; }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--side2); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.main { flex: 1; min-width: 0; }
body.authed .main { margin-left: var(--side-w); }
.top { position: sticky; top: 0; z-index: 20; background: rgba(244, 245, 247, .92); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); }
.top-title { font-weight: 700; font-size: 15px; flex: 1; }
.menu-btn { display: none; }
.icon-btn { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 4px 8px; }
#app { padding: 24px 28px 60px; max-width: 1280px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ── cards & page ── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 18px 20px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; } .grid2 + .card, .grid2 + .note { margin-top: 16px; }
.note { background: var(--blue-bg); border: 1px solid #C9DAF3; color: #18406F; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; }
.note.warn { background: var(--warn-bg); border-color: #F3D9A0; color: #6B4600; }
.empty { padding: 24px 0; text-align: center; }

/* ── buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s; line-height: 1.2; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.big { padding: 12px 26px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--red); color: #fff; } .btn.primary:hover:not(:disabled) { background: var(--red-d); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); } .btn.ghost:hover:not(:disabled) { background: #F9FAFB; border-color: #D1D5DB; }
.btn.ghost.light { background: transparent; color: #D1D5DB; border-color: var(--side2); width: 100%; }
.btn.ok { background: var(--ok); color: #fff; } .btn.ok:hover:not(:disabled) { background: #0B6440; }
.btn.danger { background: var(--out); color: #fff; }
.btn.rec { background: var(--in); color: #fff; } .btn.pay { background: var(--out); color: #fff; }
.btn.wa { background: #1DA851; color: #fff; } .btn.wa:hover { background: #178A43; }
.btn.link, button.link { background: none; border: 0; color: var(--blue); padding: 6px; cursor: pointer; font-weight: 600; }
.danger-t { color: var(--out) !important; }
.spin { width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite; vertical-align: -2px; }
.spin.dark { border-color: #D1D5DB; border-top-color: var(--red); }
@keyframes sp { to { transform: rotate(360deg); } }

/* ── pills ── */
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.pill.st-pending { background: var(--warn-bg); color: var(--warn); }
.pill.st-verified { background: var(--in-bg); color: var(--in); }
.pill.st-rejected { background: var(--out-bg); color: var(--out); }
.pill.st-deleted, .pill.grey { background: #F1F2F4; color: #4B5563; }
.pill.blue { background: var(--blue-bg); color: var(--blue); }

/* ── KPIs ── */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh); color: var(--ink); text-decoration: none !important; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #CBD5E1; }
.kpi.rec::before { background: #2a78d6; } .kpi.pay::before { background: #eb6834; } .kpi.warn::before { background: #F59E0B; }
.kpi.warn:hover { border-color: #F3D9A0; }
.kl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kv { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 2px; }
.ks { font-size: 12.5px; color: var(--muted); }

/* ── balances ── */
.dbf { margin: -4px 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.bal { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #FAFBFC; }
.bal.total { background: var(--side); color: #fff; border-color: var(--side); } .bal.total .bl, .bal.total .bs { color: #9CA3AF; }
.bl { font-size: 12.5px; color: var(--ink2); font-weight: 600; }
.bv { font-size: 20px; font-weight: 800; margin: 2px 0; } .bv.neg { color: var(--out); }
.bs { font-size: 11.5px; color: var(--muted); }

/* ── charts ── */
.chart-box { position: relative; height: 240px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink2); margin: -4px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hb { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.ht { height: 10px; background: var(--line2); border-radius: 0 4px 4px 0; overflow: hidden; }
.ht i { display: block; height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; }
.hv { font-weight: 600; min-width: 80px; text-align: right; }

/* ── tables ── */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFC; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.tbl tfoot td { border-top: 2px solid var(--line); border-bottom: 0; background: #FAFBFC; }
.tbl .amt { text-align: right; white-space: nowrap; }
.tbl td.amt.in { color: var(--in); font-weight: 600; } .tbl td.amt.out { color: var(--out); font-weight: 600; }
.erow, .prow { cursor: pointer; } .erow:hover td, .prow:hover td { background: #F8FAFC; }
.erow.s-deleted td, .prow.s-deleted td { opacity: .5; text-decoration: line-through; }
.erow.s-rejected td { background: #FFFAFA; }
.tbl .ck { width: 34px; } .tbl input[type=checkbox] { width: 16px; height: 16px; }
.pager { margin-top: 12px; gap: 12px; }
.show-sm { display: none; }

/* ── filters ── */
.filters { padding: 12px 14px; }
.frow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.frow select, .frow input, .dates input { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; }
.srch { flex: 1; min-width: 200px; }
.dates { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.dates.ro input { background: #F9FAFB; color: var(--ink2); }
.tabs-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 10px; }
.card.tabs-row { margin-top: 0; padding: 8px; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: 7px; font-weight: 600; color: var(--ink2); cursor: pointer; text-decoration: none !important; }
.tab:hover { background: #F3F4F6; } .tab.on { background: var(--ink); color: #fff; }

/* ── form ── */
.form { max-width: 860px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-bottom: 14px; }
.span2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.fgrid .field { margin-bottom: 0; }
.field > span, .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.field input, .field select, .field textarea, .pk-in { border: 1px solid #D1D5DB; border-radius: 8px; padding: 10px 12px; background: #fff; width: 100%; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus, .pk-in:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(207, 32, 48, .12); }
.field textarea { resize: vertical; font-family: inherit; }
.field input.bad, textarea.bad { border-color: var(--out); }
.field.narrow { max-width: 460px; }
.amt-in { font-size: 20px !important; font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; font-weight: 500; }
.chips.big .chip { padding: 9px 16px; font-size: 14px; border-radius: 8px; border-color: #D1D5DB; }
.chip:hover { border-color: #9CA3AF; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.acc.on { background: var(--blue); border-color: var(--blue); }
.chip.acc-sel { appearance: auto; -webkit-appearance: menulist; max-width: 100%; font-family: inherit; color: var(--ink); }
.chip.acc-sel.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.seg { display: flex; gap: 6px; margin-bottom: 18px; background: #F3F4F6; padding: 4px; border-radius: 10px; }
.seg-b { flex: 1; border: 0; background: none; padding: 11px 8px; border-radius: 8px; font-weight: 700; cursor: pointer; color: var(--ink2); }
.seg-b.on.t-receipt { background: var(--in); color: #fff; } .seg-b.on.t-payment { background: var(--out); color: #fff; } .seg-b.on.t-transfer { background: var(--tr); color: #fff; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; margin: 6px 0 4px; }
.check input { width: 17px; height: 17px; accent-color: var(--red); }
.form-actions { margin-top: 8px; }

/* picker */
.picker { position: relative; }
.pk-tag { font-size: 12.5px; color: var(--ink2); margin-top: 6px; }
.pk-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); z-index: 50; max-height: 320px; overflow: auto; }
.pk-opt { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line2); }
.pk-opt.on, .pk-opt:hover { background: #F3F6FB; }
.pk-opt.free { color: var(--ink2); font-style: italic; } .pk-opt.add { color: var(--blue); font-weight: 600; }

/* success */
.success { text-align: center; max-width: 620px; margin: 20px auto; padding: 32px 24px; }
.ok-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--in-bg); color: var(--in); font-size: 28px; display: grid; place-items: center; margin: 0 auto 12px; font-weight: 800; }
.big-amt { font-size: 34px; font-weight: 800; margin: 8px 0; } .big-amt.receipt { color: var(--in); } .big-amt.payment { color: var(--out); }
.success .row { margin-top: 18px; }

/* ── modal ── */
.modal-wrap { position: fixed; inset: 0; background: rgba(17, 24, 39, .5); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; padding: 22px 22px 18px; position: relative; box-shadow: 0 25px 60px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 680px; }
.modal-x { position: absolute; top: 10px; right: 10px; background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--muted); padding: 6px 10px; border-radius: 6px; z-index: 2; }
.modal-x:hover { background: #F3F4F6; }
.modal h3 { padding-right: 30px; font-size: 17px; }
body.modal-open { overflow: hidden; }
.ed-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 16px; border-radius: 10px; margin: 8px 0 14px; }
.ed-head.receipt { background: var(--in-bg); } .ed-head.payment { background: var(--out-bg); } .ed-head.transfer { background: #F1F5F9; }
.ed-type { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink2); }
.ed-amt { font-size: 28px; font-weight: 800; }
table.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 12px 6px 0; width: 32%; vertical-align: top; }
table.kv td { padding: 6px 0; font-weight: 500; }
table.kv tr + tr th, table.kv tr + tr td { border-top: 1px solid var(--line2); }
.ed-actions { margin-top: 16px; }
.hist { margin-top: 14px; font-size: 13px; } .hist summary { cursor: pointer; font-weight: 600; color: var(--ink2); }
.hist ul { padding-left: 18px; margin: 8px 0 0; } .hist li { margin-bottom: 6px; }
.dups { padding-left: 18px; margin: 8px 0; color: var(--ink); }
.wa-preview { background: #E7FFDB; border-radius: 10px; padding: 12px 14px; font-size: 13.5px; line-height: 1.55; margin: 8px 0 14px; max-height: 360px; overflow: auto; border: 1px solid #CDEFC0; white-space: normal; }

/* ── toast ── */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 500; opacity: 0; transition: .25s; z-index: 200; max-width: 90vw; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.bad { background: var(--out); }

/* ── import ── */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; margin: 6px 0 12px; }
.map-grid .field { margin: 0; }
.imp-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ist { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; text-align: left; font-size: 12.5px; color: var(--ink2); min-width: 120px; }
.ist b { display: block; font-size: 20px; color: var(--ink); }
.ist.ok b { color: var(--in); } .ist.warn b { color: var(--warn); } .ist.bad b { color: var(--out); } .ist.skip b { color: var(--muted); }
.ist.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.imp td.fix { cursor: pointer; } .imp td.fix:hover { background: #F3F6FB; }
.irow.st-bad td { background: #FFF8F7; } .irow.st-skip td { opacity: .5; }
.sticky-foot { position: sticky; bottom: 12px; z-index: 5; border-color: #D1D5DB; box-shadow: 0 8px 30px rgba(0, 0, 0, .12); }

/* ── settings ── */
.heads { list-style: none; padding: 0; margin: 0 0 10px; }
.heads li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line2); }
.heads li.off span { color: var(--muted); text-decoration: line-through; }
.tbl input:not([type=checkbox]) { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; min-width: 110px; }
#na input, #na select, .hadd input { border: 1px solid #D1D5DB; border-radius: 8px; padding: 8px 10px; }

/* ── login ── */
body.login-page { background: radial-gradient(1200px 600px at 50% -10%, #fff 0, #F1F2F4 60%); }
.login { min-height: 92vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 30px 24px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(16, 24, 40, .08); text-align: center; }
.login-logo { height: 64px; margin-bottom: 14px; }
.login h1 { font-size: 26px; margin-bottom: 2px; }
.login form { text-align: left; margin-top: 22px; }
.code-in { font-size: 24px !important; letter-spacing: 8px; text-align: center; font-weight: 700; }
.login-foot { color: var(--muted); font-size: 12px; margin-top: 18px; text-align: center; max-width: 380px; }

/* ── mobile ── */
.bottom { display: none; }
.more-list a { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line2); color: var(--ink); font-weight: 500; text-decoration: none; }
.more-list .chev { margin-left: auto; color: var(--muted); }
.more-out { margin-top: 14px; width: 100%; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 12px; color: var(--out); font-weight: 600; cursor: pointer; }

@media (max-width: 1100px) { .kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  body.authed .main { margin-left: 0; }
  .side { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.nav-open .side { transform: none; }
  .menu-btn { display: block; }
  .top { padding: 10px 16px; }
  #app { padding: 16px 16px 96px; }
  .grid2 { grid-template-columns: 1fr; }
  .grid2 > .card { margin-bottom: 0; }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); z-index: 40; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  body:not(.authed) .bottom { display: none; }
  .bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); padding: 6px 0; text-decoration: none; position: relative; font-weight: 600; }
  .bottom a .ni { font-size: 18px; width: auto; }
  .bottom a.on { color: var(--red); }
  .bottom a.b-new .ni { background: var(--red); color: #fff; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; margin-top: -14px; box-shadow: 0 4px 12px rgba(207, 32, 48, .35); }
  .bottom .badge { position: absolute; top: 0; left: 55%; }
  .toast { bottom: 84px; }
}
@media (max-width: 640px) {
  .kpis { gap: 10px; } .kpi { padding: 12px 14px; } .kv { font-size: 20px; }
  .fgrid { grid-template-columns: 1fr; }
  .hide-sm { display: none; } .show-sm { display: block; }
  .card { padding: 14px; }
  h2 { font-size: 19px; }
  .top-actions { display: none; }
  .seg-b { font-size: 12.5px; padding: 10px 4px; }
  .frow > * { flex: 1 1 140px; }
  .dates { flex: 1 1 100%; } .dates input { flex: 1; min-width: 0; }
  .hb { grid-template-columns: 1fr auto; } .hb .ht { grid-column: 1 / -1; order: 3; }
  .modal-wrap { padding: 0; align-items: flex-end; } .modal { border-radius: 14px 14px 0 0; max-height: 92vh; overflow: auto; }
  .sticky-foot { bottom: 76px; }
}

/* ── print (receipts & reports) ── */
#printArea { display: none; }

/* ── renewals ── */
.pill.cs-grey { background: #F1F2F4; color: #4B5563; } .pill.cs-amber { background: var(--warn-bg); color: var(--warn); }
.pill.cs-green { background: var(--in-bg); color: var(--in); } .pill.cs-red { background: var(--out-bg); color: var(--out); } .pill.cs-blue { background: var(--blue-bg); color: var(--blue); }
.chip.cs-green.on { background: var(--in); border-color: var(--in); } .chip.cs-amber.on { background: var(--warn); border-color: var(--warn); }
.chip.cs-red.on { background: var(--out); border-color: var(--out); } .chip.cs-blue.on { background: var(--blue); border-color: var(--blue); }
.rn-buckets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.rn-b { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink2); }
.rn-b b { font-size: 14px; color: var(--ink); } .rn-b:hover { border-color: #9CA3AF; }
.rn-b.on { background: var(--ink); border-color: var(--ink); color: #fff; } .rn-b.on b { color: #fff; }
.rn-b.hot:not(.on) b { color: var(--out); }
.rn-bulk { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line2); }
.grow { flex: 1; } .clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow { cursor: pointer; } .rrow:hover td { background: #FAFAFB; }
.rn-tbl td { vertical-align: top; } .rn-tbl .pill { margin-top: 2px; }
.rn-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 6px; } .rn-head h3 { margin: 0 0 2px; }
.rn-due { text-align: right; background: var(--blue-bg); border-radius: 10px; padding: 10px 14px; min-width: 150px; }
.rn-due.late { background: var(--out-bg); } .rn-due .kl { font-size: 12px; color: var(--muted); } .rn-due .kv { font-size: 20px; } .rn-due .ks { font-size: 12.5px; font-weight: 600; }
.rn-form { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; background: #FCFCFD; }
.rn-form .chips { margin: 6px 0 12px; } .end-al { align-items: flex-end; } .field.nomb { margin-bottom: 0; }
.mem-box { border: 1px dashed #D1D5DB; border-radius: 10px; padding: 12px 14px 2px; margin: 4px 0 14px; }
.mem-box.on { border-style: solid; border-color: #C9DAF3; background: #F7FAFE; }
.mem-to { font-size: 18px; font-weight: 700; padding: 6px 0 2px; color: var(--blue); }
.mail-preview { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 13.5px; line-height: 1.6; margin: 8px 0 6px; max-height: 340px; overflow: auto; }
a.note.rn-note { display: block; color: #18406F; text-decoration: none; } a.note.rn-note:hover { border-color: #9DBCE6; } .rn-note .chev { float: right; font-weight: 600; }
.chart-box.tall { height: 280px; }
@media (max-width: 640px) {
  .rn-head { flex-direction: column; } .rn-due { text-align: left; width: 100%; }
  .rn-b { padding: 6px 10px; font-size: 12.5px; } .clip { max-width: 160px; } .rn-note .chev { float: none; display: block; }
}
/* stock */
.sk-line { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.sk-line .slI { flex: 1; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: #fff; }
.sk-line .slQ { width: 84px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; }
.sk-line .slX { color: var(--muted); font-size: 16px; padding: 4px 6px; }
b.neg, .neg { color: var(--out); }
tr.dim td { opacity: .55; }
.kpis.sm4 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 12px 0; }
.kpis.sm4 .kv { font-size: 22px; }
.sk-chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.sk-ch .hb { grid-template-columns: 1fr auto; }
#smC { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; margin-bottom: 8px; }
/* requisitions, Bikaner routing, petty cash */
.pill.st-approved { background: #E0ECFF; color: #1D4ED8; }
.pill.new { background: #FDF2F3; color: #CF2030; }
.pill.co { background: #EEF2FF; color: #3730A3; margin-left: 4px; vertical-align: 1px; }
.tab .badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: #CF2030; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.bk-note { display: block; margin-top: 6px; padding: 7px 10px; border-radius: 8px; background: #EEF2FF; color: #3730A3; font-size: 12.5px; line-height: 1.4; }
#rqT { margin: 4px 0 12px; } #rqT .seg-b.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.sk-recv { margin-top: 12px; padding-top: 12px; border-top: 1px solid #EEF0F2; }
@media print {
  @page { size: A4; margin: 14mm; }
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing #printArea { display: block; }
  body { background: #fff; font-size: 11.5px; }
  .pr-top { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #CF2030; padding-bottom: 10px; margin-bottom: 14px; }
  .pr-top img { height: 44px; }
  .pr-top b { display: block; font-size: 16px; } .pr-top span { color: #555; }
  .pr-title { margin-left: auto; font-size: 18px; font-weight: 800; letter-spacing: .1em; color: #CF2030; }
  .pr-amt { font-size: 28px; font-weight: 800; margin: 8px 0 14px; }
  .pr-receipt table { width: 100%; border-collapse: collapse; }
  .pr-receipt th { text-align: left; width: 30%; color: #555; font-weight: 500; padding: 7px 0; border-bottom: 1px solid #ddd; }
  .pr-receipt td { padding: 7px 0; border-bottom: 1px solid #ddd; font-weight: 600; }
  .pr-sign { display: flex; justify-content: space-between; margin-top: 50px; color: #555; }
  .pr-sign div:last-child { border-top: 1px solid #999; padding-top: 4px; min-width: 180px; text-align: center; }
  .pr-foot { color: #888; font-size: 10px; margin-top: 24px; }
  .pr-report .tbl { font-size: 10.5px; } .pr-report .tbl th { background: #f3f3f3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-report .tbl td, .pr-report .tbl th { padding: 5px 6px; border-bottom: 1px solid #ddd; }
  .pr-report .tbl-wrap { overflow: visible; }
  tr { break-inside: avoid; }
}

/* ── Leads CRM ── */
.ld-funnel { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.ld-step { min-width: 0; }
.ld-bar { height: 8px; background: #F1F2F4; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.ld-bar span { display: block; height: 100%; background: #CF2030; border-radius: 4px; }
.ld-n { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.ld-l { font-size: 13px; color: var(--ink2); font-weight: 600; }
.ld-c { font-size: 11.5px; }
.ld-info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13.5px; margin: 10px 0 14px; padding: 10px 12px; background: #F8F9FA; border-radius: 8px; }
.ld-info dt { color: var(--ink2); } .ld-info dd { margin: 0; color: var(--ink); }
@media (max-width: 760px) { .ld-funnel { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ld-info { grid-template-columns: 1fr; } .ld-info dd { margin-bottom: 6px; } }
/* a Leads-CRM login cannot select or copy text (inputs stay editable) */
body.crm-only { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.crm-only input, body.crm-only textarea { -webkit-user-select: text; user-select: text; }
@media print { body.crm-only * { display: none !important; } }
.mt-xs { margin-top: 6px; }

.pill.cat { background: #EEF4FF; color: #1D4ED8; }

/* ── bank reconciliation ── */
.ok-t { color: var(--in); font-weight: 600; } .mt { margin-top: 12px; }
.clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.rc-tbl td { vertical-align: top; }
.rc-line { padding: 10px 12px; background: #F8F9FA; border-radius: 8px; font-size: 14px; } .rc-line .sub { word-break: break-word; }
.mp-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; }
.mp-list .tbl td { vertical-align: top; } .mp-row { cursor: pointer; } .mp-row.on { background: var(--blue-bg); }
.rc-foot { position: sticky; bottom: 0; background: #fff; padding-top: 8px; border-top: 1px solid var(--line); }
.wait-bank summary { cursor: pointer; padding: 4px 0; } .wait-bank[open] summary { margin-bottom: 10px; }
.kv.sm th, .kv.sm td { font-size: 12.5px; }
.rc-sug { align-items: center; } .rc-sug .grow { min-width: 220px; }

/* ── leads: regions + follow-up rounds ── */
.ld-regs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ld-reg { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer; color: inherit; }
.ld-reg b { margin-left: 4px; color: var(--muted, #6b7280); font-weight: 600; } .ld-reg.on { background: #CF2030; border-color: #CF2030; color: #fff; } .ld-reg.on b { color: #fff; }
.pill.rd { background: #EEF2FF; color: #3730A3; }
.ld-rounds { background: #F8F9FA; box-shadow: none; padding: 12px 14px; margin: 10px 0; }
.ld-rlist { margin: 8px 0 0; padding-left: 0; list-style: none; } .ld-rlist li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }

/* ── CRM performance ── */
.cr-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.cr-kpis .kv { font-size: 24px; }
.cr-tbl td { vertical-align: top; }
.cr-hours { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; padding-top: 6px; }
.cr-h { flex: 1 0 30px; text-align: center; font-size: 12px; }
.cr-hb { height: 90px; display: flex; align-items: flex-end; background: #F3F4F6; border-radius: 4px; overflow: hidden; }
.cr-hb span { display: block; width: 100%; background: #CF2030; border-radius: 4px 4px 0 0; }
.cr-h b { display: block; min-height: 16px; } .cr-h small { color: var(--muted); }
.cr-tl { max-height: 62vh; } .cr-gap td { background: #FFF7ED; color: #9A3412; font-size: 13px; font-weight: 600; } .cr-p td { background: #F0FDF4; color: #166534; font-size: 13px; }
