/* Sweety Mart – mobile-first, works up to wide PC screens.
   Royal purple from the shop logo is the brand. Status colours carry meaning everywhere:
   green = ok / money in, amber = low / waiting, red = out / short / money out. */

:root {
  --bg: #f5f3fa;
  --bg-2: #ece7f5;
  --card: #ffffff;
  --ink: #191427;
  --ink-2: #463f58;
  --muted: #7d7690;
  --line: #e6e0f0;
  --line-2: #d8cfe8;

  --brand: #5b0fc8;
  --brand-2: #7c22e6;
  --brand-ink: #ffffff;
  --brand-soft: #ede4fd;
  --brand-softer: #f6f1fe;
  --accent: #d946ef;
  --grad: linear-gradient(135deg, #4a0aa8 0%, #5b0fc8 45%, #8b3cf2 100%);

  --green: #059669; --green-soft: #d1fae5; --green-ink: #065f46;
  --amber: #d97706; --amber-soft: #fef3c7; --amber-ink: #92400e;
  --red: #dc2626;   --red-soft: #fee2e2;   --red-ink: #991b1b;
  --blue: #2563eb;  --blue-soft: #dbeafe;  --blue-ink: #1e40af;
  --violet: #7c3aed; --violet-soft: #ede9fe;
  --teal: #0d9488; --teal-soft: #ccfbf1;

  --r-sm: 10px; --r: 16px; --r-lg: 22px;
  --sh-1: 0 1px 2px rgba(25, 20, 39, .05), 0 1px 3px rgba(25, 20, 39, .06);
  --sh-2: 0 4px 12px rgba(25, 20, 39, .07), 0 1px 3px rgba(25, 20, 39, .05);
  --sh-3: 0 12px 32px rgba(25, 20, 39, .12);
  --sh-brand: 0 8px 20px rgba(91, 15, 200, .28);
  --focus: 0 0 0 3px rgba(124, 34, 230, .28);
}

:root { color-scheme: light; --show-dark: inline-flex; --show-light: none; }

/* Dark colours: used when the phone/PC is in dark mode (unless White was chosen), or when Dark was chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0c18; --bg-2: #171225; --card: #1a1528; --ink: #f1edf9; --ink-2: #cbc3dc; --muted: #9890ad;
    --line: #2a2340; --line-2: #372e52;
    --brand: #a78bfa; --brand-2: #c4b5fd; --brand-ink: #14072e; --brand-soft: #2a1a4f; --brand-softer: #1f1439;
    --accent: #e879f9;
    --grad: linear-gradient(135deg, #4a0aa8 0%, #5b0fc8 45%, #8b3cf2 100%);
    --green: #34d399; --green-soft: #0f2e25; --green-ink: #6ee7b7;
    --amber: #fbbf24; --amber-soft: #33270c; --amber-ink: #fcd34d;
    --red: #f87171;   --red-soft: #3a1515;   --red-ink: #fca5a5;
    --blue: #60a5fa;  --blue-soft: #14233f;  --blue-ink: #93c5fd;
    --violet: #a78bfa; --violet-soft: #241a3d;
    --teal: #2dd4bf; --teal-soft: #0d2b29;
    --sh-1: 0 1px 2px rgba(0,0,0,.35); --sh-2: 0 4px 14px rgba(0,0,0,.35); --sh-3: 0 14px 34px rgba(0,0,0,.5);
    --sh-brand: 0 8px 22px rgba(124, 58, 237, .3);
    color-scheme: dark; --show-dark: none; --show-light: inline-flex;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0c18; --bg-2: #171225; --card: #1a1528; --ink: #f1edf9; --ink-2: #cbc3dc; --muted: #9890ad;
  --line: #2a2340; --line-2: #372e52;
  --brand: #a78bfa; --brand-2: #c4b5fd; --brand-ink: #14072e; --brand-soft: #2a1a4f; --brand-softer: #1f1439;
  --accent: #e879f9;
  --grad: linear-gradient(135deg, #4a0aa8 0%, #5b0fc8 45%, #8b3cf2 100%);
  --green: #34d399; --green-soft: #0f2e25; --green-ink: #6ee7b7;
  --amber: #fbbf24; --amber-soft: #33270c; --amber-ink: #fcd34d;
  --red: #f87171;   --red-soft: #3a1515;   --red-ink: #fca5a5;
  --blue: #60a5fa;  --blue-soft: #14233f;  --blue-ink: #93c5fd;
  --violet: #a78bfa; --violet-soft: #241a3d;
  --teal: #2dd4bf; --teal-soft: #0d2b29;
  --sh-1: 0 1px 2px rgba(0,0,0,.35); --sh-2: 0 4px 14px rgba(0,0,0,.35); --sh-3: 0 14px 34px rgba(0,0,0,.5);
  --sh-brand: 0 8px 22px rgba(124, 58, 237, .3);
  color-scheme: dark; --show-dark: none; --show-light: inline-flex;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", "Noto Sans", "Noto Sans Devanagari", sans-serif;
  padding-bottom: 92px; -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh;
}
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img { max-width: 100%; }
h1, h2, h3 { margin: 22px 0 12px; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 700; color: var(--ink-2); }
h1 small, h2 small { font-size: .78rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.pt { font-size: 1.5rem; font-weight: 800; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.red-text { color: var(--red) !important; } .green-text { color: var(--green) !important; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.ic { width: 22px; height: 22px; flex: 0 0 auto; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; background: color-mix(in srgb, var(--card) 85%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 1.08rem; text-decoration: none; letter-spacing: -.01em; }
.mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-1); flex: 0 0 auto; }
.mark img { width: 24px; height: 32px; object-fit: contain; display: block; }
.top-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: .9rem; flex: 0 0 auto; }
.who-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.who-text b { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.who-text small { font-size: .72rem; color: var(--muted); }
.lang { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); font-size: .8rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.lang .ic { width: 16px; height: 16px; }
.theme-btn { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--ink-2); font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.theme-btn:hover { border-color: var(--brand); color: var(--brand); }
.theme-btn > span { align-items: center; gap: 6px; }
.theme-btn .ic { width: 16px; height: 16px; }
.theme-btn .to-dark { display: var(--show-dark); }
.theme-btn .to-light { display: var(--show-light); }
.lang-short { display: none; }
@media (max-width: 480px) {
  .theme-btn > span > span, .lang-text { display: none; }
  .lang-short { display: inline; }
  .theme-btn, .lang { padding: 7px 10px; }
}
.lang:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 480px) { .who-text { display: none; } }

.shopbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px 0; color: var(--muted); }
.shopbar select { width: auto; margin: 0; padding: 8px 34px 8px 12px; border-radius: 999px; font-weight: 600; background-color: var(--card); }

.wrap { max-width: 860px; margin: 0 auto; padding: 6px 16px 28px; }

/* ---------- bottom bar (phones) ---------- */
.bottom {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; padding: 6px; gap: 4px; border-radius: 22px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); box-shadow: var(--sh-3);
}
.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; border-radius: 16px; font-size: .7rem; font-weight: 600; color: var(--muted); text-decoration: none; transition: background .15s, color .15s; }
.bottom a.on { color: var(--brand); background: var(--brand-soft); }
.bottom .ic { width: 23px; height: 23px; }

