:root {
  --bg: #f7f2e7;
  --card: #fffdf8;
  --ink: #1f2a24;
  --muted: #6b7a71;
  --green: #0f7a45;
  --green-dark: #0a5c34;
  --green-soft: #e3f2e9;
  --amber: #e99a1e;
  --amber-soft: #fdf0da;
  --red: #c33a2e;
  --red-soft: #fbe7e3;
  --line: #e8dfcc;
  --shadow: 0 6px 18px rgba(31, 42, 36, .06);
  --r: 18px;
  --font: 'Hind Siliguri', 'Noto Sans Bengali', 'Nirmala UI', 'SolaimanLipi', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0;
  background: #e9e3d5;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
h1, h2, h3, h4 { margin: 0 0 6px; line-height: 1.3; }
p { margin: 0 0 8px; }
a { color: var(--green); }
.red { color: var(--red) !important; }
.green { color: var(--green) !important; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }

#app {
  position: relative;
  max-width: 600px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
  box-shadow: 0 0 44px rgba(20, 40, 28, .10);
  overflow-x: hidden;
}

#app.has-cart { padding-bottom: calc(148px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 12px;
  background: linear-gradient(155deg, #139052, #0b6a3c 70%);
  color: #fff;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 8px 22px rgba(10, 80, 48, .18);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .16);
  color: #fff;
}

.brand-text { min-width: 0; }

.brand-name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58vw;
}

.brand-sub { font-size: 11.5px; opacity: .82; margin-top: 1px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 13px;
  background: rgba(255, 255, 255, .14);
  color: inherit;
  flex: none;
}

.icon-btn.small { width: 36px; height: 36px; border-radius: 10px; }

/* ---------- layout ---------- */
main { padding: 0; }

.screen {
  display: none;
  padding: 14px 14px 12px;
  animation: fade .18s ease;
}

.screen.active { display: block; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes up { from { transform: translateY(28px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }

.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 12px;
}

.screen-head h1 { font-size: 24px; letter-spacing: -.3px; margin: 0; }
.screen-head small { font-size: 12.5px; display: block; }

.section-title {
  font-size: 15px;
  color: #46584d;
  margin: 18px 0 8px;
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.card-head h2 { font-size: 16px; margin: 0; }

.link {
  background: none;
  border: 0;
  color: var(--green);
  font-weight: 700;
  font-size: 13.5px;
  padding: 4px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: transform .06s ease, box-shadow .15s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(.98); }

.btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 122, 69, .22);
}

.btn.ghost {
  background: #fff;
  border-color: var(--line);
  color: #33473b;
}

.btn.small { height: 40px; border-radius: 12px; font-size: 13.5px; padding: 0 12px; }
.btn.tiny { height: 34px; border-radius: 10px; font-size: 13px; padding: 0 11px; background: var(--green-soft); color: var(--green-dark); }
.btn.big { width: 100%; height: 54px; border-radius: 16px; font-size: 17px; }
.btn.danger-ghost { width: 100%; background: #fff; border-color: #f0cdc6; color: var(--red); margin-top: 10px; }
.btn:disabled { opacity: .4; pointer-events: none; }

.file-btn { position: relative; overflow: hidden; }

/* ---------- forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #4b5b51;
}

.field input,
.field select {
  width: 100%;
  height: 52px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  font-weight: 500;
  padding: 0 13px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 122, 69, .12);
}

.field input::placeholder { color: #a4b0a8; font-weight: 400; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 50px;
  padding: 0 13px;
  margin: 2px 0 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
}

.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 122, 69, .10); }

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16.5px;
}

.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 2px;
  font-size: 14.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  margin: 4px 0 8px;
}

.switch-row span { display: flex; align-items: center; gap: 8px; }

.switch-row input[type="checkbox"] {
  appearance: none;
  width: 50px;
  height: 30px;
  border-radius: 99px;
  background: #ddd5c4;
  position: relative;
  transition: background .18s ease;
  flex: none;
}

.switch-row input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  transition: transform .18s ease;
}

.switch-row input[type="checkbox"]:checked { background: var(--green); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(20px); }

/* ---------- home ---------- */
.greet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 2px 12px;
}

.greet h1 { font-size: 25px; margin: 0; letter-spacing: -.4px; }
.greet .muted { font-size: 13px; }

.greet .icon-btn {
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--green);
  box-shadow: var(--shadow);
}

