/* ================================================================
   DryFruit POS — warm premium theme
   ================================================================ */
:root {
  --bg: #f6f1e7;
  --card: #fffdf9;
  --card-2: #fbf7ee;
  --border: #eadfce;
  --border-2: #dfd2bc;
  --ink: #2b2118;
  --ink-2: #6b5d4d;
  --muted: #9a8b78;
  --accent: #b45309;
  --accent-2: #d97706;
  --accent-soft: #fdf0e0;
  --green: #15803d;
  --green-soft: #e8f5ec;
  --red: #c0392b;
  --red-soft: #fdecea;
  --blue: #2a78d6;
  --violet: #7c3aed;
  --teal: #0b8f6b;
  --gold: #b8860b;
  --shadow: 0 1px 2px rgba(70, 45, 10, .06), 0 4px 14px rgba(70, 45, 10, .07);
  --shadow-lg: 0 8px 40px rgba(50, 30, 5, .18);
  --radius: 14px;
  --side-w: 236px;
  --grid: #ece5d8;
  --chart-1: #b45309;      /* single-series hue      */
  --cat-1: #c2410c;        /* categorical: cash      */
  --cat-2: #0b8f6b;        /*              upi       */
  --cat-3: #2a78d6;        /*              card      */
  --cat-4: #7c3aed;        /*              split     */
  font-size: 15px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
::placeholder { color: var(--muted); }

/* ---------------- scrollbars ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ================= LOGIN ================= */
/* ================= SIGN IN =================
   Two halves. The left is the shop - deep roasted brown, warm light bleeding
   through it, the goods drifting past. The right is quiet on purpose, so the eye
   lands on the one thing there is to do. Nothing here hints at how to get in. */
#login-screen {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--bg); overflow: hidden;
}