/* ---------- sidebar (PC) ---------- */
.side { display: none; }
.side-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 12px 6px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side a, .side-logout { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font: inherit; font-weight: 600; font-size: .93rem; background: none; border: 0; width: 100%; cursor: pointer; text-align: left; transition: background .15s, color .15s; }
.side a:hover, .side-logout:hover { background: var(--bg); color: var(--ink); }
.side a.on { background: var(--brand-soft); color: var(--brand); }
.side a.on .ic { stroke-width: 2.2; }
.side form { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.side-logout { color: var(--muted); }

/* ---------- cards, messages ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 14px 0; box-shadow: var(--sh-1); }
.card.narrow { max-width: 440px; margin: 28px auto; padding: 26px; box-shadow: var(--sh-3); border-radius: var(--r-lg); }
.card > summary, details > summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
.card > summary::-webkit-details-marker, details > summary::-webkit-details-marker { display: none; }
.card > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
.card[open] > summary::after { transform: rotate(-135deg); }
.card[open] > summary { margin-bottom: 8px; }
.dim { opacity: .55; }

.flash { display: flex; gap: 10px; align-items: center; padding: 13px 16px; border-radius: 14px; margin: 12px 0; background: var(--green-soft); color: var(--green-ink); font-weight: 600; border: 1px solid color-mix(in srgb, var(--green) 25%, transparent); animation: slide .25s ease-out; }
.flash.err { background: var(--red-soft); color: var(--red-ink); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } }
.alert { display: block; padding: 13px 16px; border-radius: 14px; margin: 10px 0; text-decoration: none; font-weight: 600; border: 1px solid transparent; border-left-width: 4px; }
.alert small { font-weight: 500; opacity: .8; }
.alert.yellow { background: var(--amber-soft); color: var(--amber-ink); border-color: var(--amber); }
.alert.red { background: var(--red-soft); color: var(--red-ink); border-color: var(--red); }
.alert.green { background: var(--green-soft); color: var(--green-ink); border-color: var(--green); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--r); margin: 14px 0; }
.empty .btn { margin-top: 12px; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); vertical-align: middle; }
.pill.green { background: var(--green-soft); color: var(--green-ink); }
.back { display: inline-flex; align-items: center; gap: 4px; margin: 10px 0 0; text-decoration: none; font-weight: 600; font-size: .9rem; color: var(--muted); }
.back:hover { color: var(--brand); }

/* ---------- login / setup ---------- */
body.guest { background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%), radial-gradient(900px 500px at 110% 10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%), var(--bg); padding-bottom: 24px; }
.login .logo-big, .card.narrow .logo-big { width: 92px; height: 92px; margin: 0 auto 6px; border-radius: 26px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-2); }
.logo-big img { width: 54px; height: 76px; object-fit: contain; }
.login .pt, .card.narrow .pt { justify-content: center; text-align: center; }

