/* Dr. Vape - dark glass / violet theme
   Mobile first. Desktop layers a sidebar on top of the same components. */

/* ------------------------------------------------------------------ tokens */
:root {
  --accent: #7c6cf6;
  --accent-2: #a78bfa;
  --accent-soft: rgba(124, 108, 246, 0.16);
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --info: #38bdf8;

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  --shadow-soft: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --tap: 46px;

  --font: "Segoe UI", "Noto Sans Arabic", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --nav-h: 68px;
  --header-h: 60px;
}

[data-theme="dark"] {
  --bg: #0b0a1a;
  --bg-glow-1: rgba(124, 108, 246, 0.22);
  --bg-glow-2: rgba(56, 189, 248, 0.12);
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.075);
  --panel-solid: #16142c;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ededfb;
  --muted: #9c97c4;
  --faint: #6f6a94;
  --input-bg: rgba(255, 255, 255, 0.05);
  --overlay: rgba(6, 5, 16, 0.72);
}

[data-theme="light"] {
  --bg: #f2f1fb;
  --bg-glow-1: rgba(124, 108, 246, 0.22);
  --bg-glow-2: rgba(56, 189, 248, 0.14);
  --panel: rgba(255, 255, 255, 0.75);
  --panel-2: #ffffff;
  --panel-solid: #ffffff;
  --border: rgba(24, 20, 60, 0.1);
  --border-strong: rgba(24, 20, 60, 0.2);
  --text: #191434;
  --muted: #5f5a80;
  --faint: #8b86ab;
  --input-bg: rgba(255, 255, 255, 0.85);
  --overlay: rgba(30, 26, 60, 0.45);
}