/* ---- the shop's half ---- */
.login-stage {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  justify-content: center; padding: clamp(32px, 5vw, 72px);
  background: linear-gradient(155deg, #2b1c0d 0%, #3d2713 45%, #241708 100%);
  color: #f6ecdc; isolation: isolate;
}
.stage-orb {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; z-index: -1;
  pointer-events: none;
}
.orb-a { width: 460px; height: 460px; top: -130px; left: -110px; background: #e0922c; }
.orb-b { width: 420px; height: 420px; right: -140px; bottom: -150px; background: #b8452f; opacity: .42; }
/* a whisper of grain so the gradient does not look like flat plastic */
.stage-grain {
  position: absolute; inset: 0; z-index: -1; opacity: .09; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stage-float { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.stage-float span {
  position: absolute; left: var(--x); top: var(--y); font-size: var(--s);
  opacity: .18; animation: drift 13s ease-in-out infinite; animation-delay: var(--d);
}
@keyframes drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-22px) rotate(8deg); }
}

.stage-body { max-width: 540px; animation: rise .6s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.stage-mark { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.stage-logo {
  width: 54px; height: 54px; display: grid; place-items: center; font-size: 27px;
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 17px; backdrop-filter: blur(6px);
}
.stage-kicker {
  font-size: 11.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: #e8b878;
}
.login-stage h1 {
  font-size: clamp(30px, 3.4vw, 46px); line-height: 1.08; letter-spacing: -.025em;
  margin-bottom: 14px; color: #fff;
}
.stage-tag { font-size: clamp(14.5px, 1.2vw, 17px); line-height: 1.5; color: #d8c5ab; max-width: 440px; }
.stage-points { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 15px; }
.stage-points li { display: flex; gap: 13px; align-items: flex-start; }
.stage-points i {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center; font-style: normal;
  font-size: 16px; background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 11px;
}
.stage-points span { display: block; font-size: 13.5px; line-height: 1.45; color: #c9b89f; }
.stage-points b { display: block; color: #fff; font-size: 14.5px; font-weight: 700; margin-bottom: 1px; }
.stage-foot {
  position: relative; margin-top: 38px; font-size: 12px; color: #a6937c;
  display: flex; align-items: center; gap: 8px;
}
.stage-foot .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #5fc47f;
  box-shadow: 0 0 0 3px rgba(95, 196, 127, .22);
}

/* ---- the form's half ---- */
.login-panel {
  display: grid; place-items: center; padding: clamp(24px, 4vw, 56px);
  background:
    radial-gradient(620px 420px at 110% 8%, #f6e3c4 0%, transparent 58%),
    radial-gradient(520px 380px at -15% 95%, #f0e6d2 0%, transparent 60%),
    linear-gradient(160deg, #efe7d8 0%, #f3ece0 100%);
}
.login-card {
  width: 100%; max-width: 392px;
  background: var(--card); border: 1px solid var(--border); border-radius: 24px;
  padding: clamp(28px, 3vw, 38px) clamp(24px, 2.6vw, 34px) 26px;
  border-color: #e3d6c0;
  box-shadow: 0 30px 64px -28px rgba(60, 35, 5, .40), 0 3px 10px rgba(60, 35, 5, .07);
  animation: rise .55s cubic-bezier(.2, .7, .3, 1) .08s both;
}
.login-card h2 { font-size: clamp(22px, 2vw, 27px); letter-spacing: -.02em; margin-bottom: 5px; }
.login-sub { color: var(--muted); font-size: 13.5px; line-height: 1.45; margin-bottom: 24px; }
.login-card .fld { margin-bottom: 15px; }
.login-card .fld > span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.login-card .fld input {
  padding: 13px 15px; font-size: 15px; border-radius: 12px; background: var(--card-2);
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.login-card .fld input::placeholder { color: #bdb0a0; }
.login-card .fld input:focus {
  background: var(--card); border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
/* the eye lives inside the field, so the row reads as one control */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 46px !important; }
.pw-eye {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; background: none; cursor: pointer;
  font-size: 15px; line-height: 1; border-radius: 9px; opacity: .55; transition: opacity .12s, background .12s;
}
.pw-eye:hover { opacity: 1; background: var(--card-2); }
.login-note { font-size: 12.5px; color: var(--accent); font-weight: 600; margin: -5px 0 13px; }
.login-error {
  background: var(--red-soft); color: var(--red); border-radius: 12px;
  padding: 11px 14px; font-size: 13.5px; margin-bottom: 14px; line-height: 1.4;
  animation: shake .32s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.login-card .btn-lg {
  padding: 14px; font-size: 15.5px; border-radius: 13px; margin-top: 4px;
  background: linear-gradient(135deg, var(--accent) 0%, #a9521a 100%);
  box-shadow: 0 10px 22px -12px rgba(169, 82, 26, .8);
  transition: transform .12s ease, box-shadow .16s ease, filter .12s;
}
.login-card .btn-lg:hover { transform: translateY(-1px); filter: brightness(1.05); }
.login-card .btn-lg:active { transform: translateY(0); }
.login-card .btn-lg:disabled { filter: grayscale(.4); transform: none; }
.login-foot { margin-top: 20px; font-size: 12.5px; color: var(--muted); line-height: 1.45; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .stage-float span, .stage-body, .login-card, .login-error { animation: none; }
  .login-card .btn-lg { transition: none; }
}
/* one column on a phone: the shop becomes a header strip, the form takes the rest */
@media (max-width: 900px) {
  #login-screen { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-stage { padding: 30px 24px 26px; }
  .stage-points, .stage-foot { display: none; }
  .login-stage h1 { font-size: 26px; }
  .stage-tag { font-size: 13.5px; }
  .stage-mark { margin-bottom: 16px; }
  .login-panel { padding: 26px 20px 40px; align-items: start; }
}

/* ================= APP SHELL ================= */
#app { display: flex; min-height: 100vh; }
#sidebar {
  width: var(--side-w); flex: 0 0 var(--side-w);
  background: linear-gradient(180deg, #33241a 0%, #241708 100%);
  color: #efe6d8; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px; }
.side-logo {
  font-size: 24px; width: 44px; height: 44px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); border-radius: 12px;
}
.side-name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.side-sub { font-size: 11.5px; color: #b9a88f; text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
#side-nav { flex: 1; padding: 8px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10.5px 12px; border: 0; background: transparent; color: #d8cbb6;
  border-radius: 10px; margin-bottom: 2px; font-size: 14.5px; text-align: left;
  transition: background .12s ease;
}
.nav-item .ni { font-size: 17px; width: 22px; text-align: center; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: var(--accent-2); color: #fff; font-weight: 600; box-shadow: 0 2px 10px rgba(217, 119, 6, .4); }
.nav-sep { margin: 10px 12px 6px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #8d7c63; }
.side-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-user { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-2); color: #fff; font-weight: 700; font-size: 15px; flex: none;
}
.side-user-name { font-size: 13.5px; font-weight: 600; }
.link-btn { background: none; border: 0; color: #b9a88f; font-size: 12px; padding: 0; text-decoration: underline; }
.link-btn:hover { color: #fff; }

#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px 0;
}
#page-title { font-size: 23px; }
.today-chip {
  background: var(--card); border: 1px solid var(--border); color: var(--ink-2);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.net-pill {
  position: fixed; top: 12px; right: 20px; z-index: 90;
  border: 0; border-radius: 999px; padding: 9px 16px; font-size: 12.5px; font-weight: 700;
  cursor: pointer; box-shadow: var(--shadow-lg);
}
.net-pill.off { background: var(--red); color: #fff; animation: pulse-red 1.6s infinite; }
.net-pill.sync { background: #fdf3d7; color: #92660a; border: 1px solid #eeddae; }
@keyframes pulse-red { 0%,100% { box-shadow: 0 0 0 0 rgba(192,57,43,.35); } 50% { box-shadow: 0 0 0 6px rgba(192,57,43,0); } }
#page { padding: 20px 28px 40px; flex: 1; }

/* ================= PRIMITIVES ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border-2); background: var(--card); color: var(--ink);
  padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  transition: transform .05s ease, box-shadow .12s ease, background .12s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: #fff; color: var(--red); border-color: #eec5bf; }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--card-2); box-shadow: none; }
.btn-lg { padding: 13px 20px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }

.chip {
  border: 1px solid var(--border-2); background: var(--card); border-radius: 999px;
  padding: 6px 13px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: all .12s;
}
.chip:hover { border-color: var(--accent-2); color: var(--accent); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.fld { display: block; margin-bottom: 13px; }
.fld > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.fld input, .fld select, .fld textarea, .input {
  width: 100%; padding: 9.5px 12px; border: 1px solid var(--border-2);
  border-radius: 10px; background: #fff; outline: none; transition: border .12s, box-shadow .12s;
}
.fld input:focus, .fld select:focus, .fld textarea:focus, .input:focus {
  border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(217, 119, 6, .15);
}
.fld-row { display: flex; gap: 12px; }
.fld-row .fld { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px 20px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; padding: 3px 9px;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--accent-soft); color: var(--accent); }
.badge-gray { background: #f0ece3; color: var(--ink-2); }
.badge-gold { background: #fdf3d7; color: #92660a; }
.badge-plat { background: #eceef6; color: #4a5578; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td { padding: 10.5px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--card-2); }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-click tbody tr { cursor: pointer; }

/* toolbar rows */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar .input { width: 230px; }

/* stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow);
}
.stat .s-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }
.stat .s-value { font-size: 25px; font-weight: 800; margin-top: 6px; letter-spacing: -0.02em; }
.stat .s-sub { font-size: 12px; color: var(--ink-2); margin-top: 3px; }

/* drill-down cards / rows — clickable affordance */
[data-go], [data-tab] { cursor: pointer; transition: transform .08s ease, box-shadow .12s ease, border-color .12s; }
.stat[data-go]:hover, .stat[data-tab]:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.stat[data-go]:active, .stat[data-tab]:active { transform: translateY(0); }
.low-item[data-go]:hover { background: var(--card-2); }
[data-go]:focus-visible, [data-tab]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { [data-go], [data-tab] { transition: none; } .stat[data-go]:hover, .stat[data-tab]:hover { transform: none; } }

/* ================= POS ================= */
/* The counter screen: products on the left, the whole right side is the running bill
   (customer on top, items below), and one full-width bar along the bottom carries the
   figures and the payment modes. The bar is sticky so Pay is always under the hand. */
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, min(50vw, 100% - 358px));
  grid-template-areas: "tiles cart" "bottom bottom";
  gap: 18px; align-items: start;
}
.pos-left { grid-area: tiles; }
.pos-layout .cart { grid-area: cart; }
.pos-bottom {
  grid-area: bottom; position: sticky; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: minmax(300px, 1fr) minmax(360px, 42%);
  gap: 10px 20px; align-items: end; padding: 4px 4px 6px;
  box-shadow: 0 -6px 22px rgba(60, 35, 5, .10);
}
.pos-bottom .cart-totals { border-top: 0; padding: 10px 6px 4px 16px; }
.pos-bottom .tot-inputs { margin: 0 0 6px; }
.pos-pay { padding: 10px 16px 10px 6px; }
.pay-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.pay-quick .pq { font-weight: 700; font-size: 13.5px; padding: 10px 6px; }
.pos-bottom .cart-actions { padding: 0; }
.pos-search-row { display: flex; gap: 10px; margin-bottom: 12px; }
.pos-search-row .input { flex: 1; padding: 12px 16px; font-size: 15px; border-radius: 12px; box-shadow: var(--shadow); border-color: var(--border); }
.cat-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.prod-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 13px 13px 11px; cursor: pointer; text-align: left; position: relative;
  transition: transform .08s ease, box-shadow .12s ease, border-color .12s;
  box-shadow: var(--shadow);
}
.prod-card:hover { transform: translateY(-2px); border-color: var(--accent-2); box-shadow: 0 6px 20px rgba(120, 70, 10, .14); }
.prod-card:active { transform: translateY(0); }
.prod-emoji { font-size: 26px; }
.prod-name { font-weight: 650; font-size: 13.5px; line-height: 1.28; margin: 7px 0 7px; min-height: 34px; }
.prod-price { font-weight: 800; font-size: 15px; }
.prod-price small { font-weight: 600; color: var(--muted); font-size: 11px; }
.prod-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; }
.prod-pts { font-size: 11px; color: var(--accent); font-weight: 700; }
.prod-stock { font-size: 11px; color: var(--muted); font-weight: 600; }
.prod-stock.low { color: var(--red); }
.prod-stock.out { color: var(--red); font-weight: 800; }
/* out of stock: dimmed but still legible, with an explicit badge */
.prod-card.oos { opacity: .72; background: var(--card-2); }
.prod-card.oos .prod-photo, .prod-card.oos .prod-emoji { filter: grayscale(1); opacity: .75; }
.prod-oos {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .04em;
  background: var(--red-soft); color: var(--red); border-radius: 6px; padding: 2px 7px; margin-bottom: 5px;
}
.prod-card.expired { border-color: #eec5bf; background: #fff8f6; }
.prod-photo {
  width: 100%; height: 74px; object-fit: cover; border-radius: 9px; display: block;
  background: var(--card-2);
}
body.pos-full .prod-photo { height: 92px; }
.prod-img { object-fit: cover; border-radius: 8px; background: var(--card-2); flex: none; }
.img-row { display: flex; gap: 14px; align-items: center; margin-bottom: 13px; }
.img-preview {
  width: 84px; height: 84px; border-radius: 12px; border: 1px dashed var(--border-2);
  display: grid; place-items: center; font-size: 34px; overflow: hidden; background: var(--card-2); flex: none;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.prod-exp {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .04em;
  background: var(--red-soft); color: var(--red); border-radius: 6px; padding: 2px 7px; margin-bottom: 5px;
}
.prod-exp.soon { background: var(--accent-soft); color: var(--accent); }
.expired-box { text-align: center; padding: 8px 6px; }
.expired-box p { font-size: 14px; color: var(--ink-2); }

/* cart */
.cart { position: sticky; top: 16px; display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 260px; }
.cart-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.cart-head h3 { font-size: 15px; }
.cust-box { padding: 12px 16px; border-bottom: 1px dashed var(--border-2); background: var(--card-2); border-radius: 0; }
.cust-attached { display: flex; align-items: center; gap: 10px; }
.cust-attached .avatar { background: var(--green); }
.cust-info { flex: 1; min-width: 0; }
.cust-name { font-weight: 700; font-size: 13.5px; }
/* a matched phone names the customer right under the field, so the counter
   confirms who it is without reading a one-row result list */
.cust-hit {
  margin-top: 7px; padding: 7px 10px; cursor: pointer;
  background: var(--green-soft); border: 1px solid #bfe0c9; border-radius: 10px;
}
.cust-hit:hover { border-color: var(--green); }
.cust-hit .ch-name { font-size: 15px; font-weight: 800; color: var(--green); line-height: 1.2; }
.cust-hit .ch-sub, .cust-new .ch-sub { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; }
.cust-new { margin-top: 7px; padding: 8px 10px; background: var(--card); border: 1px dashed var(--border-2); border-radius: 10px; }
.cust-pts { font-size: 12px; color: var(--ink-2); }
.cart-items { flex: 1; overflow-y: auto; padding: 6px 0; min-height: 90px; }
.cart-empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 13.5px; }
.cart-empty .ce { font-size: 34px; display: block; margin-bottom: 8px; opacity: .7; }
.cart-line { display: flex; align-items: center; gap: 9px; padding: 8px 14px; }
.cart-line:hover { background: var(--card-2); }
.cl-emoji { font-size: 19px; }
.cl-body { flex: 1; min-width: 0; }
.cl-name { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-sub { font-size: 11.5px; color: var(--muted); }
.cl-qty { display: flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--border-2);
  background: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; color: var(--ink-2);
}
.qty-btn:hover { border-color: var(--accent-2); color: var(--accent); }
.cl-qty .q { min-width: 46px; text-align: center; font-size: 12.5px; font-weight: 700; cursor: pointer; border-bottom: 1px dashed var(--border-2); }
.cl-amt { font-weight: 750; font-size: 13.5px; min-width: 68px; text-align: right; font-variant-numeric: tabular-nums; }
.cl-x { border: 0; background: none; color: var(--muted); font-size: 15px; padding: 2px 4px; }
.cl-x:hover { color: var(--red); }
.cart-totals { border-top: 1px solid var(--border); padding: 12px 16px 8px; font-size: 13.5px; }
.tot-row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--ink-2); }
.tot-row .tv { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.tot-row.grand { font-size: 19px; font-weight: 800; color: var(--ink); padding-top: 8px; margin-top: 6px; border-top: 2px solid var(--ink); }
.tot-row.grand .tv { font-weight: 800; }
.tot-inputs { display: flex; gap: 8px; margin: 8px 0 4px; }
.tot-inputs .fld { margin: 0; flex: 1; }
.tot-inputs input { padding: 7px 10px; font-size: 13px; }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 8px; padding: 10px 16px 16px; }
.redeem-hint { font-size: 11.5px; color: var(--accent); font-weight: 600; }

/* payment modal specifics */
.pay-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.pay-mode {
  border: 1.5px solid var(--border-2); background: #fff; border-radius: 12px;
  padding: 11px 6px; text-align: center; font-weight: 700; font-size: 13px;
}
.pay-mode .pm-ico { display: block; font-size: 20px; margin-bottom: 3px; }
.pay-mode.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pay-total-banner {
  background: linear-gradient(135deg, #33241a, #241708); border-radius: 14px; color: #fff;
  padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.pay-total-banner .amt { font-size: 27px; font-weight: 800; }
.change-line { font-size: 14px; font-weight: 700; color: var(--green); min-height: 20px; margin-bottom: 6px; }

/* success modal */
.sale-done { text-align: center; padding: 6px 4px 2px; }
.sale-done .big { font-size: 48px; }
.sale-done h3 { font-size: 19px; margin: 8px 0 3px; }
.sale-done .inv { color: var(--muted); font-size: 13px; }
.pts-earned {
  margin: 14px auto 4px; background: var(--accent-soft); color: var(--accent);
  border-radius: 12px; padding: 10px 16px; font-weight: 700; font-size: 14px; display: inline-block;
}
.done-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }

/* ================= MODALS / TOASTS ================= */
#modal-root {
  position: fixed; inset: 0; background: rgba(35, 22, 8, .45); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 20px; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: calc(100vh - 60px); display: flex; flex-direction: column;
  animation: pop .16s ease;
}
.modal.modal-lg { max-width: 780px; }
.modal.modal-xl { max-width: 980px; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px 0; }
.modal-head h3 { font-size: 17px; }
.modal-x { border: 0; background: var(--card-2); width: 30px; height: 30px; border-radius: 9px; font-size: 15px; color: var(--ink-2); }
.modal-x:hover { background: var(--border); }
.modal-body { padding: 16px 20px 20px; overflow-y: auto; }
.modal-foot { padding: 0 20px 20px; display: flex; gap: 10px; justify-content: flex-end; }

#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #2b2118; color: #fff; border-radius: 12px; padding: 11px 18px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: pop .18s ease;
  display: flex; gap: 8px; align-items: center; max-width: 480px;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* ================= CHARTS ================= */
.chart-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 14px; }
.chart-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-card { padding: 16px 18px 12px; }
.chart-card h3 { font-size: 14px; margin-bottom: 4px; }
.chart-card .ch-sub { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.chart-svg { width: 100%; display: block; }
.chart-svg text { font-family: system-ui, -apple-system, sans-serif; }
.bar-rect { transition: opacity .1s; }
.bar-rect:hover { opacity: .8; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend .lg { display: flex; align-items: center; gap: 7px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3.5px; flex: none; }
.legend .lg b { color: var(--ink); font-variant-numeric: tabular-nums; }

.hbar-row { display: grid; grid-template-columns: minmax(110px, 1.1fr) 2fr auto; align-items: center; gap: 10px; padding: 5.5px 0; font-size: 13px; }
.hbar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); font-weight: 600; }
.hbar-track { background: var(--card-2); border-radius: 6px; height: 16px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--chart-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-val { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
.hbar-pct { display: inline-block; min-width: 42px; text-align: right; margin-left: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
/* narrow screens are already tight here — drop the alignment reserve so the
   percentage costs as little width as possible */
@media (max-width: 700px) { .hbar-pct { min-width: 0; margin-left: 4px; font-size: 10.5px; } }

.low-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.low-item:last-child { border-bottom: 0; }
.low-item .ln { flex: 1; font-weight: 600; }

/* report tabs */
.tabs { display: flex; gap: 4px; background: var(--card-2); border: 1px solid var(--border); padding: 4px; border-radius: 12px; width: max-content; margin-bottom: 16px; }
.tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font-weight: 650; font-size: 13.5px; color: var(--ink-2); }
.tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }

.tier { font-size: 10.5px; }

kbd {
  background: var(--card-2); border: 1px solid var(--border-2); border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 6px; font-size: 11px; font-family: inherit; font-weight: 700; color: var(--ink-2);
}
.kbd-bar { display: flex; gap: 16px; margin-top: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }

.empty-state { text-align: center; color: var(--muted); padding: 44px 20px; }
.empty-state .es { font-size: 40px; display: block; margin-bottom: 10px; opacity: .75; }

/* ---------- dedicated POS screen (focus mode) ---------- */
body.pos-full #sidebar, body.pos-full #topbar { display: none; }
body.pos-full #page { padding: 14px 18px 20px; }
body.pos-full .pos-layout { grid-template-columns: minmax(0, 1fr) minmax(440px, min(52vw, 100% - 380px)); }
body.pos-full .pos-bottom { bottom: -14px; }
body.pos-full .prod-grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
body.pos-full .prod-card { padding: 16px 15px 13px; }
body.pos-full .prod-emoji { font-size: 32px; }
body.pos-full .prod-name { font-size: 14.5px; }
body.pos-full .cart { height: calc(100vh - 200px); }
body.pos-full .kbd-bar { display: none; }

/* ---------- ⋯ dropdown menu ---------- */
.pop-menu { position: absolute; z-index: 300; background: var(--card); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 176px; }
.pop-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--ink); }
.pop-item:hover { background: var(--card-2); }
.pop-item.danger { color: var(--red); }
.btn-dots { font-size: 17px; line-height: 1; padding: 5px 11px; letter-spacing: 1px; }
tr.low-row td { background: #fff6f4; }
tr.low-row td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* ---------- blocked "stamp slam" feedback ---------- */
.block-stamp {
  position: fixed; inset: 0; z-index: 260; display: grid; place-items: center;
  pointer-events: none; background: rgba(150, 25, 12, .10); animation: bs-bgin .12s ease;
}
.block-stamp.out { animation: bs-bgout .24s ease forwards; }
.block-stamp .bs-card {
  pointer-events: auto; cursor: pointer; background: #fff;
  border: 3px solid var(--red); border-radius: 20px; padding: 22px 40px; text-align: center;
  box-shadow: 0 18px 60px rgba(120, 20, 10, .35); animation: bs-slam .42s cubic-bezier(.2, 1.4, .35, 1);
}
.block-stamp.out .bs-card { animation: bs-out .22s ease forwards; }
.bs-emoji { font-size: 50px; line-height: 1; display: inline-block; animation: bs-wob .55s ease .12s both; }
.bs-title { font-size: 22px; font-weight: 800; color: var(--red); margin-top: 8px; letter-spacing: -.01em; }
.bs-sub { font-size: 14px; color: var(--ink-2); font-weight: 600; margin-top: 3px; }
@keyframes bs-slam { 0% { transform: scale(2.3) rotate(-9deg); opacity: 0; } 55% { transform: scale(.88) rotate(3deg); } 100% { transform: scale(1) rotate(-2deg); opacity: 1; } }
@keyframes bs-out { to { transform: scale(.55) rotate(-2deg); opacity: 0; } }
@keyframes bs-bgin { from { opacity: 0; } }
@keyframes bs-bgout { to { opacity: 0; } }
@keyframes bs-wob { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.shake { animation: shake .36s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .block-stamp .bs-card, .bs-emoji, .shake { animation-duration: .01ms; } }

/* ---------- weight / amount entry (POS qty modal) ---------- */
.qty-head { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 13px; }
.qty-head b { color: var(--ink); font-size: 14px; }
.wchip-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.wchip {
  border: 1.5px solid var(--border-2); background: #fff; border-radius: 12px;
  padding: 9px 4px; display: grid; gap: 1px; justify-items: center;
  transition: all .1s;
}
.wchip b { font-size: 14px; }
.wchip small { font-size: 11px; color: var(--muted); font-weight: 600; }
.wchip:hover { border-color: var(--accent); background: var(--accent-soft); }
.wchip:hover small { color: var(--accent); }
.qty-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 10px; }
.qm { border: 0; background: transparent; border-radius: 9px; padding: 8px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.qm.active { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.qty-display-wrap {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  border-bottom: 2px solid var(--border-2); padding: 2px 0 6px; margin-bottom: 6px;
}
.qty-display {
  border: 0 !important; outline: none; background: transparent; box-shadow: none !important;
  font-size: 38px; font-weight: 800; text-align: center; width: 190px;
  font-variant-numeric: tabular-nums; padding: 0 !important; color: var(--ink); letter-spacing: -0.01em;
}
.qty-unit { font-size: 19px; font-weight: 800; color: var(--muted); }
.qty-conv { text-align: center; font-size: 14px; color: var(--ink-2); min-height: 22px; margin-bottom: 12px; }
.qty-conv b { color: var(--ink); font-size: 15px; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 0 auto; }
.np-btn {
  border: 1px solid var(--border-2); background: #fff; border-radius: 12px;
  font-size: 19px; font-weight: 700; padding: 12px 0; color: var(--ink);
  transition: background .08s;
}
.np-btn:hover { background: var(--accent-soft); border-color: var(--accent-2); }
.np-btn:active { transform: translateY(1px); }
@media (max-width: 560px) { .wchip-row { grid-template-columns: repeat(3, 1fr); } }

/* ---------- cash drawer / denominations ---------- */
.denom-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px 14px; }
.denom-row { display: grid; grid-template-columns: 44px 12px 1fr 60px; align-items: center; gap: 6px; }
.denom-row .dl { font-weight: 800; font-size: 13px; text-align: right; }
.denom-row .dx { color: var(--muted); text-align: center; }
.denom-row input { padding: 7px 9px; font-size: 13.5px; text-align: center; }
.denom-row .da { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.denom-total {
  margin-top: 12px; background: var(--card-2); border: 1px dashed var(--border-2); border-radius: 10px;
  padding: 10px 14px; display: flex; justify-content: space-between; font-size: 14px;
}
.denom-total b { font-size: 17px; }
.variance-line { margin-top: 10px; font-weight: 700; font-size: 14px; min-height: 20px; color: var(--muted); }
.btn-warn { background: var(--accent-soft); border-color: var(--accent-2); color: var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(217,119,6,.35); } 50% { box-shadow: 0 0 0 5px rgba(217,119,6,0); } }
@media (max-width: 720px) { .denom-grid { grid-template-columns: 1fr; } }

/* ---------- OTP approval ---------- */
.otp-box {
  background: var(--accent-soft); border: 1px dashed var(--accent-2); border-radius: 12px;
  padding: 12px 14px; margin: 10px 0;
}
.otp-title { font-weight: 700; font-size: 13.5px; color: var(--accent); }
.appr-code {
  font-size: 30px; font-weight: 800; letter-spacing: .14em; font-variant-numeric: tabular-nums;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 18px;
}

@media (max-width: 1100px) {
  .pos-layout, body.pos-full .pos-layout { grid-template-columns: 1fr; grid-template-areas: "tiles" "cart" "bottom"; }
  .pos-bottom { grid-template-columns: 1fr; align-items: stretch; }
  .cart { position: static; height: auto; max-height: 60vh; }
  .cart { position: static; max-height: none; }
  .chart-grid, .chart-grid-2, .grid-2 { grid-template-columns: 1fr; }
}

/* Products list grouped by category */
.cat-row > td {
  background: var(--card-2); border-top: 1px solid var(--border-2); border-bottom: 1px solid var(--border);
  padding: 8px 12px !important; position: sticky; top: 0; z-index: 1;
}
.cat-row .cat-name { font-weight: 800; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; color: var(--accent); }
.cat-row .cat-count { font-size: 11.5px; color: var(--muted); margin-left: 8px; font-weight: 600; }
.cat-row .badge { margin-left: 8px; }

/* split payment entry in the pay modal */
.split-box { margin: 2px 0 10px; padding: 10px 12px; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; }
.split-box .sp-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.split-box .fld span { font-size: 12px; }
.split-box input { padding: 8px 10px; font-size: 14px; font-weight: 700; }
.sp-sum { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 8px; font-size: 13.5px; font-weight: 700; }
.sp-sum .bad { color: var(--red); }
.sp-sum .sp-need { font-size: 11.5px; font-weight: 600; color: var(--muted); }

/* split payment legs in sales history and the sale detail */
.split-legs { font-size: 11px; line-height: 1.3; margin-top: 2px; white-space: nowrap; }
.tot-row.sub { color: var(--ink-2); font-size: 12.5px; }
.tot-row.sub .tv { font-weight: 600; }

/* owner-approved login step */
.login-otp {
  background: var(--accent-soft); border: 1px solid #eed6b4; border-radius: 12px;
  padding: 11px 13px; margin-bottom: 12px;
}
.login-otp .lo-head { font-weight: 800; font-size: 13.5px; color: var(--accent); }
.login-otp .lo-sub { font-size: 12px; color: var(--ink-2); margin: 3px 0 8px; line-height: 1.35; }
.login-otp input {
  width: 100%; padding: 10px 12px; font-size: 20px; font-weight: 800; letter-spacing: .28em;
  text-align: center; border: 1px solid var(--border-2); border-radius: 10px; background: #fff;
}

/* purchases: product search picker (replaces a 250-item dropdown) */
.np-pick { position: relative; }
.np-results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px;
  background: var(--card); border: 1px solid var(--border-2); border-radius: 10px;
  box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto;
}
.np-res {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 8px 11px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.np-res:last-child { border-bottom: 0; }
.np-res:hover { background: var(--accent-soft); }
.np-r-name { display: block; font-weight: 700; font-size: 13.5px; }
.np-r-sub { display: block; font-size: 11.5px; color: var(--muted); }
.np-res-none { padding: 10px 12px; font-size: 12.5px; color: var(--muted); }
.np-chosen {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--green-soft); border: 1px solid #bfe0c9; border-radius: 10px;
}
.np-ch-name { font-weight: 800; font-size: 13.5px; flex: 1; }
.np-ch-sub { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.np-ch-x { border: 0; background: none; cursor: pointer; font-size: 14px; color: var(--ink-2); padding: 0 2px; }

/* ---- Roles & access ---- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.role-card { display: flex; flex-direction: column; gap: 8px; }
.role-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role-head h3 { margin: 0; }
.role-powers { margin: 0 0 2px 16px; padding: 0; font-size: 12.5px; color: var(--ink-2); }
.role-powers li { margin: 2px 0; }
.role-pages { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-static { cursor: default; font-size: 11.5px; padding: 3px 9px; }
.role-users { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--border); }
.input-sm { padding: 5px 8px; font-size: 12.5px; }
@media (max-width: 680px) { .role-grid { grid-template-columns: 1fr; } }

/* who the next bill will be recorded against — the counter changes hands mid-day */
.billing-as {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 800; letter-spacing: .01em; vertical-align: middle;
}
.cart-head h3 { display: flex; align-items: center; gap: 2px; }

/* count of WhatsApp orders still waiting for an answer */
.nav-badge {
  margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800; text-align: center;
}

/* the delivery round, step by step, on a WhatsApp order */
.wa-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.wa-step {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--card-2); color: var(--muted); border: 1px solid var(--border);
}
.wa-step.done { background: var(--green-soft); color: var(--green); border-color: var(--green); }

/* the payment screenshot, where the counter decides whether to send the delivery */
.pay-proof {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--card-2);
}
.proof-img {
  display: block; margin: 8px auto; max-width: 100%; max-height: 320px;
  border-radius: 10px; border: 1px solid var(--border-2); background: #fff;
}

/* the WhatsApp conversation, under the orders */
.chat-wrap { display: grid; grid-template-columns: minmax(200px, 270px) minmax(0, 1fr); min-height: 340px; }
.chat-list { border-right: 1px solid var(--border); max-height: 440px; overflow-y: auto; }
.chat-item {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--border); padding: 9px 12px; cursor: pointer; font: inherit; color: inherit;
}
.chat-item:hover { background: var(--card-2); }
.chat-item.active { background: var(--accent-soft); }
.ci-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.ci-last { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 4px; }
.chat-thread { display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.chat-msgs { flex: 1; overflow-y: auto; max-height: 360px; padding: 12px 14px; background: var(--card-2); }
.bub { max-width: 78%; margin-bottom: 8px; padding: 7px 10px; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.bub.out { margin-left: auto; background: var(--green-soft); border-color: #bfe0c9; }
.bub.failed { background: var(--red-soft); border-color: #e8bcbc; }
.bub .bt { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.bub .bm { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.chat-send { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.chat-send .input { flex: 1; }
@media (max-width: 760px) { .chat-wrap { grid-template-columns: 1fr; } .chat-list { max-height: 180px; border-right: 0; border-bottom: 1px solid var(--border); } }

/* a photo the customer sent, inside its bubble */
.bub-img { display: block; max-width: 220px; max-height: 240px; border-radius: 9px; }

/* ================= ROLE MODULES, OWN BILLS, BILL QR ================= */
/* which screens each role may open: one row per screen, one box per role */
.mod-tbl th.num, .mod-tbl td.num { width: 110px; text-align: center; }
.mod-tbl td.num input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.mod-tbl td.num input:disabled { cursor: not-allowed; opacity: .5; }
.mod-tbl tr.grp td {
  background: var(--card-2); font-size: 11.5px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); padding-top: 9px; padding-bottom: 9px;
}
.tot-row td { border-top: 2px solid var(--ink); background: var(--card-2); }

/* the sidebar footer now holds two links, so they need something between them */
.link-sep { color: #6d5c47; font-size: 12px; margin: 0 5px; }

/* OWN: goods the owner takes. Deliberately not the accent colour - it is not a sale */
.btn-own {
  background: #3d2713; color: #f3e3cc; border-color: #3d2713;
  font-weight: 800; letter-spacing: .04em;
}
.btn-own:hover { background: #50341a; border-color: #50341a; }
.own-banner { background: linear-gradient(135deg, #3d2713, #241708); }

/* the QR block on screen previews of the bill */
.qr-blk img.qr { background: #fff; }

/* the WhatsApp welcome: shown as the customer's phone would stack it */
.wa-preview {
  white-space: pre-wrap; word-break: break-word;
  background: #e7f6d8; border: 1px solid #cfe6b8; border-radius: 12px 12px 12px 3px;
  padding: 12px 14px; font-size: 14px; line-height: 1.5; color: #1f2b16;
  max-width: 420px;
}
textarea.input { min-height: 90px; resize: vertical; font-family: inherit; line-height: 1.45; }