/* ---------- forms ---------- */
.form label, label { display: block; margin: 12px 0; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
input, select, textarea {
  width: 100%; font: inherit; font-size: 1rem; font-weight: 500; padding: 12px 14px; margin-top: 6px;
  border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--card); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--muted); font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23847a8c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; }
label.inline { display: flex; align-items: center; gap: 10px; font-weight: 500; }
fieldset { border: 1.5px dashed var(--line-2); border-radius: 14px; margin: 14px 0; padding: 6px 14px; }
legend { font-weight: 700; padding: 0 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.row input, .row select { width: auto; flex: 1; min-width: 100px; margin: 0; }
.row.between { justify-content: space-between; }
.row .pt { margin-bottom: 4px; }
.grow { flex: 1; min-width: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 12px 18px; font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--grad); color: #fff; box-shadow: var(--sh-brand); transition: transform .08s, box-shadow .15s, filter .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.98); }
.btn.big { display: flex; width: 100%; padding: 15px; font-size: 1.02rem; margin: 12px 0; border-radius: 14px; }
.btn.huge { display: flex; width: 100%; padding: 18px; font-size: 1.2rem; margin: 12px 0; border-radius: 16px; }
.btn.small { padding: 8px 14px; font-size: .85rem; border-radius: 10px; box-shadow: none; }
.btn.green { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 8px 18px rgba(5, 150, 105, .28); }
.btn.red { background: linear-gradient(135deg, #dc2626, #f43f5e); box-shadow: 0 8px 18px rgba(220, 38, 38, .25); }
.btn.ghost { background: var(--card); color: var(--ink-2); border: 1.5px solid var(--line-2); box-shadow: none; }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); filter: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); box-shadow: none; }
summary.btn { display: inline-flex; }

