/* fonts:begin (generated by scripts/fetch-fonts.mjs) */
@font-face {
  font-family: 'Hind Siliguri'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/hind-siliguri-400-bengali.woff2) format('woff2');
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: 'Hind Siliguri'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/hind-siliguri-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Hind Siliguri'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/fonts/hind-siliguri-500-bengali.woff2) format('woff2');
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: 'Hind Siliguri'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/fonts/hind-siliguri-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Hind Siliguri'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/fonts/hind-siliguri-600-bengali.woff2) format('woff2');
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: 'Hind Siliguri'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/fonts/hind-siliguri-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Hind Siliguri'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/fonts/hind-siliguri-700-bengali.woff2) format('woff2');
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: 'Hind Siliguri'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/fonts/hind-siliguri-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Tiro Bangla'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/tiro-bangla-400-bengali.woff2) format('woff2');
  unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
  font-family: 'Tiro Bangla'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/tiro-bangla-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* fonts:end */

:root {
  --paper: #F6F1E8;
  --card: #FFFCF6;
  --ink: #1F1B16;
  --muted: #5E554A;
  --line: #E3DACB;
  --line-soft: #EDE6D9;
  --chip-line: #CFC4B2;
  --key: #EDE5D6;
  --disabled-bg: #C9C2B6;  /* disabled solid buttons: ink text on this, full opacity */
  --accent: #B5562E;       /* solid: carries white text (≥4.5:1) */
  --accent-line: var(--accent); /* borders/marks; per-shop original accent */
  --accent-tint: transparent;   /* per-shop wash for chips */
  --in: #2E6B45;
  --out: #9E2B2F;
  --short-bg: #F3E3DF;
  --short-ink: #7E1F24;
  --over-bg: #E1ECE3;
  --over-ink: #22502F;
  --body: 'Hind Siliguri', system-ui, sans-serif;
  --num: 'Tiro Bangla', 'Hind Siliguri', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input { font-family: var(--body); color: var(--ink); }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.caption { margin: 0; font-size: 14px; font-weight: 500; color: var(--muted); }
.c-in { color: var(--in); }
.c-out { color: var(--out); }
.c-ink { color: var(--ink) !important; }
.bg-in { background: var(--in); }
.bg-out { background: var(--out); }

/* ---------- shell ---------- */
.view {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- landing ---------- */
.landing {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; padding: 16px;
}
.landing h1 { margin: 0; font-family: var(--num); font-weight: 400; font-size: 56px; }
.landing p { margin: 0; font-size: 17px; color: var(--muted); }
.landing .nf-title { font-size: 22px; font-weight: 700; color: var(--out); }
.landing p { text-align: center; }

/* ---------- home ---------- */
.home { padding-top: 20px; gap: 16px; }
.home-top { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 20px; }
.shop-name {
  font-size: 13px; font-weight: 600; letter-spacing: .2px; color: var(--muted);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill-offline {
  font-size: 12px; font-weight: 600; color: var(--card); background: var(--accent);
  border-radius: 999px; padding: 1px 10px;
}
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 4px 0; }
.hero .caption { font-size: 15px; }
.hero-amount {
  margin: 0; font-family: var(--num); font-size: 60px; line-height: 1.05; letter-spacing: -1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.hero-amount.neg { color: var(--out); }
.hero-sub { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; font-size: 14px; color: var(--muted); }
.hero-sub strong { font-weight: 600; }

.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big-btn {
  height: 108px; border-radius: 18px; color: #fff; text-decoration: none;
  font-size: 22px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.big-btn:active { filter: brightness(.92); }

.log { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
.log-title { margin: 0; font-size: 15px; font-weight: 600; }
.log-list {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.log-list:empty { display: none; }
.log-list li + li { border-top: 1px solid var(--line-soft); }
.log-row {
  width: 100%; min-height: 50px; border: 0; background: transparent; padding: 0 14px;
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 10px;
  text-align: left;
}
.log-time { font-size: 13px; color: var(--muted); }
.log-label { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-ch {
  font-size: 12px; color: var(--muted); border: 1px solid #D9CFBF; border-radius: 999px; padding: 1px 8px;
}
.log-amt { font-size: 16px; font-weight: 600; min-width: 64px; text-align: right; white-space: nowrap; }
.log-row.pending .log-time::after { content: ' ⏳'; }
.log-actions {
  display: flex; justify-content: flex-end; gap: 8px; padding: 0 14px 10px;
}
.log-del {
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--out);
  background: var(--card); color: var(--out); font-size: 15px; font-weight: 600;
}
.log-empty {
  margin: 0; padding: 18px 14px; text-align: center; font-size: 15px; color: var(--muted);
  background: var(--card); border: 1px dashed var(--line); border-radius: 14px;
}

.home-foot { display: flex; flex-direction: column; gap: 4px; }
.close-btn {
  height: 64px; border: 2px solid var(--ink); border-radius: 16px; background: var(--card);
  text-decoration: none; font-size: 19px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.close-btn.done { border-color: var(--in); color: var(--in); }
.week-link {
  align-self: center; min-height: 44px; display: flex; align-items: center; padding: 0 12px;
  font-size: 15px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- sub-screen header ---------- */
.sub-head { display: flex; align-items: center; gap: 4px; margin-left: -8px; }
.back {
  width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
}
.entry-title { margin: 0; font-size: 20px; font-weight: 700; }

/* ---------- entry ---------- */
.amount-wrap { display: flex; flex-direction: column; gap: 4px; }
.amount-box {
  display: flex; align-items: center; gap: 10px; height: 84px; padding: 0 18px;
  background: var(--card); border: 2px solid var(--accent-line); border-radius: 16px; overflow: hidden;
}
.amount-taka { font-family: var(--num); font-size: 40px; color: var(--muted); }
.amount-val { font-family: var(--num); font-size: 52px; line-height: 1; white-space: nowrap; }
.amount-val.zero { color: #B8AD9C; }
.amount-caret {
  width: 3px; height: 46px; border-radius: 2px; background: var(--accent-line); margin-left: -8px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.chips { display: flex; gap: 8px; }
.chip {
  flex: 1; height: 44px; border-radius: 999px; border: 1.5px solid var(--chip-line);
  background: linear-gradient(var(--accent-tint), var(--accent-tint)), var(--card); font-size: 16px; font-weight: 500;
}
.chip[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent); color: #fff; font-weight: 600; }

.purpose { display: flex; flex-direction: column; gap: 8px; }
.purpose-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip {
  flex: 1 0 auto; min-width: 56px; height: 44px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--chip-line);
  background: linear-gradient(var(--accent-tint), var(--accent-tint)), var(--card); font-size: 15px; font-weight: 500;
}
.pchip.small { font-size: 14px; }
.pedit {
  min-height: 44px; display: flex; align-items: center; padding: 0 8px;
  font-size: 14px; font-weight: 500; color: var(--muted); text-underline-offset: 3px;
}
.pchip[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.note {
  height: 44px; padding: 0 14px; border: 1.5px solid var(--chip-line); border-radius: 12px;
  background: var(--card); font-size: 16px; width: 100%;
}

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; }
.numpad button {
  height: 64px; border: 0; border-radius: 14px; background: var(--key);
  font-family: var(--num); font-size: 28px; display: flex; align-items: center; justify-content: center;
}
.numpad button:active { background: #DDD2BF; }

.primary {
  height: 64px; border: 0; border-radius: 16px; background: var(--accent); color: #fff;
  font-size: 22px; font-weight: 700; width: 100%;
}
.primary:active:not(:disabled) { filter: brightness(.92); }
/* Disabled solid buttons: muted fill + ink text, no opacity (white on a faded accent is unreadable). */
.primary:disabled, .it-add:disabled { opacity: 1; background: var(--disabled-bg); color: var(--ink); }

/* ---------- close ---------- */
.close-titles { display: flex; flex-direction: column; }
.close-h1 { margin: 0; font-family: var(--num); font-size: 26px; font-weight: 400; line-height: 1.2; }
.close-intro { font-size: 15px; font-weight: 400; }
.count-rows { display: flex; flex-direction: column; gap: 10px; }
.count-row {
  display: grid; grid-template-columns: 1fr 116px 72px; align-items: end; gap: 10px;
  padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.count-row.bad { border: 1.5px solid var(--out); }
.count-name { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; min-width: 0; }
.count-name > span:first-child { font-size: 18px; font-weight: 700; }
.count-name .exp { font-size: 13px; color: var(--muted); }
.count-name .exp strong { color: var(--ink); font-weight: 600; white-space: nowrap; }
.count-in { display: flex; flex-direction: column; gap: 2px; }
.count-in label { font-size: 12px; font-weight: 500; color: var(--muted); }
.count-in input {
  height: 44px; width: 100%; padding: 0 10px; border: 1.5px solid var(--chip-line); border-radius: 10px;
  background: #fff; font-family: var(--num); font-size: 20px; text-align: right;
}
.count-diff {
  height: 44px; display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  font-size: 18px; font-weight: 700; white-space: nowrap;
}
.count-diff.ok { font-size: 15px; font-weight: 600; color: var(--in); }
.count-diff.short { color: var(--out); }
.count-diff.over { color: var(--in); }

.summary {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
}
.summary p { margin: 0; }
.summary-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.summary-label { font-size: 20px; font-weight: 700; }
.summary-amt { font-family: var(--num); font-size: 40px; line-height: 1.1; white-space: nowrap; }
.summary-line { font-size: 15px; color: #4A3F35; }
.summary-line strong { font-weight: 600; color: var(--ink); }
.summary.short { background: var(--short-bg); border-color: transparent; color: var(--short-ink); }
.summary.over { background: var(--over-bg); border-color: transparent; color: var(--over-ink); }
.summary.ok { background: var(--over-bg); border-color: transparent; color: var(--over-ink); }

.close-actions { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.share {
  height: 48px; font-size: 16px; font-weight: 600; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ---------- items screen ---------- */
.items-body { display: flex; flex-direction: column; gap: 18px; }
.it-sec { display: flex; flex-direction: column; gap: 8px; }
.it-list {
  list-style: none; margin: 0; padding: 6px 10px; display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.it-list:empty { display: none; }
.it-row, .it-new { display: grid; grid-template-columns: 1fr 76px 44px 44px auto; gap: 6px; align-items: center; }
.it-new { grid-template-columns: 1fr 76px auto; }
.it-name, .it-amt {
  height: 44px; min-width: 0; width: 100%; padding: 0 10px; border: 1.5px solid var(--chip-line); border-radius: 10px;
  background: #fff; font-size: 16px;
}
.it-amt { font-family: var(--num); text-align: right; }
.it-btn {
  width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--key);
  display: flex; align-items: center; justify-content: center;
}
.it-del { background: var(--short-bg); min-width: 44px; width: auto; }
.it-del.armed, .log-del.armed { background: var(--out); color: #fff; font-size: 14px; font-weight: 700; padding: 0 10px; }
.it-add {
  height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 700; white-space: nowrap;
}

/* ---------- history / reports ---------- */
.seg {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
  background: var(--key); border-radius: 14px; justify-self: center; margin: 0 auto;
}
.seg button {
  height: 44px; min-width: 112px; padding: 0 20px; border: 0; border-radius: 10px; background: transparent; font-size: 16px; font-weight: 500;
}
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 700; box-shadow: inset 0 0 0 2px var(--accent-line); }
.hist-days, .hist-report { display: flex; flex-direction: column; gap: 12px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.legend-mil { margin-left: auto; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.dot.bg-out { margin-left: 10px; }
.days {
  list-style: none; margin: 0; padding: 4px 0; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.days > li + li { border-top: 1px solid var(--line-soft); }
.days > li.caption { padding: 10px 14px; }
.day-row {
  width: 100%; min-height: 52px; border: 0; background: transparent; padding: 8px 14px;
  display: grid; grid-template-columns: 64px 1fr 56px; gap: 10px; align-items: center; text-align: left;
}
.bar-day { font-size: 14px; color: var(--muted); line-height: 1.2; }
.bar-stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bar-line { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.bar { height: 12px; border-radius: 3px; min-width: 2px; flex: none; }
.day-mark { font-size: 15px; font-weight: 700; text-align: right; white-space: nowrap; }
.day-mark.muted { color: var(--muted); font-weight: 500; }
.day-row.future { opacity: .45; }
.day-row.future .bar-day { color: var(--muted); }
.day-detail { margin: 0; padding: 0 14px 10px; font-size: 14px; color: var(--muted); }

.period-nav { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; }
.pnav {
  width: 44px; height: 44px; border: 1.5px solid var(--chip-line); border-radius: 12px; background: var(--card);
  display: flex; align-items: center; justify-content: center;
}
.period-label { text-align: center; font-size: 17px; font-weight: 700; }
.period-totals { margin: 0; text-align: center; font-size: 15px; color: var(--muted); }
.period-totals strong { font-weight: 700; }
.rep { display: flex; flex-direction: column; gap: 6px; }
.rep-title { margin: 0; font-size: 16px; font-weight: 700; }
.rep-list {
  list-style: none; margin: 0; padding: 10px 14px; display: flex; flex-direction: column; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.rep-row { display: grid; grid-template-columns: 1fr auto auto; column-gap: 10px; row-gap: 4px; align-items: baseline; }
.rep-name { font-size: 16px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-count { font-size: 13px; color: var(--muted); }
.rep-total { font-size: 16px; font-weight: 700; text-align: right; white-space: nowrap; }
.rep-track { grid-column: 1 / -1; height: 10px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.rep-bar { display: block; height: 100%; border-radius: 3px; min-width: 2px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--card); padding: 10px 20px; border-radius: 999px;
  font-size: 16px; font-weight: 600; box-shadow: 0 4px 16px rgb(0 0 0 / .18); z-index: 10;
  max-width: calc(100vw - 32px);
}

@media (max-width: 360px) {
  .hero-amount { font-size: 48px; }
  .it-row { grid-template-columns: 1fr 64px 44px 44px auto; }
  .count-row { grid-template-columns: 1fr 100px 64px; }
}
