:root {
  --night: #1b1f3b;       /* outage: lights off */
  --night-soft: #2c3160;
  --lantern: #f5a524;     /* restored: lantern glow */
  --lantern-deep: #c97f06;
  --paper: #f6f7fb;
  --surface: #ffffff;
  --ink: #1f2236;
  --muted: #5c6079;
  --line: #dfe2ec;
  --focus: #3b6ef5;
  --tl-out: #1b1f3b;
  --tl-ok: #f5a524;
  --tl-none: #dfe2ec;
  --tl-future: #f0f1f6;
  --radius-lg: 18px;
  --radius-sm: 8px;
  --font: "BnDigits", "Hind Siliguri", "Noto Sans Bengali", "Kalpurush", system-ui, sans-serif;
  --display: "Tiro Bangla", "Noto Serif Bengali", "Hind Siliguri", serif;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12142a;
    --surface: #1a1d38;
    --ink: #eceefa;
    --muted: #a3a7c4;
    --line: #2d3156;
    --night-soft: #3a4080;
    --tl-out: #05061a;
    --tl-none: #2d3156;
    --tl-future: #1f2242;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--night); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--display); font-weight: 400; font-size: 22px; }
.brand-tag { font-size: 12px; font-weight: 500; color: #b9bde6; }
.lantern { width: 30px; height: 30px; color: #cfd3f5; }
.lantern .flame { fill: var(--lantern); filter: drop-shadow(0 0 4px var(--lantern)); }
.brand-icon { width: 36px; height: 36px; border-radius: 9px; }
.topnav { display: flex; align-items: center; gap: 8px; }
.navlink { color: #fff; text-decoration: none; font-size: 15px; padding: 5px 10px; border-radius: 999px; }
.navlink:hover { background: rgba(255,255,255,.1); }
.topbtn {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 5px 14px; font-size: 15px;
}
.topbtn:hover { background: rgba(255,255,255,.1); }
#btnInstall { border-color: var(--lantern); color: var(--lantern); }

/* Layout */
.layout { flex: 1; display: grid; grid-template-columns: minmax(320px, 400px) 1fr; min-height: 0; }
.panel { padding: 22px 22px 28px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); }
.mapwrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #e8ebf2; }

h1 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(26px, 3.2vw, 34px); line-height: 1.25;
  margin: 0 0 16px;
}
h2 { font-size: 16px; font-weight: 600; margin: 0 0 8px; color: var(--muted); }

/* Service tabs */
.services { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.services button {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 4px 14px; font-size: 15px;
}
.services button[aria-selected="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* The switch: the one bold element */
.switch {
  display: grid; grid-template-columns: 1fr 1fr;
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 1px 0 var(--line), inset 0 0 0 1px var(--line);
}
.act {
  border: 0; padding: 22px 10px; font-size: 20px; font-weight: 700; line-height: 1.3;
  transition: transform .08s ease, filter .15s ease;
}
.act:active { transform: scale(.97); }
.act:disabled { filter: grayscale(.6); cursor: progress; }
.act-out { background: var(--night); color: #c9cdf0; }
.act-out:hover { background: #0f1230; color: #fff; }
.act-back {
  background: var(--lantern); color: #3b2500;
  background-image: radial-gradient(circle at 50% 40%, #ffd47a 0%, transparent 70%);
}
.act-back:hover { filter: brightness(1.05); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.loc { font-size: 14px; color: var(--muted); margin: 10px 2px 22px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--focus); text-decoration: underline; font-size: inherit; }

/* Summary */
.summary { padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.count { margin: 0; font-size: 18px; }
.count strong { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; margin-right: 6px; vertical-align: -4px; }
.sub { margin: 6px 0 0; font-size: 14px; color: var(--muted); }

.top ol { margin: 0; padding-left: 22px; }
.top li { padding: 3px 0; }
.top li.empty { list-style: none; margin-left: -22px; color: var(--muted); font-size: 15px; }
.top li button { background: none; border: 0; padding: 0; color: var(--ink); text-align: left; }
.top li button:hover { text-decoration: underline; }
.top li .n { color: var(--muted); font-size: 15px; }

.about { margin-top: 22px; font-size: 15px; color: var(--muted); }
.about summary { cursor: pointer; color: var(--ink); font-weight: 500; }
.about p { margin: 8px 0; }

/* Map overlays */
.legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 500;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: 14px;
}
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.sw-out { background: var(--night); }
.sw-back { background: var(--lantern); box-shadow: 0 0 6px var(--lantern); }
.updated { color: var(--muted); }

.pickhint {
  position: absolute; top: 12px; left: 56px; right: 12px; z-index: 600; margin: 0 auto; max-width: 460px;
  background: var(--night); color: #fff; padding: 10px 14px; border-radius: 16px;
  font-size: 15px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 6px 20px rgba(10,12,40,.3);
}
.pick-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.pick-yes { background: var(--lantern); color: #3b2500; border: 0; border-radius: 999px; padding: 6px 16px; font-weight: 700; font-size: 15px; }
.locate-wrap { margin-top: 10px !important; }
.locate-btn { display: flex !important; align-items: center; justify-content: center; color: #1b1f3b !important; width: 34px !important; height: 34px !important; }
.locate-btn.busy svg { animation: locpulse 1s ease-in-out infinite; color: var(--focus); }
@keyframes locpulse { 50% { opacity: .35; } }
.undo {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 999;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 14px; max-width: min(94vw, 480px);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 10px 8px 16px; box-shadow: 0 8px 24px rgba(10,12,40,.25); font-size: 14px;
}
.undo[hidden] { display: none; }
.undo button { background: var(--ink); color: var(--surface); border: 0; border-radius: 999px; padding: 6px 14px; font-weight: 600; white-space: nowrap; }
.pickhint[hidden] { display: none; }
.pickhint .linkbtn { color: var(--lantern); }
.mapwrap.picking #map { cursor: crosshair; }

.foot { font-size: 13px; color: var(--muted); padding: 8px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.foot a { color: inherit; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 1000;
  background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 12px;
  max-width: min(92vw, 460px); font-size: 15px; text-align: center;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Leaflet popup in Bangla font */
.leaflet-container { font-family: var(--font); }
.leaflet-popup-content { font-size: 14px; line-height: 1.5; margin: 10px 14px; }
.leaflet-popup-content strong { font-size: 15px; }
.me-dot { background: var(--focus); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px var(--focus); }

/* Mobile: report controls, then map, then stats */
@media (max-width: 760px) {
  html, body { height: auto; }
  body { font-size: 16px; }
  .layout { display: flex; flex-direction: column; flex: none; }
  .panel { display: contents; }
  .panel > *, .mapwrap { flex-shrink: 0; }
  .panel > * { margin-left: 16px; margin-right: 16px; }
  .panel > h1 { margin-top: 18px; order: 1; }
  .services, .switch, .loc { order: 1; }
  .mapwrap { order: 2; height: 60vh; min-height: 340px; }
  .summary { order: 3; margin-top: 4px; }
  .top, .about { order: 3; }
  .about { margin-bottom: 24px; }
  .act { padding: 18px 8px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- v2: my area today ---------- */
.mine {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px 16px; margin: 0 0 20px;
}
.mine-head { margin: 0; font-size: 15px; color: var(--muted); }
.mine-head strong { color: var(--ink); font-weight: 600; }
.mine-value { margin: 6px 0 2px; font-size: 18px; font-weight: 500; }
.mine-value .big { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.2; color: var(--ink); }
.mine-sub { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.mine-tl { margin-bottom: 12px; }
.tl { display: block; width: 100%; height: 22px; border-radius: 4px; overflow: hidden; }
.tl-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px; }
.pop-tl .tl { height: 14px; margin-top: 4px; }

.btn-primary, .btn-secondary, .btn-small {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.3;
}
.btn-primary { background: var(--ink); color: var(--surface); border: 0; padding: 9px 18px; font-size: 15px; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--ink); padding: 8px 16px; font-size: 15px; }
.btn-secondary:hover { background: var(--paper); }
.btn-small { background: var(--surface); color: var(--ink); border: 1px solid var(--line); padding: 4px 12px; font-size: 14px; font-weight: 500; }
.btn-small:disabled { opacity: .45; cursor: default; }
.btn-link { background: none; border: 0; color: var(--focus); text-decoration: underline; padding: 0; font-size: 14px; }
.morelink { display: inline-block; margin-top: 10px; font-size: 15px; color: var(--focus); }

.pop-place { color: #5c6079; margin-bottom: 4px; }
.pop-today { margin-top: 6px; padding-top: 6px; border-top: 1px solid #dfe2ec; }

/* ---------- dialogs ---------- */
.dlg {
  border: 0; border-radius: 20px; padding: 26px 24px 22px; width: min(92vw, 420px);
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(10,12,40,.35);
  max-height: 90vh; overflow-y: auto;
}
.dlg::backdrop { background: rgba(14,16,40,.55); }
.dlg-close {
  position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1;
}
.dlg-close:hover { background: var(--paper); color: var(--ink); }
.dlg h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0 0 4px; }

.dev { text-align: center; }
.dev-photo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; display: block; }
.dev-initials {
  display: flex; align-items: center; justify-content: center; background: var(--night); color: var(--lantern);
  font-size: 34px; font-weight: 700; box-shadow: 0 0 0 4px rgba(245,165,36,.25);
}
.dev-en { margin: 0; color: var(--muted); font-size: 15px; }
.dev-role { margin: 2px 0 12px; font-weight: 500; }
.dev-about { margin: 0 0 12px; font-size: 15px; color: var(--muted); text-align: left; }
.dev-email { margin: 0 0 12px; font-size: 15px; }
.dev-email a { color: var(--ink); }
.dev-social { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 16px; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: 14px; color: var(--ink); text-decoration: none; }
.pill:hover { background: var(--paper); }
.dev-donate { border-top: 1px solid var(--line); padding-top: 14px; text-align: left; }
.dev-donate h3 { font-size: 17px; margin: 0 0 4px; }
.dev-donate p { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.bkash {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px;
  background: var(--paper); border-radius: 12px; padding: 10px 14px;
}
.bkash-label { grid-column: 1; font-size: 13px; color: var(--muted); }
.bkash-num { grid-column: 1; font-size: 22px; letter-spacing: .5px; }
.bkash .btn-small { grid-column: 2; grid-row: 1 / span 2; }

.dlg-card { width: min(94vw, 460px); }
.card-preview { margin: 10px 0 14px; }
.card-preview img { width: 100%; height: auto; display: block; border-radius: 12px; background: var(--night); aspect-ratio: 1; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card-hint { font-size: 14px; color: var(--muted); margin: 12px 0 0; }

.foot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.foot-dev { font-size: 13px; color: var(--ink); }

/* ---------- stats page ---------- */
.page-stats { display: block; }
.stats { max-width: 1040px; margin: 0 auto; padding: 22px 18px 40px; }
.stats h1 { font-size: clamp(26px, 4vw, 38px); }
.st-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 18px; }
.st-controls .services { margin: 0; }
.daypick { display: flex; gap: 6px; align-items: center; }
.daypick input { font: inherit; font-size: 15px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.st-figures { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.fig { padding: 16px 14px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
.fig:first-child { border-left: 0; padding-left: 0; }
.fig strong { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.2; }
.fig-main strong { font-size: 40px; }
.fig span { font-size: 14px; color: var(--muted); }
.st-block { margin-bottom: 30px; }
.st-block h2 { font-size: 17px; color: var(--ink); margin-bottom: 10px; }
.st-cols { display: grid; grid-template-columns: 3fr 2fr; gap: 30px; }
.trend svg { width: 100%; height: auto; max-height: 240px; display: block; }
.bar { cursor: pointer; }
.bar-hit { fill: transparent; }
.bar-fill { fill: var(--night-soft); }
.bar.sel .bar-fill { fill: var(--lantern); }
.bar:hover .bar-fill, .bar:focus .bar-fill { fill: var(--lantern-deep); }
.bar:focus { outline: none; }
.bar-val { font-size: 13px; fill: var(--ink); font-family: var(--font); }
.bar-day { font-size: 13px; fill: var(--ink); font-family: var(--font); }
.bar-date { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.tablewrap { overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; font-size: 15px; }
.dtable th, .dtable td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.dtable thead th { font-size: 13px; color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; }
.dtable thead th[aria-sort="descending"]::after { content: " ↓"; }
.dtable thead th[aria-sort="ascending"]::after { content: " ↑"; }
.dtable .num { text-align: right; }
.dtable tbody th { font-weight: 500; }
.dtable tbody th a { color: var(--ink); text-decoration: none; }
.dtable tbody th a:hover { text-decoration: underline; }
.dtable .empty, .arealist .empty { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
.arealist { margin: 0; padding-left: 24px; }
.arealist li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.arealist li.empty { list-style: none; margin-left: -24px; border: 0; }
.arealist li { display: list-item; }
.a-name { display: inline-block; min-width: 60%; }
.a-val { float: right; font-weight: 600; }
.dl { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 760px) {
  .topnav .navlink { padding: 5px 6px; font-size: 14px; }
  .topbtn { padding: 4px 10px; font-size: 14px; }
  .brand-tag { display: none; }
  .mine { margin-bottom: 14px; }
  .mine { order: 3; margin-top: 16px; }
  .st-figures { grid-template-columns: 1fr 1fr; }
  .fig { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .fig-main { grid-column: 1 / -1; border-top: 0; }
  .st-cols { grid-template-columns: 1fr; gap: 0; }
}

/* clearer Bangla digits (০-৯, ৳) from Noto Sans Bengali; letters stay Hind Siliguri */
@font-face { font-family: "BnDigits"; font-weight: 100 900; font-display: swap;
  src: url(fonts/bn-digits.woff2) format("woff2"); unicode-range: U+09E6-09EF, U+09F3; }