/* ---------- dashboard ---------- */
.hero {
  position: relative; overflow: hidden; display: block; text-align: center; padding: 26px 18px; margin: 14px 0;
  border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  font-size: 1.9rem; box-shadow: var(--sh-1);
}
.hero b { display: block; font-size: 1.25rem; margin-top: 6px; }
.hero b.huge { font-size: 2.6rem; font-weight: 800; letter-spacing: -.02em; margin: 2px 0; }
.hero small { display: block; font-size: .9rem; opacity: .85; font-weight: 500; }
.hero.green { background: linear-gradient(135deg, #059669, #10b981 60%, #34d399); color: #fff; border: 0; box-shadow: 0 12px 28px rgba(5, 150, 105, .3); }
.hero.red { background: var(--grad); color: #fff; border: 0; box-shadow: var(--sh-brand); }
a.hero.red::after { content: ""; position: absolute; inset: auto -40px -60px auto; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.12); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0; }
.stat { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--sh-1); overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); opacity: .85; }
.stat:nth-child(2)::before { background: var(--accent); }
.stat:nth-child(3)::before { background: var(--violet); }
.stat span { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat b { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat.big b { font-size: 1.9rem; }
.stat small { color: var(--muted); font-weight: 600; }
.stat.owner { background: linear-gradient(160deg, var(--brand-softer), var(--card) 70%); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; margin: 16px 0; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px 14px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink);
  font-weight: 700; font-size: .9rem; box-shadow: var(--sh-1); transition: transform .12s, box-shadow .15s, border-color .15s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--line-2); }
.tile span { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 1.7rem; background: var(--brand-soft); }
.tile:nth-child(6n+2) span { background: var(--amber-soft); }
.tile:nth-child(6n+3) span { background: var(--green-soft); }
.tile:nth-child(6n+4) span { background: var(--blue-soft); }
.tile:nth-child(6n+5) span { background: var(--violet-soft); }
.tile:nth-child(6n+6) span { background: var(--teal-soft); }
.tile small { font-weight: 500; color: var(--muted); font-size: .74rem; margin-top: -6px; }

.tabs { display: flex; gap: 4px; margin: 14px 0; padding: 4px; background: var(--bg-2); border-radius: 14px; }
.tabs a { flex: 1; text-align: center; padding: 10px; border-radius: 11px; text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: .92rem; transition: background .15s; }
.tabs a.on { background: var(--card); color: var(--brand); box-shadow: var(--sh-1); }

