/* সমিতি ম্যানেজার — "খাতা" থিম: সবুজ মলাট, লাল মার্জিন, সোনালি কয়েন */
:root {
  --paper: #F3F6F2; --card: #FFFFFF; --ink: #14211B; --ink2: #56655C; --line: #D3DDD5; --rule: #E6ECE7;
  --green: #0E6B4F; --green-d: #0A4A37; --green-l: #DDF0E7;
  --red: #B3242E; --red-l: #FBE6E7;
  --gold: #E3A008; --gold-l: #FCF1D2; --gold-d: #7A5200;
  --shadow: 0 1px 0 rgba(20,33,27,.05), 0 8px 20px -14px rgba(20,33,27,.35);
  --f-head: 'Baloo Da 2', 'Hind Siliguri', 'Noto Sans Bengali', 'Kalpurush', system-ui, sans-serif;
  --f-body: 'Hind Siliguri', 'Noto Sans Bengali', 'Kalpurush', 'SolaimanLipi', system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #0D1411; --card: #16201B; --ink: #E6EFE9; --ink2: #98A99F; --line: #2B3A32; --rule: #1F2C26;
  --green: #3FBF93; --green-d: #0A4A37; --green-l: #143A2D;
  --red: #F0777F; --red-l: #3A1B1E;
  --gold: #F0B429; --gold-l: #3A2D0B; --gold-d: #F0B429;
  --shadow: 0 1px 0 rgba(0,0,0,.4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D1411; --card: #16201B; --ink: #E6EFE9; --ink2: #98A99F; --line: #2B3A32; --rule: #1F2C26;
    --green: #3FBF93; --green-d: #0A4A37; --green-l: #143A2D;
    --red: #F0777F; --red-l: #3A1B1E;
    --gold: #F0B429; --gold-l: #3A2D0B; --gold-d: #F0B429;
    --shadow: 0 1px 0 rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.7 var(--f-body); -webkit-tap-highlight-color: transparent; }
body.noscroll { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--f-head); font-weight: 700; line-height: 1.35; margin: 0; }
h2 { font-size: 1.55rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .5rem; }
a { color: var(--green); text-decoration: none; }
b { font-weight: 600; }
small { color: var(--ink2); font-size: .82rem; display: block; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.18em; }
.boot { padding: 4rem 1rem; text-align: center; color: var(--ink2); }
.neg { color: var(--red); } .pos { color: var(--green); } .muted { color: var(--ink2); } .red-t { color: var(--red) !important; }
[hidden] { display: none !important; }

