@font-face { font-family: 'Noto Sans Bengali'; src: url(/fonts/NotoSansBengali-Regular.ttf) format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Noto Sans Bengali'; src: url(/fonts/NotoSansBengali-Bold.ttf) format('truetype'); font-weight: 600 800; font-display: swap; }
:root {
  --bg: #eef2f5; --card: #fff; --ink: #1d2433; --muted: #667085; --line: #e3e8ef; --brand: #0f5d4e; --brand2: #16866f;
  --soft: #e7f3f0; --warn: #b54708; --warnbg: #fff6e5; --bad: #c62828; --badbg: #fdecec; --ok: #12784a; --okbg: #e6f6ee;
  --solar: #c27c0e; --grid: #2f5fb3; --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 8px rgba(16,24,40,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1418; --card: #182027; --ink: #e8edf2; --muted: #98a4b3; --line: #2a343e; --brand: #3bb79a; --brand2: #2a9a80;
    --soft: #17302b; --warnbg: #3a2a10; --warn: #f5b25b; --badbg: #3a1717; --bad: #ff8a80; --okbg: #12301f; --ok: #6fd69e;
    --solar: #f0b44c; --grid: #7aa7f5;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.55 'Noto Sans Bengali', system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.boot { padding: 40vh 0; text-align: center; color: var(--muted); }

/* layout */
.top { position: sticky; top: 0; z-index: 20; background: linear-gradient(135deg, #0f5d4e, #16866f); color: #fff; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.top h1 { font-size: 17px; margin: 0; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who { font-size: 13px; opacity: .9; }
.top button { background: rgba(255,255,255,.16); border: 0; color: #fff; border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.shell { display: flex; max-width: 1280px; margin: 0 auto; }
nav.side { width: 210px; flex: none; padding: 14px 10px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto; }
nav.side a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; margin-bottom: 2px; }
nav.side a.on { background: var(--brand); color: #fff; }
nav.side a:hover:not(.on) { background: var(--soft); }
main { flex: 1; min-width: 0; padding: 16px; }
.tabs { display: none; }
@media (max-width: 860px) {
  nav.side { display: none; }
  main { padding: 12px 12px 90px; }
  .tabs { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom); overflow-x: auto; }
  .tabs a { flex: 1 0 auto; min-width: 64px; text-align: center; font-size: 11.5px; padding: 7px 6px 6px; color: var(--muted); text-decoration: none; }
  .tabs a .i { display: block; font-size: 19px; line-height: 1.2; }
  .tabs a.on { color: var(--brand); font-weight: 700; }
}

/* parts */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 16.5px; }
.card h3 { margin: 14px 0 8px; font-size: 15px; color: var(--brand); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.sp { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12.5px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 860px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 21px; font-weight: 700; margin-top: 2px; }
.stat .s { font-size: 12px; color: var(--muted); }
.stat.solar .v { color: var(--solar); } .stat.grid .v { color: var(--grid); } .stat.due .v { color: var(--bad); }
.pagehead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pagehead h2 { margin: 0; font-size: 19px; flex: 1; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.p { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.d { color: var(--bad); }
.btn.s { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
input[type=number] { -moz-appearance: textfield; }
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
label.f input, label.f select, label.f textarea { width: 100%; }
label.chk { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.tbl { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.r, th.r { text-align: right; white-space: nowrap; }
tr.sum td { font-weight: 700; border-top: 2px solid var(--line); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; background: var(--soft); color: var(--brand); white-space: nowrap; }
.pill.warn { background: var(--warnbg); color: var(--warn); } .pill.bad { background: var(--badbg); color: var(--bad); } .pill.ok { background: var(--okbg); color: var(--ok); }
.note { border-radius: 10px; padding: 9px 12px; margin: 8px 0; font-size: 13.5px; }
.note.warn { background: var(--warnbg); color: var(--warn); } .note.bad { background: var(--badbg); color: var(--bad); } .note.ok { background: var(--okbg); color: var(--ok); }
.note.info { background: var(--soft); color: var(--brand); }
.due { font-weight: 700; } .due.pos { color: var(--bad); } .due.neg { color: var(--ok); }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; }

/* reading form */
.rd td input.val { width: 120px; text-align: right; }
.rd td input.bal { width: 100px; text-align: right; }
.rd .units { font-weight: 700; }
.rd .units.bad { color: var(--bad); }
.rd tr.done td:first-child { box-shadow: inset 3px 0 var(--ok); }
.rd tr.ai td { background: color-mix(in srgb, var(--solar) 9%, transparent); }
.camera { position: relative; overflow: hidden; display: inline-flex; }
.camera input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; vertical-align: middle; cursor: zoom-in; border: 1px solid var(--line); }
@media (max-width: 640px) {
  .rd thead { display: none; }
  .rd tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  .rd td { border: 0; padding: 2px 0; }
  .rd td[data-l]::before { content: attr(data-l) ': '; color: var(--muted); font-size: 12px; }
  .rd td.nm { grid-column: 1 / -1; font-weight: 700; }
}

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10,20,30,.45); display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 12px; overflow: auto; }
.modal .box { background: var(--card); border-radius: 16px; width: 100%; max-width: 520px; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal .box.wide { max-width: 860px; }
.modal h3 { margin: 0 0 12px; font-size: 17px; }
.modal .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .modal .two { grid-template-columns: 1fr; } }
.imgview { max-width: 100%; border-radius: 10px; }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: calc(100vw - 32px); }
#toast.on { opacity: .96; } #toast.err { background: #b42318; }

/* login */
.login { max-width: 380px; margin: 9vh auto; padding: 0 16px; }
.login .logo { width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(135deg, #0f5d4e, #16866f); color: #fff; font-size: 34px;
  display: grid; place-items: center; margin: 0 auto 12px; }
.login h1 { text-align: center; font-size: 21px; margin: 0 0 4px; }

/* bars */
.bars { display: flex; gap: 6px; align-items: flex-end; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bars .b i { display: block; width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: var(--brand2); }
.bars .b span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bigdue { font-size: 30px; font-weight: 800; }
details.aud summary { cursor: pointer; }
pre.js { background: var(--bg); border-radius: 8px; padding: 8px; font-size: 12px; overflow: auto; max-height: 260px; white-space: pre-wrap; word-break: break-word; }

/* tables that turn into cards on a phone (td[data-l] = label) */
@media (max-width: 640px) {
  table.stack tr.hd { display: none; }
  table.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  table.stack td { border: 0; padding: 2px 0; text-align: left !important; white-space: normal; }
  table.stack td.nm { grid-column: 1 / -1; }
  table.stack td[data-l]::before { content: attr(data-l) ': '; color: var(--muted); font-size: 12px; font-weight: 400; }
}