.hero {
  background: linear-gradient(160deg, #14924f, #0a6338 78%);
  border: 0;
  border-radius: 22px;
  padding: 17px 17px 15px;
  color: #fff;
  box-shadow: 0 14px 30px rgba(10, 95, 55, .22);
  margin-bottom: 12px;
}

.hero .muted { color: rgba(255, 255, 255, .72); }

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
}

.pill {
  background: rgba(255, 255, 255, .16);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
}

.big {
  font-size: clamp(31px, 9.5vw, 40px);
  font-weight: 800;
  letter-spacing: -.6px;
  margin: 2px 0 12px;
  font-variant-numeric: tabular-nums;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 11px;
  border-top: 1px solid rgba(255, 255, 255, .18);
}

.hero-grid div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hero-grid span { font-size: 11px; color: rgba(255, 255, 255, .72); }
.hero-grid b { font-size: 15.5px; font-variant-numeric: tabular-nums; }

.due-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  margin: 0 0 16px;
  text-align: left;
  background: linear-gradient(135deg, #fff6e6, #fffdf8);
  border: 1.5px solid #f1d7a5;
  border-radius: 18px;
  font-family: inherit;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(190, 140, 40, .08);
}

.due-left { display: flex; flex-direction: column; line-height: 1.25; }
.due-left .muted { font-size: 12px; }
.due-left b { font-size: 25px; font-variant-numeric: tabular-nums; }
.due-left small { font-size: 11.5px; color: #9a7a3e; }
.due-card .chev { color: #bd8d2c; transform: rotate(180deg); }

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 18px;
}

.quick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 13px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
  text-align: left;
  box-shadow: 0 3px 10px rgba(31, 42, 36, .04);
}