/* -------------------------------------------------------------------- base */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Soft violet glows behind everything, like the reference mockup. */
body::before {
  content: "";
  position: fixed;
  inset: -30% -20% auto -20%;
  height: 70vh;
  background:
    radial-gradient(45% 55% at 20% 20%, var(--bg-glow-1), transparent 70%),
    radial-gradient(40% 50% at 85% 10%, var(--bg-glow-2), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Inline sprite icons default to a sane size; component rules override. */
.ic { width: 17px; height: 17px; flex: none; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ------------------------------------------------------------------ shell */
/* No z-index here on purpose. Giving .shell a z-index makes it a stacking
   context, which traps the cart sheet (z-index 60) inside it — the backdrop
   (z-index 55, a sibling of .shell) would then paint over the cart and swallow
   every tap, including Checkout. Position alone is enough to sit above the
   background glow, which is painted earlier. */
.shell { position: relative; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px -6px var(--accent);
  flex: none;
}
.brand-mark svg { width: 19px; height: 19px; color: #fff; }
.brand-name {
  font-weight: 700; font-size: 15px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { font-size: 11px; color: var(--faint); margin-top: -3px; }

.topbar-spacer { flex: 1; }

.icon-btn {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; }

.shift-chip {
  display: none;
  align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap;
}
.shift-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.shift-chip.open .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.shift-chip.open { color: var(--text); }

/* --------------------------------------------------------------- sidebar */
.sidebar { display: none; }

/* ------------------------------------------------------------------- main */
.main {
  padding: 16px 14px calc(var(--nav-h) + 26px);
  max-width: 1500px;
  margin: 0 auto;
}

/* Deliberately no animation on .page. Animating opacity or transform here makes
   the page a stacking context AND a containing block, which traps the
   position:fixed cart sheet inside it — the backdrop then paints on top and
   eats every tap, Checkout included. A cosmetic fade is not worth that. */
.page { display: none; }
.page.active { display: block; }

.page-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.page-head h1 { font-size: 21px; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .grow { flex: 1; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 650; margin-bottom: 12px;
}
.card-title .grow { flex: 1; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* stat tiles */
.stat {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.stat .label {
  font-size: 11.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  display: flex; align-items: center; gap: 6px;
}
.stat .value { font-size: 22px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; }
.stat .value small { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat .delta { font-size: 12px; margin-top: 4px; color: var(--muted); }
.stat .delta.up { color: var(--ok); }
.stat .delta.down { color: var(--bad); }
.stat.feature {
  background: linear-gradient(140deg,
    color-mix(in srgb, var(--accent) 88%, #000),
    color-mix(in srgb, var(--accent-2) 70%, transparent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 20px 40px -22px var(--accent);
}
.stat.feature .label, .stat.feature .delta { color: rgba(255, 255, 255, .82); }
.stat.feature::after {
  content: ""; position: absolute; right: -30px; top: -40px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255, 255, 255, .16);
}

/* ---------------------------------------------------------------- buttons */
.btn {
  height: var(--tap);
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: transform .1s, filter .15s, background .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 12px 26px -14px var(--accent);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: color-mix(in srgb, var(--bad) 18%, transparent); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.btn.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.btn.sm { height: 34px; padding: 0 11px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.lg { height: 54px; font-size: 16px; border-radius: 16px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- inputs */
.field { display: block; margin-bottom: 12px; }
.field > span {
  display: block; font-size: 12px; color: var(--muted);
  margin-bottom: 6px; font-weight: 550;
}
.input, select.input, textarea.input {
  width: 100%;
  height: var(--tap);
  padding: 0 13px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 11px 13px; min-height: 84px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239c97c4' stroke-width='2.2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-inline-end: 34px;
}
[dir="rtl"] select.input { background-position: left 12px center; }

.search-wrap { position: relative; flex: 1; min-width: 140px; }
.search-wrap svg {
  position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%); width: 17px; height: 17px; color: var(--faint);
  pointer-events: none;
}
.search-wrap .input { padding-inline-start: 38px; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 12px; }
.switch input { display: none; }
.switch .track {
  width: 44px; height: 26px; border-radius: 999px;
  background: var(--input-bg); border: 1px solid var(--border);
  position: relative; transition: background .18s, border-color .18s; flex: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--faint); transition: transform .18s, background .18s;
}
.switch input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .track::after { background: var(--accent); transform: translateX(18px); }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-18px); }

/* ------------------------------------------------------------------ chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 36px; padding: 0 14px; flex: none;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 550; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
}

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.tag.ok   { color: var(--ok);   background: color-mix(in srgb, var(--ok) 14%, transparent);   border-color: color-mix(in srgb, var(--ok) 32%, transparent); }
.tag.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.tag.bad  { color: var(--bad);  background: color-mix(in srgb, var(--bad) 14%, transparent);  border-color: color-mix(in srgb, var(--bad) 32%, transparent); }
.tag.info { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); border-color: color-mix(in srgb, var(--info) 32%, transparent); }

/* ------------------------------------------------------------------ lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  transition: background .15s, border-color .15s;
}
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: var(--panel-2); border-color: var(--border-strong); }
.row .main-col { flex: 1; min-width: 0; }
.row .title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.row .amount { font-weight: 700; font-size: 15px; white-space: nowrap; text-align: end; }
.row .amount small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }

.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2);
  font-weight: 700; font-size: 14px;
}

/* ----------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
table.data th {
  text-align: start; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--panel); }
table.data td.num, table.data th.num { text-align: end; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------- POS */
.pos-layout { display: block; }
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.tile {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 10px;
  cursor: pointer;
  text-align: start;
  display: flex; flex-direction: column; gap: 6px;
  min-height: 108px;
  transition: transform .12s, border-color .15s, background .15s;
}
.tile:active { transform: scale(.96); }
.tile:hover { border-color: var(--accent); background: var(--panel-2); }
.tile .thumb {
  height: 44px; border-radius: 11px;
  background: linear-gradient(140deg, var(--accent-soft), transparent);
  display: grid; place-items: center;
  color: var(--accent-2); font-weight: 700; font-size: 15px;
  overflow: hidden;
}
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .name { font-size: 12.5px; font-weight: 600; line-height: 1.25; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .price { font-size: 13px; font-weight: 700; color: var(--accent-2); }
.tile .stock-badge {
  position: absolute; top: 7px; inset-inline-end: 7px;
  font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 7px;
  background: var(--panel-2); color: var(--muted);
}
.tile .stock-badge.low { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.tile .stock-badge.out { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }
.tile.disabled { opacity: .45; }

/* floating cart button (mobile) */
.cart-fab {
  position: fixed;
  inset-inline: 14px;
  bottom: calc(var(--nav-h) + 12px);
  height: 56px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  font-weight: 700; font-size: 15px;
  box-shadow: 0 18px 36px -14px var(--accent);
  z-index: 45;
  cursor: pointer;
}
.cart-fab.show { display: flex; }
.cart-fab .count {
  width: 28px; height: 28px; border-radius: 9px;
  background: rgba(255, 255, 255, .22);
  display: grid; place-items: center; font-size: 13px;
}
.cart-fab .grow { flex: 1; text-align: start; }

/* cart sheet / panel
   The checkout button lives at the bottom of this sheet, so its position must
   never depend on an animation finishing or on `vh` guessing the viewport. */
.cart-panel {
  position: fixed; inset: auto 0 0 0;
  max-height: 88vh;             /* fallback for older browsers */
  max-height: 88dvh;            /* the part of the screen actually visible on a phone */
  background: var(--panel-solid);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  z-index: 60;
  display: none;
  flex-direction: column;
}
/* No entry animation either: the till must be tappable the instant it appears. */
.cart-panel.open { display: flex; }

.cart-handle { padding: 10px 0 4px; display: grid; place-items: center; flex: none; }
.cart-handle span { width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); }
.cart-head { display: flex; align-items: center; gap: 10px; padding: 4px 16px 10px; flex: none; }
/* min-height:0 is what lets this shrink instead of shoving the footer off the
   screen once the basket has more lines than fit. */
.cart-items { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px; flex: 1 1 auto; min-height: 0; }
.cart-foot {
  flex: none;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--panel-solid);
}

.cart-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-line:last-child { border-bottom: none; }
.cart-line .main-col { flex: 1; min-width: 0; }
.cart-line .title { font-size: 13.5px; font-weight: 600; }
.cart-line .unit { font-size: 11.5px; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button {
  width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-2);
  display: grid; place-items: center; cursor: pointer; font-size: 16px; line-height: 1;
}
.qty input {
  width: 42px; height: 30px; text-align: center;
  border-radius: 9px; border: 1px solid var(--border);
  background: var(--input-bg); font-variant-numeric: tabular-nums;
}
.total-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; color: var(--muted); }
.total-row.grand { font-size: 19px; font-weight: 750; color: var(--text); padding-top: 8px; }

.backdrop {
  position: fixed; inset: 0; background: var(--overlay);
  backdrop-filter: blur(3px); z-index: 55;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.backdrop.show { opacity: 1; pointer-events: auto; }

/* ----------------------------------------------------------------- modals */
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: none; align-items: flex-end; justify-content: center;
}
.modal.open { display: flex; }
.modal-box {
  width: 100%; max-width: 560px;
  max-height: 92vh;             /* fallback */
  max-height: 92dvh;            /* real visible height on a phone */
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  animation: sheet-up .26s cubic-bezier(.32, .72, 0, 1);
}
/* Scale, never translate: a translated sheet whose animation is throttled
   (background tab, reduced motion, low-power mode) would rest below the
   screen edge and hide the Save button. Scaling always stays in bounds. */
@keyframes sheet-up {
  from { transform: scale(.97); opacity: .4; }
  to   { transform: none; opacity: 1; }
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 10px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; flex: 1; }
/* min-height:0 for the same reason as the cart: a long form must scroll here
   rather than push the Save button past the bottom of the screen. */
.modal-body { padding: 16px; overflow-y: auto; overscroll-behavior: contain;
              flex: 1 1 auto; min-height: 0; }
.modal-foot {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}
.modal-foot .btn { flex: 1; }

/* ------------------------------------------------------------- bottom nav */
.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.bottom-nav button {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 10.5px; font-weight: 600;
  position: relative; padding: 0;
}
.bottom-nav button svg { width: 21px; height: 21px; }
.bottom-nav button.active { color: var(--accent-2); }
.bottom-nav button.active::before {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px;
  border-radius: 0 0 4px 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* "More" sheet */
.more-sheet {
  position: fixed; inset: auto 0 0 0; z-index: 60;
  background: var(--panel-solid);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--border-strong);
  padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform .28s cubic-bezier(.32, .72, 0, 1);
  box-shadow: var(--shadow);
}
.more-sheet.open { transform: none; }
.more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.more-grid button {
  border: 1px solid var(--border); background: var(--panel);
  border-radius: var(--radius-sm); padding: 12px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--text); cursor: pointer;
}
.more-grid button svg { width: 20px; height: 20px; color: var(--accent-2); }

/* ----------------------------------------------------------------- charts */
.chart { width: 100%; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .bar { fill: url(#barGrad); }
.chart .area { fill: url(#areaGrad); }
.chart .line { fill: none; stroke: var(--accent-2); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--accent-2); }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.bar-track { height: 8px; border-radius: 999px; background: var(--input-bg); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ----------------------------------------------------------------- misc */
.empty {
  text-align: center; padding: 34px 16px; color: var(--muted);
}
.empty svg { width: 42px; height: 42px; color: var(--faint); margin-bottom: 10px; }
.empty p { margin: 0 0 4px; font-weight: 600; color: var(--text); }
.empty small { font-size: 12.5px; }

.toast-wrap {
  position: fixed; inset-inline: 0; top: 12px; z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-in .25s ease;
  max-width: min(92vw, 420px);
  display: flex; align-items: center; gap: 9px;
}
.toast.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
@keyframes toast-in { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite;
  height: 62px;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.money { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.seg {
  display: inline-flex; padding: 3px; gap: 3px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--panel);
}
.seg button {
  border: none; background: none; cursor: pointer;
  padding: 7px 13px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.seg button.active { background: var(--accent-soft); color: var(--accent-2); }

.split { display: flex; gap: 8px; }
.split > * { flex: 1; }

/* ------------------------------------------------------------- responsive */
@media (min-width: 640px) {
  .main { padding: 20px 22px calc(var(--nav-h) + 26px); }
  .grid-auto { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .shift-chip { display: inline-flex; }
  .modal { align-items: center; }
  .modal-box { border-radius: var(--radius-lg); max-height: 86vh; }
  .modal-foot { padding-bottom: 12px; }
}

@media (min-width: 1024px) {
  :root { --nav-h: 0px; }

  .shell { display: grid; grid-template-columns: 250px 1fr; }

  .sidebar {
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    padding: 16px 12px;
    border-inline-end: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(18px);
    overflow-y: auto;
  }
  .sidebar .brand { padding: 6px 8px 18px; }
  .nav-group { margin-bottom: 14px; }
  .nav-group > h4 {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--faint); padding: 0 10px; margin-bottom: 6px;
  }
  .nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 11px; border-radius: 12px;
    font-size: 13.5px; font-weight: 570; color: var(--muted);
    cursor: pointer; border: 1px solid transparent;
    transition: background .15s, color .15s;
  }
  .nav-link svg { width: 18px; height: 18px; flex: none; }
  .nav-link:hover { background: var(--panel); color: var(--text); }
  .nav-link.active {
    background: linear-gradient(135deg, var(--accent-soft), transparent);
    border-color: color-mix(in srgb, var(--accent) 32%, transparent);
    color: var(--text);
  }
  .nav-link.active svg { color: var(--accent-2); }
  .nav-link .badge {
    margin-inline-start: auto; font-size: 10.5px; font-weight: 700;
    padding: 1px 7px; border-radius: 999px;
    background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad);
  }
  .sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

  .bottom-nav, .cart-fab, .more-sheet { display: none !important; }
  .topbar { padding: 0 22px; }
  .main { padding: 22px 26px 40px; }
  .page-head h1 { font-size: 24px; }

  .grid-2 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-2.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* POS becomes grid + fixed cart column */
  .pos-layout { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
  /* On a computer the cart is a permanent column, not a sheet, so it is always
     shown regardless of the .open class the phone layout toggles. */
  .cart-panel, .cart-panel.open {
    display: flex;
    position: sticky; inset: auto; top: 78px;
    max-height: calc(100vh - 100px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    animation: none;
  }
  .cart-handle { display: none; }
  .table-wrap { margin: 0; padding: 0; }
}

@media (min-width: 1400px) {
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --------------------------------------------------------------- printing */
@media print {
  .topbar, .sidebar, .bottom-nav, .cart-fab, .more-sheet, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}