/* ---------- categories + product photo cards ---------- */
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.cats::-webkit-scrollbar { display: none; }
.cats a { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 76px; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-size: .78rem; font-weight: 600; scroll-snap-align: start; transition: all .15s; }
.cats a span { font-size: 1.55rem; line-height: 1.2; }
.cats a.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.search input { margin: 0 0 8px; padding-left: 42px; border-radius: 999px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23847a8c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center / 18px; }
.legend { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 8px 0 12px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.dot.green { background: var(--green); } .dot.yellow { background: var(--amber); } .dot.red { background: var(--red); } .dot.blue { background: var(--blue); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cards.small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.pcard {
  --st: var(--green); --st-soft: var(--green-soft);
  position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; text-decoration: none; color: var(--ink); padding: 0; font: inherit; text-align: left; cursor: pointer;
  box-shadow: var(--sh-1); transition: transform .12s, box-shadow .15s;
}
.pcard::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--st); }
.pcard.yellow { --st: var(--amber); --st-soft: var(--amber-soft); }
.pcard.red { --st: var(--red); --st-soft: var(--red-soft); }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.pcard img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg-2); }
.pcard span { display: block; padding: 9px 11px 13px; font-size: .86rem; font-weight: 600; line-height: 1.3; }
.pcard span b { font-weight: 800; color: var(--ink); font-size: .95rem; }
.pcard .qty { position: absolute; top: 8px; right: 8px; min-width: 42px; padding: 4px 10px; border-radius: 999px; text-align: center; font-size: 1.15rem; font-weight: 800; background: var(--st); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.pcard:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.5); }
.pcard.pop { transform: scale(.95); }
.fab { position: fixed; right: 18px; bottom: 104px; width: 58px; height: 58px; border-radius: 18px; background: var(--grad); color: #fff; font-size: 2rem; display: grid; place-items: center; text-decoration: none; box-shadow: var(--sh-brand); z-index: 35; }

/* stock detail */
.detail-photo { position: relative; }
.detail img.big { display: block; width: 100%; max-height: 380px; object-fit: contain; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--sh-1); }
.bigqty { position: absolute; top: 14px; right: 14px; background: var(--green); color: #fff; border-radius: 18px; padding: 8px 18px; font-size: 2.4rem; font-weight: 800; line-height: 1; text-align: center; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
.bigqty small { display: block; font-size: .68rem; font-weight: 600; opacity: .9; margin-top: 2px; }
.detail.yellow .bigqty { background: var(--amber); } .detail.red .bigqty { background: var(--red); }
.detail h1 { font-size: 1.45rem; }
.mover { margin: 14px 0; }
.stepper, .cqty { display: flex; align-items: center; justify-content: center; gap: 12px; }
.stepper button, .cqty button, .den button { width: 56px; height: 56px; border-radius: 16px; border: 1.5px solid var(--line-2); font-size: 1.7rem; font-weight: 700; background: var(--card); color: var(--ink); cursor: pointer; transition: all .1s; }
.stepper button:active, .cqty button:active, .den button:active { transform: scale(.94); background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.stepper input { width: 110px; text-align: center; font-size: 1.9rem; font-weight: 800; margin: 0; }
.photo-pick { display: block; text-align: center; padding: 18px; border: 2px dashed var(--line-2); border-radius: var(--r); cursor: pointer; background: var(--card); color: var(--ink-2); transition: border-color .15s, background .15s; }
.photo-pick:hover { border-color: var(--brand); background: var(--brand-softer); }
.photo-pick input { display: none; }
.photo-pick img { display: block; margin: 0 auto 10px; max-height: 220px; border-radius: 14px; object-fit: cover; }
.photo-pick.has-photo { border-style: solid; border-color: var(--green); background: var(--green-soft); color: var(--green-ink); }
.more-actions { margin: 14px 0; padding: 12px 14px; border-radius: var(--r); background: var(--bg-2); }
.more-actions summary { color: var(--ink-2); }

/* ---------- lists ---------- */
.list { list-style: none; padding: 0; margin: 10px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh-1); }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li > a { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-decoration: none; color: inherit; margin: -13px -16px; padding: 13px 16px; }
.list li > a:hover { background: var(--bg); }
.list li b { font-weight: 800; white-space: nowrap; }
.list li small { display: block; color: var(--muted); font-size: .8rem; font-weight: 500; }
.list li.sum { font-size: 1.15rem; background: var(--green-soft); color: var(--green-ink); }
.list li.muted { justify-content: center; }
.list .thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 10px; vertical-align: middle; margin-right: 6px; }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 1.05rem; font-weight: 600; padding: 14px 4px; }
.total b { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin-left: auto; }
.big-num { font-size: 1.35rem; font-weight: 800; }