.quick svg { color: var(--green); flex: none; }
.quick.primary { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(15, 122, 69, .2); }
.quick.primary svg { color: #fff; }
.quick.amber { background: var(--amber-soft); border-color: #f1d7a5; }
.quick.amber svg { color: #b4780c; }

.mini-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed #eee7d8;
}

.mini-row:last-child { border-bottom: 0; padding-bottom: 2px; }

.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
  font-size: 16px;
}

.mini-row .grow b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .grow small { font-size: 11.5px; color: var(--muted); display: block; }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge {
  font-size: 11px;
  font-weight: 700;
  border-radius: 99px;
  padding: 3px 9px;
  white-space: nowrap;
}

.badge.warn { background: var(--amber-soft); color: #96640a; }

.foot-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  font-size: 11.5px;
  color: #8a978f;
  line-height: 1.5;
  margin: 20px 6px 6px;
}

/* ---------- sell ---------- */
.grid-products {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.prod {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 104px;
  padding: 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 2px 8px rgba(31, 42, 36, .04);
}

.prod:active { transform: scale(.985); }
.prod b { font-size: 14.5px; line-height: 1.35; padding-right: 22px; font-weight: 700; }
.prod small { font-size: 11.5px; color: var(--muted); }
.prod .price { margin-top: auto; font-size: 17px; font-weight: 800; color: var(--green); }

.prod-add {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1.5px dashed #ded4bf;
  border-radius: 18px;
}

.empty p { margin: 0; font-size: 14.5px; }
.empty .btn { margin-top: 6px; }

/* ---------- khata ---------- */
.khata-total {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: linear-gradient(135deg, #fff2ee, #fffdf8);
  border-color: #f2cfc7;
  padding: 13px 16px;
  margin-bottom: 12px;
}

.khata-total .muted { font-size: 12px; }
.khata-total b { font-size: 29px; color: var(--red); font-variant-numeric: tabular-nums; line-height: 1.25; }

.cust-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 10px;
  cursor: pointer;
}

.cust-row .grow b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-row .grow small { font-size: 11.5px; color: var(--muted); }

.cust-due { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; min-width: 68px; }
.cust-due b { font-size: 15px; font-variant-numeric: tabular-nums; }
.cust-due small { font-size: 10.5px; color: var(--muted); }

.cust-big { font-size: 35px; font-weight: 800; margin: 4px 0 12px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.cust-big small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.row-actions .btn { flex: 1; min-width: 108px; }

.sub-head { font-size: 13.5px; color: var(--muted); margin: 8px 0 6px; font-weight: 700; }

.ledger {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 2px 12px;
  margin-bottom: 14px;
  max-height: 42vh;
  overflow-y: auto;
}

.ledger-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed #eee7d8;
  font-size: 14px;
}

.ledger-row:last-child { border-bottom: 0; }
.ledger-row .grow b { display: block; font-size: 14px; }
.ledger-row .grow small { font-size: 11.5px; color: var(--muted); }
.ledger-row > span:last-child { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.dot.sale { background: var(--red); }

.empty-text { color: var(--muted); font-size: 14px; text-align: center; padding: 12px 0; margin: 0; }

/* ---------- stock ---------- */
.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 12px;
}

.alert.amber { background: var(--amber-soft); border: 1px solid #f1d7a5; color: #8a5a0a; }

.prod-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 10px;
  cursor: pointer;
}

.prod-row .grow b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-row .grow small { font-size: 11.5px; color: var(--muted); }

.stock-badge {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  padding: 5px 8px;
  border-radius: 11px;
  background: var(--green-soft);
  color: var(--green-dark);
  line-height: 1.15;
}

.stock-badge b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.stock-badge small { font-size: 9.5px; }
.stock-badge.low { background: var(--red-soft); color: var(--red); }

/* ---------- report ---------- */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 14px;
  background: #ece5d6;
  border-radius: 14px;
}

.seg button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #5c6b61;
  font-size: 14px;
  font-weight: 700;
}

.seg button.active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 2px 8px rgba(31, 42, 36, .1);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.stat span { font-size: 11.5px; color: var(--muted); }
.stat b { font-size: 19px; font-variant-numeric: tabular-nums; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 152px;
  padding-top: 16px;
}