/* ── বাটন ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .45rem 1.05rem; border: 1.5px solid var(--green); background: var(--green); color: #fff; border-radius: 10px; font-weight: 600; cursor: pointer; text-align: center; }
:root[data-theme="dark"] .btn:not(.ghost):not(.red) { color: #062218; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost):not(.red) { color: #062218; } }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.ghost { background: transparent; color: var(--green); }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost.red-t { border-color: var(--red); }
.btn.block { display: flex; width: 100%; }
.btn.sm { min-height: 34px; padding: .1rem .7rem; font-size: .85rem; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; color: var(--ink2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--rule); color: var(--ink); }
.icon-btn.sm { width: 32px; height: 32px; }
.chip-link { display: inline-flex; align-items: center; gap: .3rem; background: var(--gold-l); color: var(--gold-d); padding: .2rem .8rem; border-radius: 99px; font-weight: 600; font-size: .9rem; }

/* ── ফর্ম ── */
.f { display: block; margin: 0 0 .85rem; }
.f > span { display: block; font-size: .86rem; color: var(--ink2); margin-bottom: .2rem; }
input:not([type=checkbox]):not([type=file]), select, textarea { width: 100%; min-height: 44px; padding: .5rem .75rem; background: var(--card); border: 1.5px solid var(--line); border-radius: 8px; }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0 .75rem; align-items: end; }
.row3 .btn { margin-bottom: .85rem; }
.check { display: flex; gap: .55rem; align-items: center; margin: .3rem 0 .8rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.hint { font-size: .85rem; color: var(--ink2); }
.hint.lead { font-size: 1rem; }

/* ── লগইন ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; background: linear-gradient(180deg, var(--green-d) 0 38%, var(--paper) 38%); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 6px 16px 16px 6px; border-left: 12px solid var(--green-d); box-shadow: var(--shadow), 0 20px 40px -24px rgba(0,0,0,.5); padding: 1.6rem 1.4rem 1.4rem; position: relative; }
.auth-card::before { content: ''; position: absolute; left: 22px; top: 0; bottom: 0; width: 2px; background: var(--red); opacity: .55; }
.auth-brand { text-align: center; margin-bottom: 1.1rem; padding-left: 14px; }
.auth-brand .coin { width: 64px; height: 64px; }
.auth-brand h1 { font-size: 1.7rem; margin-top: .2rem; }
.auth-brand p { color: var(--ink2); margin: 0; }
.auth-form { padding-left: 14px; }

/* ── শেল ── */
.shell { min-height: 100vh; }
.main { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
#view { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 2rem; outline: none; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: .55rem 1rem; padding-top: calc(.55rem + env(safe-area-inset-top)); background: var(--green-d); color: #fff; }
.brand { display: flex; align-items: center; gap: .55rem; color: inherit; font-family: var(--f-head); font-weight: 700; font-size: 1.1rem; }
.brand .coin { width: 34px; height: 34px; }
.rail { display: none; }
.bottom { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-i { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 62px; color: var(--ink2); font-size: .74rem; font-weight: 500; }
.nav-i .ic { width: 22px; height: 22px; }
.nav-i.on { color: var(--green); font-weight: 600; }
.nav-i.on::before { content: ''; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--red); }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); background: var(--red); color: #fff; font-style: normal; font-size: .7rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 9px; padding: 0 4px; }
.av { --tone: var(--green); display: inline-grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%; background: color-mix(in srgb, var(--tone) 16%, var(--card)); color: var(--tone); font-family: var(--f-head); font-weight: 700; font-size: 1.15rem; border: 1.5px solid color-mix(in srgb, var(--tone) 40%, transparent); }
.av.sm { width: 34px; height: 34px; font-size: .95rem; } .av.lg { width: 56px; height: 56px; font-size: 1.5rem; }

@media (min-width: 900px) {
  .rail { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 250px; background: var(--green-d); color: #dcebe3; padding: 1rem .8rem; z-index: 25; }
  .rail .brand { color: #fff; margin: .2rem .4rem 1.2rem; font-size: 1.2rem; }
  .rail nav { flex: 1; overflow: auto; }
  .rail hr { border: 0; border-top: 1px solid rgba(255,255,255,.14); margin: .7rem 0; }
  .rail .nav-i { flex-direction: row; justify-content: flex-start; gap: .7rem; min-height: 44px; padding: 0 .8rem; border-radius: 10px; color: #cfe3d9; font-size: .98rem; }
  .rail .nav-i:hover { background: rgba(255,255,255,.08); }
  .rail .nav-i.on { background: rgba(255,255,255,.14); color: #fff; }
  .rail .nav-i.on::before { left: 0; top: 10px; bottom: 10px; width: 3px; height: auto; border-radius: 0 3px 3px 0; background: var(--gold); }
  .rail .badge { position: static; margin-left: auto; }
  .rail-foot { display: flex; align-items: center; gap: .4rem; border-top: 1px solid rgba(255,255,255,.14); padding-top: .7rem; }
  .rail-foot .who { flex: 1; display: flex; gap: .6rem; align-items: center; color: #fff; min-width: 0; }
  .rail-foot .who small { color: #a9c7b8; }
  .rail-foot .icon-btn { color: #cfe3d9; }
  .main { margin-left: 250px; padding-bottom: 2rem; }
  .top, .bottom { display: none; }
  #view { padding-top: 1.6rem; }
}

/* ── কার্ড / লেজার ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.flush { padding: .3rem 0; }
.card h3 { margin-bottom: .55rem; }
.err-card { border-color: var(--red); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; margin: .2rem 0 1rem; }
.page-head h2 { flex: 1 1 auto; }
.page-head p { flex-basis: 100%; order: 3; margin: 0; color: var(--ink2); }
.sec { margin: 1.4rem 0 .6rem; }
.lg-wrap { margin-top: .3rem; }
.lg { display: flex; align-items: baseline; gap: .5rem; padding: .18rem 0; }
.lg i { flex: 1; border-bottom: 1.5px dotted var(--line); transform: translateY(-4px); min-width: 12px; }
.lg span { color: var(--ink2); } .lg b { text-align: right; }
.lg.neg b { color: var(--red); }
.lg.total { border-top: 1.5px solid var(--ink); margin-top: .35rem; padding-top: .4rem; }
.lg.total span { color: var(--ink); font-weight: 600; }
.empty { text-align: center; color: var(--ink2); padding: 1.6rem 1rem; }

/* খাতা কার্ড */
.khata { position: relative; margin-bottom: 1rem; padding: 1.1rem 1.1rem 1rem 2.6rem; background: linear-gradient(90deg, transparent 27px, color-mix(in srgb, var(--red) 70%, transparent) 27px 29px, transparent 29px), repeating-linear-gradient(180deg, transparent 0 33px, var(--rule) 33px 34px), var(--card); border: 1px solid var(--line); border-left: 11px solid var(--green-d); border-radius: 5px 14px 14px 5px; box-shadow: var(--shadow); }
.k-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; margin-bottom: .6rem; }
.k-name { font: 700 1.35rem/1.3 var(--f-head); }
.k-sub { color: var(--ink2); font-size: .85rem; }
.k-label { color: var(--ink2); font-size: .85rem; margin-bottom: .25rem; }
.k-big { font: 700 2.5rem/1.15 var(--f-head); color: var(--green); }
.khata .lg-wrap { margin-top: .75rem; }

/* ১২ সপ্তাহের স্ট্রিপ */
.strip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.strip i { position: relative; display: block; aspect-ratio: 1; min-height: 18px; border-radius: 3px; border: 1.5px solid transparent; }
.c-paid { background: var(--green); }
.c-paid::after { content: ''; position: absolute; left: 34%; top: 14%; width: 26%; height: 50%; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(40deg); }
:root[data-theme="dark"] .c-paid::after { border-color: #062218; }
.c-missed { background: var(--red); }
.c-missed::after { content: ''; position: absolute; inset: 0; background: linear-gradient(45deg, transparent 45%, #fff 45% 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, #fff 45% 55%, transparent 55%); opacity: .85; transform: scale(.55); }
.c-due { border-color: var(--gold); background: var(--gold-l); }
.c-waived { background: var(--rule); border-color: var(--line); }
.c-none { border: 1.5px dashed var(--line); }
.c-future { border: 1.5px dashed var(--line); background: transparent; }
.strip.mini { gap: 2px; margin-top: .25rem; max-width: 220px; }
.strip.mini i { min-height: 9px; border-width: 1px; border-radius: 2px; }
.strip.mini i::after { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .5rem 0 .2rem; font-size: .78rem; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: .3rem; }
.legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; border-width: 1.5px; border-style: solid; border-color: transparent; }
.legend i::after { display: none; }
.legend .c-future { border-style: dashed; border-color: var(--line); }

.banner { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem .9rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.banner .ic { margin-top: .25rem; width: 1.3em; height: 1.3em; }
.banner.bad { background: var(--red-l); border-color: color-mix(in srgb, var(--red) 45%, transparent); color: var(--red); }
.banner.warn { background: var(--gold-l); border-color: color-mix(in srgb, var(--gold) 55%, transparent); color: var(--gold-d); }
.banner a { text-decoration: underline; font-weight: 600; }
.rules ul { margin: 0; padding-left: 1.2rem; } .rules li { margin: .15rem 0; }
.next { display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.next b { display: block; font-size: 1.05rem; }
.week .wk-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.bar { height: 12px; background: var(--rule); border-radius: 6px; overflow: hidden; margin: .6rem 0 .4rem; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 6px; }
.wk-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .2rem 1rem; font-size: .9rem; }
.wk-foot.muted { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--rule); }
.quick, .actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

/* লিস্ট */
.tools { margin-bottom: .8rem; }
.search { display: flex; align-items: center; gap: .5rem; padding: 0 .8rem; background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; margin-bottom: .6rem; color: var(--ink2); }
.search input { border: 0 !important; box-shadow: none !important; padding-left: 0; background: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.tools .chips { margin-bottom: 0; }
.chip { min-height: 36px; padding: .15rem .9rem; border: 1.5px solid var(--line); background: var(--card); border-radius: 99px; cursor: pointer; font-size: .9rem; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .chip.on { color: #062218; }
.mrow { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--rule); color: inherit; cursor: pointer; }
.mrow:last-child { border-bottom: 0; }
.mrow:hover { background: color-mix(in srgb, var(--green) 6%, transparent); }
.mrow .grow { flex: 1; min-width: 0; }
.mrow .grow b { display: inline; }
.mrow .grow > small { display: inline; }
.mrow .grow > small.sub { display: block; }
.sheet .strip { margin: .5rem 0 .9rem; max-width: none; }
.mrow .rt, .lrow .rt { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; text-align: right; }
.lrow .rt { flex-direction: row; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.mrow .rt small { text-align: right; }
.sub { margin-top: -.1rem; }
.list-sum { padding: .3rem 1rem .5rem; font-size: .85rem; color: var(--ink2); border-bottom: 1px solid var(--rule); }
.lrow { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .65rem 1rem; border-bottom: 1px solid var(--rule); }
.lrow:last-child { border-bottom: 0; }
.lrow.voided { opacity: .5; text-decoration: line-through; }
.pill { display: inline-block; padding: .05rem .65rem; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--green-l); color: var(--green); } .pill.bad { background: var(--red-l); color: var(--red); }
.pill.warn { background: var(--gold-l); color: var(--gold-d); } .pill.mute { background: var(--rule); color: var(--ink2); }
.tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 2px solid var(--line); margin: 1.2rem 0 .8rem; }
.tabs button { flex: none; border: 0; background: none; padding: .55rem .9rem; margin-bottom: -2px; border-bottom: 3px solid transparent; color: var(--ink2); font-weight: 500; cursor: pointer; }
.tabs button.on { color: var(--green); border-color: var(--red); font-weight: 600; }
.req, .loan { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-bottom: .8rem; }
.req-h { display: flex; align-items: center; gap: .7rem; margin-bottom: .3rem; }
.req-h .grow { flex: 1; }
.mfoot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .9rem; }
.mfoot.wrap { flex-wrap: wrap; }
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font-weight: 600; cursor: pointer; text-align: left; }
.tile .ic { width: 26px; height: 26px; color: var(--green); }
.who { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.who small { display: block; }
.payinfo { font: 600 1.1rem var(--f-head); background: var(--gold-l); color: var(--gold-d); padding: .6rem .8rem; border-radius: 8px; }
.notice { margin-bottom: .5rem; } .notice p { white-space: pre-wrap; margin-top: .3rem; }
.more-link { display: inline-block; margin-top: .3rem; font-weight: 600; }
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl th { color: var(--ink2); font-weight: 500; font-size: .82rem; }
.skel i { display: block; height: 90px; margin-bottom: 1rem; border-radius: 12px; background: linear-gradient(90deg, var(--rule), var(--card), var(--rule)); background-size: 200% 100%; animation: sh 1.3s linear infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* মোডাল */
.scrim { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(8, 20, 15, .55); }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom)); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.mhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.mtext { margin: .3rem 0 .6rem; }
.pw-box { background: var(--rule); padding: .8rem; border-radius: 8px; white-space: pre-wrap; word-break: break-all; font: 500 .95rem/1.6 ui-monospace, monospace; margin: .4rem 0; }
.receipt { border: 1.5px dashed var(--line); border-radius: 8px; padding: .9rem 1rem; }
.r-top { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink2); margin-bottom: .2rem; } .r-top b { color: var(--ink); }
.r-amt { font: 700 2.3rem/1.2 var(--f-head); text-align: center; color: var(--green); margin: .3rem 0 .5rem; }
.void-note { color: var(--red); text-align: center; font-weight: 600; margin: .5rem 0 0; }
.toast { position: fixed; z-index: 90; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -140%); background: var(--ink); color: var(--paper); padding: .6rem 1.1rem; border-radius: 10px; max-width: 92vw; transition: transform .25s; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); }
.toast.show { transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; } .toast.ok { background: var(--green-d); color: #fff; }
#print { display: none; }
@media (min-width: 700px) {
  .scrim { align-items: center; } .sheet { border-radius: 16px; }
  .more-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 380px) { .row2, .row3 { grid-template-columns: 1fr; } .k-big { font-size: 2.1rem; } }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block !important; padding: 1rem; color: #000; }
  #print .receipt { border-color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