/* ---------- bill cart ---------- */
.cart { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; margin-top: 18px; box-shadow: var(--sh-2); scroll-margin-top: 80px; }
.cart h2 { margin: 0 0 8px; color: var(--ink); font-size: 1.15rem; }
.cart-lines { list-style: none; padding: 0; margin: 0; }
.cart-lines li { display: grid; grid-template-columns: 1fr auto 92px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line-2); font-weight: 600; font-size: .92rem; }
.cart-lines li.muted { display: block; text-align: center; padding: 18px 0; font-weight: 500; }
.cart-lines li.bad .cprice { border-color: var(--red); color: var(--red); }
.cart-lines .cqty { gap: 8px; }
.cart-lines .cqty button { width: 34px; height: 34px; font-size: 1.1rem; border-radius: 10px; }
.cprice { margin: 0; padding: 8px 10px; text-align: right; font-weight: 700; }
.cart .total { border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.due { font-weight: 700; padding: 10px 14px; border-radius: 12px; margin: 6px 0; }
.due:empty { display: none; }
.due.green { color: var(--green-ink); background: var(--green-soft); }
.due.red { color: var(--red-ink); background: var(--red-soft); }
.cart details { margin: 8px 0; }
.cart details summary { font-weight: 600; color: var(--ink-2); font-size: .92rem; }
.cartbar {
  position: fixed; left: 14px; right: 14px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 35;
  display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-radius: 18px;
  background: var(--ink); color: var(--card); font-weight: 700; text-decoration: none; box-shadow: var(--sh-3);
}
.cartbar span:last-child { font-size: 1.15rem; font-weight: 800; }

/* ---------- note-coin counter ---------- */
.den { display: grid; grid-template-columns: 100px 52px 1fr 52px 96px; gap: 10px; align-items: center; padding: 10px; margin: 8px 0; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); box-shadow: var(--sh-1); transition: border-color .15s, background .15s; }
.den.has { border-color: var(--green); background: linear-gradient(90deg, var(--green-soft), var(--card) 60%); }
.den button { width: 52px; height: 52px; font-size: 1.5rem; }
.den input { text-align: center; font-size: 1.35rem; font-weight: 800; margin: 0; padding: 10px 4px; }
.den .sub { text-align: right; font-size: .98rem; font-weight: 800; color: var(--ink-2); }
.face { height: 52px; display: grid; place-items: center; border-radius: 10px; font-weight: 800; font-size: 1.05rem; color: #3b2a12; background: linear-gradient(135deg, #efe3c4, #d4bf8f); border: 2px solid rgba(0,0,0,.12); box-shadow: inset 0 0 0 3px rgba(255,255,255,.35); }
.note-inr .face { background: linear-gradient(135deg, #dcebd3, #a6c895); color: #1f3a17; }
.note-npr .face { background: linear-gradient(135deg, #f6dada, #dba4a4); color: #4a1616; }
.face.round { border-radius: 50%; width: 52px; margin: 0 auto; font-size: .78rem; background: radial-gradient(circle at 35% 30%, #f3f3f3, #a9a9a9); color: #222; }
.count-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 10px; }
.count-sum > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 8px; text-align: center; box-shadow: var(--sh-1); }
.count-sum span { display: block; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.count-sum b { font-size: 1.2rem; font-weight: 800; }
.count-sum .match { background: var(--green-soft); color: var(--green-ink); border-color: var(--green); }
.count-sum .short { background: var(--red-soft); color: var(--red-ink); border-color: var(--red); }
.count-sum .excess { background: var(--amber-soft); color: var(--amber-ink); border-color: var(--amber); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.chip { border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink-2); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; transition: all .12s; }
.chip:hover, .chip:active { border-color: var(--brand); color: var(--brand); background: var(--brand-softer); }

/* ---------- attendance + salary ---------- */
.att { display: flex; gap: 14px; align-items: flex-start; }
.avatar { width: 60px; height: 60px; border-radius: 18px; object-fit: cover; flex: 0 0 60px; }
.avatar.empty { display: grid; place-items: center; background: var(--bg-2); font-size: 1.7rem; }
.selfie img { width: 180px; height: 180px; border-radius: 50%; border: 4px solid var(--card); box-shadow: var(--sh-2); }
.monthnav { display: flex; justify-content: space-between; align-items: center; margin: 10px 0; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.monthnav a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; text-decoration: none; font-size: 1rem; background: var(--bg); color: var(--ink-2); }
.monthnav a:hover { background: var(--brand-soft); color: var(--brand); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin: 14px 0; text-align: center; }
.cal i { font-style: normal; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding-bottom: 2px; }
.cal .d { padding: 9px 0; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: .9rem; }
.cal .present { background: var(--green); color: #fff; border-color: transparent; }
.cal .half { background: var(--amber); color: #fff; border-color: transparent; }
.cal .absent, .cal .leave { background: var(--red-soft); color: var(--red); border-color: transparent; }
.cal .off { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.cal .future, .cal .none { opacity: .35; }
.cal .today { box-shadow: 0 0 0 2px var(--brand); }

/* ---------- reports ---------- */
.report-filter label.inline { margin: 0; }
.report-filter input[type=date] { width: auto; margin: 0; }
.list.bars li { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; }
.bar { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--grad); }

/* ---------- QR stickers ---------- */
.label-pick input { width: 84px; margin: 0; text-align: center; font-weight: 700; }
.sheet { display: none; }
@media print {
  @page { size: A4; margin: 8mm; }
  body.has-nav .no-print, .flash { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; }
  .sticker { display: flex; gap: 2.5mm; align-items: center; height: 30mm; padding: 2mm; border: .3mm dashed #999; border-radius: 2mm; break-inside: avoid; color: #000; }
  .sticker .qr { width: 24mm; height: 24mm; flex: 0 0 24mm; }
  .sticker .qr svg { width: 100%; height: 100%; }
  .sticker .txt { display: flex; flex-direction: column; min-width: 0; font-size: 8pt; line-height: 1.2; }
  .sticker b { font-size: 9pt; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .sticker strong { font-size: 12pt; margin-top: 1mm; }
}

/* ---------- QR scanner ---------- */
.scan-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(10, 6, 20, .82); }
.scan-box { width: min(420px, 100%); background: var(--card); border-radius: var(--r-lg); padding: 12px; box-shadow: var(--sh-3); }
.scan-box #scan-view { border-radius: 14px; overflow: hidden; }
.scan-box .btn { width: 100%; margin-top: 10px; }

/* ---------- layout helpers ---------- */
.top-right .lang { flex: 0 0 auto; }
.pos-layout { display: block; }
@media (max-width: 899px) { .desktop-only { display: none !important; } }

/* ---------- PC / tablet landscape ---------- */
@media (min-width: 900px) {
  body.has-nav { padding: 0 0 0 248px; }
  .top { padding: 12px 32px; }
  body.has-nav .top .brand { visibility: hidden; }
  .side { display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; width: 248px; padding: 18px 14px; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; z-index: 31; }
  .side .side-brand { padding: 2px 6px 18px; color: var(--ink); font-weight: 800; font-size: 1.08rem; }
  .side .side-brand:hover { background: none; }
  .bottom, .cartbar, .fab { display: none !important; }
  .shopbar { padding: 14px 32px 0; }
  .wrap { max-width: 1200px; padding: 8px 32px 48px; }
  .pt { font-size: 1.85rem; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
  .cards.small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
  .stat { padding: 18px 20px; }
  .stat b { font-size: 1.8rem; }
  .card.narrow { margin-top: 56px; }
  .form, .counter, .mover { max-width: 680px; }
  .detail { display: grid; grid-template-columns: 420px 1fr; gap: 32px; text-align: left; align-items: start; }
  .detail h1 { margin-top: 0; }
  .split, .count-wrap, .kamai-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; max-width: none; }
  .settings-grid > .btn { grid-column: 1 / -1; max-width: 320px; }
  .narrow-actions { max-width: 520px; }
  .mobile-only { display: none !important; }
  .pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 24px; align-items: start; }
  .pos-layout .cart { position: sticky; top: 84px; margin-top: 0; max-height: calc(100vh - 104px); overflow: auto; }
  .att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 0 16px; }
  .cats a { min-width: 88px; padding: 11px 14px; font-size: .85rem; }
}

@media (max-width: 420px) {
  .den { grid-template-columns: 76px 44px 1fr 44px; }
  .den .sub { grid-column: 1 / -1; text-align: right; margin-top: -4px; }
  .den button { width: 44px; height: 44px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .pt { font-size: 1.35rem; }
}

@media print {
  .top, .bottom, .side, .shopbar, .btn, .back, .cartbar { display: none !important; }
  body, body.has-nav { padding: 0; background: #fff; color: #000; }
  .card, .list { box-shadow: none; }
}

/* ---------- business units (retail / logistics) ---------- */
.unit-switch a { font-size: .88rem; }
.side-units { margin: 0 0 10px; }
.side-units a { padding: 8px 6px; font-size: .78rem; }
@media (min-width: 900px) { main .unit-switch { display: none; } }
.unit-pick label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 12px; border-radius: 11px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.unit-pick input { position: absolute; opacity: 0; pointer-events: none; }
.unit-pick label:has(input:checked) { background: var(--card); color: var(--brand); box-shadow: var(--sh-1); }

/* clearing job steps */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 14px 0; }
.step { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: .74rem; font-weight: 600; color: var(--muted); padding: 10px 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.step span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); font-weight: 800; }
.step.done { color: var(--green-ink); border-color: var(--green); background: var(--green-soft); }
.step.done span { background: var(--green); color: #fff; }
.step.now { color: var(--brand); border-color: var(--brand); background: var(--brand-softer); }
.step.now span { background: var(--brand); color: #fff; }
@media (max-width: 480px) { .step { font-size: .62rem; padding: 8px 2px; } }