.bar-wrap {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.bar {
  width: 72%;
  min-height: 4px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #2ba766, #0f7a45);
}

.bar-wrap:nth-child(7) .bar { background: linear-gradient(180deg, #f2b23e, #dd8c12); }
.bar-val { height: 12px; font-size: 9px; color: var(--muted); white-space: nowrap; }
.bar-lab { font-size: 10.5px; color: var(--muted); }

.rank {
  flex: none;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.data-card h2 { font-size: 16px; margin-bottom: 3px; }
.data-card p { font-size: 12.5px; margin-bottom: 10px; }

/* ---------- cart bar ---------- */
.cartbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: calc(100% - 24px);
  max-width: 576px;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: #123f2b;
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 26px rgba(9, 40, 25, .32);
  animation: up .2s ease;
}

.cartbar[hidden] { display: none; }

.cart-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .13);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}

.cart-total { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.cart-total small { font-size: 10.5px; opacity: .68; }
.cart-total b { font-size: 17px; font-variant-numeric: tabular-nums; }

.cart-go { height: 42px; padding: 0 14px; border-radius: 12px; background: #fff; border-color: #fff; color: #123f2b; font-size: 13.5px; box-shadow: none; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 600px;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(31, 42, 36, .07);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: #8b978f;
  font-size: 11px;
  font-weight: 700;
}

.tab-ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 28px;
  border-radius: 10px;
  transition: background .15s ease;
}

.tab.active { color: var(--green); }
.tab.active .tab-ico { background: var(--green-soft); }

/* ---------- sheet ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(12, 30, 20, .5);
  animation: fade .16s ease;
}

.sheet {
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 34px rgba(0, 0, 0, .22);
  animation: up .22s ease;
  overscroll-behavior: contain;
}

.sheet::before {
  content: '';
  display: block;
  width: 44px;
  height: 5px;
  margin: 2px auto 10px;
  border-radius: 99px;
  background: #d8d0bf;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 10px;
}

.sheet-head h3 { font-size: 20px; margin: 0; }
.sheet .icon-btn { background: #eee8da; color: #4b5b51; }

.sumline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  font-size: 14.5px;
  color: #4b5b51;
}

.sumline.strong {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed #d9cfba;
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
}

.sumline.strong b { font-size: 24px; color: var(--green); font-variant-numeric: tabular-nums; }

.qty-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 8px;
}

.qty-hero input {
  width: 112px;
  height: 64px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font-size: 29px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.round {
  flex: none;
  width: 56px;
  height: 56px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--green);
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
}

.pick-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 0 6px;
}

.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }

.quick-chips button {
  height: 38px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 99px;
  background: #fff;
  color: #405246;
  font-size: 13.5px;
  font-weight: 700;
}

.quick-chips button:active { background: var(--green-soft); }

.due-hint {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: #8a5a0a;
  font-size: 13.5px;
  font-weight: 700;
}

.sheet-foot { display: flex; gap: 10px; margin-top: 14px; }
.sheet-foot .btn { flex: 1; }
.sheet-foot.single .btn { width: 100%; }

.cart-lines { margin: 4px 0 2px; }

.cart-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px dashed #ddd4c2;
}

.cart-line:last-child { border-bottom: 0; }
.cart-line .grow b { display: block; font-size: 14.5px; }
.cart-line .grow small { font-size: 12px; color: var(--muted); }

.stepper.mini {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px;
}

.stepper.mini button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 18px;
  line-height: 1;
}

.stepper.mini span {
  min-width: 32px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.settings-links {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.settings-links .btn { width: 100%; justify-content: flex-start; }
.settings-links .btn.danger-ghost { justify-content: center; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(150px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: 88vw;
  padding: 11px 18px;
  border-radius: 99px;
  background: #1f2a24;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .24);
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: #a83226; }

:focus-visible {
  outline: 3px solid #7fc7a3;
  outline-offset: 2px;
}

@media (min-width: 601px) {
  body { padding: 0; }
  #app { border-radius: 24px; margin: 18px auto; min-height: calc(100dvh - 36px); }
  .topbar { border-radius: 24px 24px 0 0; }
  .tabbar { border-radius: 0 0 24px 24px; }
  .cartbar { bottom: calc(94px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(168px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .grid-products { grid-template-columns: 1fr 1fr; }
  .prod { min-height: 98px; padding: 10px; }
  .prod b { font-size: 13.5px; }
  .quick { font-size: 13.5px; padding: 12px 11px; }
  .brand-name { max-width: 50vw; }
}

/* ---------- বিল পাঠানো / প্রিন্ট ---------- */
.bill-preview {
  background: #fff;
  border: 1.5px dashed #cdc2a8;
  border-radius: 14px;
  padding: 14px 14px 10px;
  font-size: 13px;
}

.bill-preview h4 {
  margin: 0 0 2px;
  text-align: center;
  font-size: 17px;
  color: var(--ink);
}

.bill-meta {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.bill-cust {
  font-size: 12.5px;
  margin-bottom: 6px;
}

.bill-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
}

.bill-preview td {
  padding: 5px 0;
  vertical-align: top;
  border-bottom: 1px solid #f1ebdd;
}

.bill-preview td.r {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.bill-preview tr:last-child td { border-bottom: 0; }

.bill-preview small {
  color: var(--muted);
  font-size: 11.5px;
}

.bill-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  font-variant-numeric: tabular-nums;
}

.bill-row.strong {
  border-top: 1px dashed #d8ceb6;
  margin-top: 4px;
  padding-top: 6px;
  font-size: 15px;
}

.bill-row.strong b { color: var(--green-dark); }
.bill-row.red b { color: var(--red); }

.bill-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.bill-actions .btn { height: 48px; border-radius: 14px; font-size: 14.5px; }

#print-root { display: none; }

@media print {
  body { background: #fff !important; padding: 0 !important; }
  #app { display: none !important; }
  #print-root {
    display: block !important;
    width: 72mm;
    margin: 0 auto;
    color: #000;
    font-family: var(--font);
    font-size: 12px;
    line-height: 1.45;
  }
  #print-root h2 { font-size: 16px; margin: 0 0 2px; text-align: center; }
  .pr-meta { text-align: center; font-size: 11.5px; }
  .pr-sep { border-top: 1px dashed #000; margin: 7px 0; }
  .pr-table { width: 100%; border-collapse: collapse; }
  .pr-table td { padding: 3px 0; vertical-align: top; }
  .pr-table td.r { text-align: right; white-space: nowrap; width: 34%; }
  .pr-table thead td { font-weight: 700; border-bottom: 1px solid #000; }
  .pr-table small { font-size: 10px; color: #333; }
  .pr-row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
  .pr-row.strong { font-weight: 700; font-size: 13px; }
  .pr-foot { text-align: center; margin-top: 8px; }
  @page { size: 80mm auto; margin: 4mm; }
}

/* ---------- লাইসেন্স ---------- */
.license-lock {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(28, 24, 16, .55);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.license-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  text-align: center;
}
.license-card h2 { margin: 10px 0 6px; font-size: 20px; }
.license-card p { margin: 0 0 4px; font-size: 13.5px; line-height: 1.55; }
.license-badge {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green-dark);
}
.license-id {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fbf6ea;
  border: 1px dashed var(--line);
  font-size: 13px;
}
.license-id b { letter-spacing: 3px; font-size: 16px; color: var(--green-dark); }
.license-card .field { text-align: left; }
.license-card .btn { width: 100%; margin-top: 10px; }
.license-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  color: var(--green-dark);
}
.license-row small { display: block; letter-spacing: 2px; font-size: 14px; font-weight: 700; color: var(--ink, #241f14); }

/* ---------- অর্ডার ও ডেলিভারি ---------- */
.quick.wide { grid-column: 1 / -1; justify-content: center; }

.field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  padding: 11px 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 76px;
}
.field textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 122, 69, .12);
}
.field textarea::placeholder { color: #a4b0a8; font-weight: 400; }

.or-pay button { gap: 6px; }

.ord { padding: 14px; }
.ord-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ord-who { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ord-who b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-no { flex: none; font-size: 11.5px; color: var(--muted); background: #f3ecdd; border-radius: 99px; padding: 2px 8px; }
.ord-st { flex: none; font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 99px; }
.ord-st.new { background: var(--green-soft); color: var(--green-dark); }
.ord-st.packed { background: #fdf0d6; color: #96640a; }
.ord-st.onway { background: #e6eefc; color: #2457a8; }
.ord-st.done { background: #eef0ec; color: #4a5c50; }
.ord-st.cancel { background: #fbe9e6; color: var(--red); }
.ord-addr { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.ord-addr svg { flex: none; margin-top: 1px; }
.ord-items { font-size: 14px; margin-top: 8px; line-height: 1.5; }
.ord-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 8px; }
.ord-meta span { font-weight: 800; font-size: 16px; }
.ord-meta small { color: var(--muted); font-size: 12px; text-align: right; }
.ord-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ord-actions .btn { flex: 1 1 30%; height: 38px; font-size: 12.8px; padding: 0 8px; gap: 5px; }
.ord-actions .btn.red-txt { color: var(--red); border-color: #f0cdc6; }
