/* Food Cart Manager — design system
   Colours: deep green (brand) + gold (accent). Light theme, mobile first. */

:root {
  --green-900: #0e2b23;
  --green-800: #12362c;
  --green-700: #16543f;
  --green: #0b6b4f;
  --green-600: #0e7d5c;
  --green-50: #e9f6f0;
  --gold: #f2b21b;
  --gold-600: #d99a06;
  --gold-50: #fff8e3;
  --bg: #f3f5f6;
  --surface: #ffffff;
  --line: #e2e7ec;
  --line-strong: #cfd7df;
  --text: #18222e;
  --muted: #66707e;
  --red: #9e2a21;
  --red-50: #fdecea;
  --red-line: #f0c2bd;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .05), 0 4px 14px rgba(16, 24, 32, .05);
  --shadow-lg: 0 -6px 26px rgba(16, 24, 32, .14);
  --safe: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  padding-bottom: calc(76px + var(--safe));
  -webkit-tap-highlight-color: rgba(11, 107, 79, .15);
}
a { color: var(--green); }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid rgba(242, 178, 27, .65); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, var(--green-800), var(--green-900));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 4px 18px rgba(14, 43, 35, .28);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; min-height: 56px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 16.5px; letter-spacing: -.01em;
  color: #fff; text-decoration: none; white-space: nowrap;
}
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--gold); color: var(--green-900);
  display: grid; place-items: center; font-size: 16px; font-weight: 900;
}
.topnav { display: none; gap: 2px; flex: 1; margin-left: 10px; }
.topnav a {
  color: #cfe6dc; text-decoration: none; padding: 8px 12px;
  border-radius: 9px; font-size: 14.5px; font-weight: 500; white-space: nowrap;
}
.topnav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.topnav a.on { background: var(--gold); color: #1a2430; font-weight: 700; }
.who { margin-left: auto; display: flex; align-items: center; gap: 2px; font-size: 13px; }
.who .name {
  color: #cfe6dc; max-width: 104px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.who a {
  color: var(--gold); text-decoration: none; font-weight: 600;
  padding: 8px 10px; border-radius: 9px;
}
.who a:hover { background: rgba(255, 255, 255, .1); }

/* ---------- bottom tab bar (phones) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 2px; overflow-x: auto;
  background: #fff; border-top: 1px solid var(--line);
  padding: 5px 6px calc(5px + var(--safe));
  box-shadow: 0 -2px 14px rgba(16, 24, 32, .08);
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar a {
  flex: 0 0 auto; min-width: 62px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 8px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600;
}
.tabbar a .ico { font-size: 17px; line-height: 1.15; }
.tabbar a.on { color: var(--green); background: var(--green-50); }

/* ---------- page frame ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 30px; }
.skip { position: absolute; left: -999px; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 10px; margin: 2px 0 16px;
}
.page-head h1 { font-size: 23px; line-height: 1.2; margin: 0; letter-spacing: -.015em; }
.page-head .sub { margin: 5px 0 0; color: var(--muted); font-size: 14px; max-width: 60ch; }
h1 { font-size: 23px; margin: 0 0 6px; letter-spacing: -.015em; }
h2 { font-size: 16px; margin: 0 0 10px; letter-spacing: -.005em; }
section.block { margin: 24px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.grid { display: grid; gap: 12px; margin: 0 0 4px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
.stat {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 15px; color: inherit;
  text-decoration: none; box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
a.stat:hover { border-color: var(--green-600); transform: translateY(-1px); }
a.stat:active { transform: none; }
.stat .k { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; }
.stat .s { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat .go { font-size: 12px; color: var(--green); font-weight: 700; margin-top: 6px; }
.stat.gold { border-color: #f4cb68; background: var(--gold-50); }
.stat.gold .v { color: #6a4800; }
.stat.bad { border-color: var(--red-line); background: var(--red-50); }
.stat.bad .v { color: #8d1f18; }
.cashbox {
  background: linear-gradient(145deg, var(--green-800), var(--green-900));
  color: #fff; border: 0; border-radius: var(--r-lg); padding: 18px;
  box-shadow: 0 10px 26px rgba(14, 43, 35, .22);
}
.cashbox .k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #b9d8ca; font-weight: 700; }
.cashbox .v { font-size: 30px; font-weight: 800; margin: 6px 0 10px; letter-spacing: -.02em; }
.cashbox .split { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: #d8e9e1; }
.cashbox .split b { display: block; color: #fff; font-size: 15px; font-weight: 700; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fff; color: var(--text);
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: #f4f6f8; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-700); border-color: var(--green-700); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #241a00; }
.btn.gold:hover { background: var(--gold-600); border-color: var(--gold-600); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--green); }
.btn.ghost:hover { background: var(--green-50); }
.btn.danger { color: var(--red); border-color: var(--red-line); }
.btn.danger:hover { background: var(--red-50); }
.btn.small { min-height: 36px; padding: 6px 11px; font-size: 13.5px; border-radius: 9px; }
.btn.icon { min-height: 38px; width: 38px; padding: 0; font-size: 19px; border-radius: 9px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn { flex: 1 1 auto; }

/* ---------- forms ---------- */
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.row.filter { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0 0 16px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 700; color: #43505f; letter-spacing: .01em; }
input, select, textarea {
  font: inherit; font-size: 16px; padding: 10px 12px; width: 100%;
  color: var(--text); background: #fff;
  border: 1px solid var(--line-strong); border-radius: 10px; min-height: 44px;
}
textarea { min-height: 76px; resize: vertical; }
input::placeholder { color: #9aa3b0; }
input:focus, select:focus, textarea:focus {
  border-color: var(--green-600); outline: none;
  box-shadow: 0 0 0 3px rgba(11, 107, 79, .14);
}
select { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #66707e 50%), linear-gradient(135deg, #66707e 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input.tiny { width: 94px; min-height: 36px; padding: 5px 8px; font-size: 15px; }
form.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.formcard { margin: 0 0 18px; }
.formcard h2 { display: flex; align-items: center; gap: 8px; }
.formcard h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--gold); }
.formfoot { margin-top: 12px; }

/* ---------- tables ---------- */
.tablewrap {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); overflow-x: auto; -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 520px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }
th { background: #f8fafb; color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
td.right, th.right { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.off td { color: #9aa3b0; }
tr.off { background: #fcfcfd; }

/* ---------- messages ---------- */
.flash {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 12px 14px; margin: 0 0 14px;
  border: 1px solid; border-radius: var(--r); font-size: 14.5px; font-weight: 500;
}
.flash.ok { background: var(--green-50); border-color: #a9dcc7; color: #0a5a41; }
.flash.err { background: var(--red-50); border-color: var(--red-line); color: #8d1f18; }
.flash.ok::before { content: "✓"; font-weight: 900; }
.flash.err::before { content: "!"; font-weight: 900; width: 18px; height: 18px; border-radius: 99px; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 12px; flex: none; }
.empty {
  padding: 24px 18px; text-align: center; color: var(--muted);
  background: #fbfcfd; border: 1px dashed var(--line-strong);
  border-radius: var(--r); font-size: 14.5px;
}
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 3px; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.tag.in { background: var(--green-50); color: #0a5a41; }
.tag.out { background: var(--red-50); color: #8d1f18; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #eef1f4; color: #43505f; }
.badge.gold { background: var(--gold-50); color: #6a4800; }
.badge.green { background: var(--green-50); color: #0a5a41; }
.two { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* ---------- POS ---------- */
.pos-layout { display: grid; gap: 14px; align-items: start; }
.itemgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 10px; }
.item-btn {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  min-height: 78px; padding: 11px 12px; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; color: inherit; cursor: pointer; box-shadow: var(--shadow);
  transition: border-color .12s, transform .06s;
}
.item-btn:hover { border-color: var(--green-600); }
.item-btn:active { transform: scale(.985); }
.item-btn .cat { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.item-btn .n { font-weight: 700; font-size: 15px; line-height: 1.25; }
.item-btn .p { margin-top: auto; padding-top: 5px; color: var(--green); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.item-btn .qty {
  position: absolute; top: -7px; right: -7px; min-width: 24px; height: 24px;
  border-radius: 99px; background: var(--gold); color: #241a00;
  font-size: 12.5px; font-weight: 900; display: none; place-items: center; padding: 0 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.item-btn.has .qty { display: grid; }
.item-btn.has { border-color: var(--gold); background: var(--gold-50); }

.cartcard { padding: 0; overflow: hidden; }
.cart-peek {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 13px 16px; border: 0; background: var(--green-800); color: #fff;
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; text-align: left;
}
.cart-peek .peek-x { font-size: 12px; color: var(--gold); font-weight: 700; }
.cart-body { padding: 16px; }
.cart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cart-head h2 { margin: 0; }
.cart-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.line {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 10px;
  align-items: center; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.line .nm { display: block; font-weight: 700; font-size: 14.5px; }
.line .pr { display: block; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.line .qtyctl { display: flex; align-items: center; gap: 4px; }
.line .qtyctl .q { min-width: 30px; text-align: center; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.line .lt { grid-column: 1 / 2; font-size: 13px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.line .del { justify-self: end; }
.cart-totals {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-top: 1px dashed var(--line-strong); margin-top: 4px;
}
.cart-totals .lbl { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cart-totals .val { font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.paygrid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  flex: 1 1 auto; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: 99px; background: #fff;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--text); cursor: pointer;
}
.chip:hover { background: var(--green-50); border-color: var(--green-600); color: var(--green); }
.chip.exact { background: var(--gold-50); border-color: #f4cb68; color: #6a4800; }
.changel {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 10px; background: #f6f8f9; font-size: 14px; font-weight: 600;
}
.changel strong { font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--green); }
.changel.short strong { color: var(--red); }
.cart-foot { margin-top: 12px; }
.cart-note { margin: 9px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- login ---------- */
.loginpage { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(1200px 600px at 50% -10%, #1d5745, var(--green-900)); padding-bottom: 20px; }
.loginbox { width: 100%; max-width: 392px; background: #fff; border-radius: var(--r-lg); padding: 26px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3); }
.loginbox .mark { width: 44px; height: 44px; border-radius: 12px; background: var(--gold); color: var(--green-900); display: grid; place-items: center; font-size: 22px; font-weight: 900; margin-bottom: 12px; }
.loginbox h1 { font-size: 21px; margin: 0 0 4px; }
.loginbox p.muted { margin: 0 0 4px; font-size: 14px; }
.loginbox label { margin-top: 12px; }
.loginbox .btn { margin-top: 18px; }
.loginbox .small { text-align: center; margin: 16px 0 0; }

/* ---------- footer ---------- */
footer.site {
  max-width: 1180px; margin: 0 auto; padding: 22px 16px 10px;
  color: var(--muted); font-size: 12px; text-align: center;
}

/* ---------- wider screens ---------- */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .topnav { display: flex; }
  .who .name { max-width: none; }
  .tabbar { display: none; }
  main { padding: 24px 24px 32px; }
  .pos-layout { grid-template-columns: minmax(0, 1.55fr) minmax(350px, 1fr); gap: 18px; }
  .cartcard { position: sticky; top: 80px; }
  .cart-peek { display: none; }
  .itemgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .two { grid-template-columns: 1fr 1fr; gap: 18px; }
  .actions .btn { flex: 0 0 auto; }
}

/* ---------- phones: cart as a bottom sheet ---------- */
@media (max-width: 899px) {
  .cartcard {
    position: fixed; left: 0; right: 0; bottom: calc(62px + var(--safe)); z-index: 25;
    border-radius: 16px 16px 0 0; border-bottom: 0; margin: 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(calc(100% - 54px));
    transition: transform .2s ease;
    max-height: 80vh; overflow: hidden;
    display: flex; flex-direction: column;
  }
  .cartcard.open { transform: translateY(0); }
  .cart-body { overflow-y: auto; padding-bottom: calc(16px + var(--safe)); }
  .cart-peek { min-height: 54px; padding: 8px 16px; border-radius: 16px 16px 0 0; }
  .cart-peek .peek-n { font-size: 14px; }
  .cart-peek .peek-t { margin-left: auto; font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; }
  .page-head { margin-bottom: 12px; }
  .page-head h1 { font-size: 21px; }
  .card { padding: 14px; }
  .stat .v { font-size: 20px; }
  .itemgrid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  table { font-size: 14px; }
  th, td { padding: 10px; }
  footer.site { padding-bottom: calc(84px + var(--safe)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
/* ---------- shared blocks used by the list pages ---------- */
.formbox { margin: 0 0 18px; }
.formbox h2 { display: flex; align-items: center; gap: 8px; }
.formbox h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--gold); flex: none; }
.card .k { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.card .v { font-size: 22px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; }
.card .s { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.card.hl { border-color: #f4cb68; background: var(--gold-50); }
.card.hl .v { color: #6a4800; }
.card.bad { border-color: var(--red-line); background: var(--red-50); }
.card.bad .v { color: #8d1f18; }
body.pos { padding-bottom: calc(154px + var(--safe)); }
.filter { margin: 0 0 16px; }
@media (min-width: 900px) { body.pos { padding-bottom: 0; } }

/* stat grids on the older list pages */
.grid { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
.topnav { overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
