/* =====================================================================
   StockHub dashboard – design system
   Calm, fast, legible: one accent, cool-biased neutrals, tabular numbers,
   light + dark themes tuned separately. All colours are tokens.
   ===================================================================== */

@font-face { font-family: 'Titillium Web'; src: url('/fonts/Titillium_Web/TitilliumWeb-Light.ttf') format('truetype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Titillium Web'; src: url('/fonts/Titillium_Web/TitilliumWeb-Regular.ttf') format('truetype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Titillium Web'; src: url('/fonts/Titillium_Web/TitilliumWeb-SemiBold.ttf') format('truetype'); font-weight: 550 649; font-display: swap; }
@font-face { font-family: 'Titillium Web'; src: url('/fonts/Titillium_Web/TitilliumWeb-Bold.ttf') format('truetype'); font-weight: 650 900; font-display: swap; }
@font-face { font-family: 'Dosis'; src: url('/fonts/Dosis/Dosis-VariableFont_wght.ttf') format('truetype'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/vendor/inter.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef1f5;
  --text: #0f1729;
  --muted: #5a6477;          /* 5.9:1 on white */
  --faint: #8a93a3;          /* icons / decorative only */
  --line: #e3e7ed;
  --line-strong: #cfd5de;
  --line-soft: #eef1f4;

  --primary: #2f5bea;        /* white text 5.3:1 */
  --on-primary: #ffffff;

  --green: #0f7a4f;  --green-soft: #e2f5ec;
  --red: #c8261f;    --red-soft: #fde9e7;
  --amber: #955800;  --amber-soft: #fdf0d6;
  --blue: #2446c2;   --blue-soft: #e8eeff;
  --purple: #6b3fd6; --purple-soft: #f0eafe;
  --gray-soft: #eef1f5;

  --inverse: #0f1729;
  --inverse-text: #f4f6f9;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 41, .05);
  --shadow: 0 1px 2px rgba(15, 23, 41, .04), 0 4px 16px rgba(15, 23, 41, .05);
  --shadow-lg: 0 12px 40px rgba(15, 23, 41, .18);
  --sidebar-w: 252px;
  --topbar-h: 60px;

  --font-body: 'Titillium Web', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-head: 'Dosis', 'Titillium Web', system-ui, sans-serif;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Dark theme – tuned separately, not inverted */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f16;
  --surface: #121822;
  --surface-2: #171e2a;
  --surface-3: #1e2633;
  --text: #e7ebf2;
  --muted: #9ba5b4;          /* 7:1 on surface */
  --faint: #6c7686;
  --line: #242c39;
  --line-strong: #323b4a;
  --line-soft: #1c2330;
  --primary: #4470f5;        /* white text 4.6:1 */
  --green: #3fcf8e;  --green-soft: #0f2a1f;
  --red: #ff7a70;    --red-soft: #321716;
  --amber: #f3b64c;  --amber-soft: #2f230c;
  --blue: #8ea9ff;   --blue-soft: #1a2442;
  --purple: #b9a0ff; --purple-soft: #261d42;
  --gray-soft: #1e2633;
  --inverse: #e7ebf2;
  --inverse-text: #0b0f16;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); }
body { min-height: 100vh; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
h4 { font-size: 14px; font-weight: 650; margin-bottom: 8px; }
p { line-height: 1.55; }
img { max-width: 100%; }
::selection { background: var(--primary-soft); }
.icon { flex-shrink: 0; vertical-align: middle; }

/* numbers line up in columns */
.money, .value, .h1, .h2, .table td.r, .table th.r, .total-row, .price, .stat .value, .mini-stats b { font-variant-numeric: tabular-nums; }

/* ---------- focus: always visible for keyboard users ---------- */
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
button:focus:not(:focus-visible) { outline: none; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 14.5px; padding: 9px 12px; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 0; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); margin: 0; flex-shrink: 0; }
input[type=range] { padding: 0; min-height: 0; border: none; accent-color: var(--primary); }
input[type=color] { padding: 3px; }
input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.static { padding: 9px 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; margin: 0; cursor: pointer; color: var(--text); }
.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
.inline input, .inline select { width: auto; }
.qty-input { width: 84px !important; }
.note-input { width: 260px; }
.big-input { font-size: 22px; font-weight: 700; }
.color-input { width: 64px; height: 40px; }
.small-select { padding: 5px 30px 5px 10px; min-height: 32px; font-size: 13px; width: auto; }
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 18px; }
.col-span { grid-column: 1 / -1; }
.flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 15px;
  border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s, transform .06s, box-shadow .12s; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.secondary { background: var(--primary-soft); border-color: transparent; color: var(--primary-text); box-shadow: none; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-outline { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn.danger-outline:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.ghost.danger { color: var(--red); background: transparent; }
.btn.small { min-height: 32px; padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.xl { min-height: 52px; padding: 12px 20px; font-size: 16px; border-radius: 12px; }
.btn.full { width: 100%; }
.icon-btn { background: none; border: none; min-width: 34px; min-height: 34px; padding: 7px; border-radius: 9px; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-soft); }
.icon-btn:disabled { opacity: .45; cursor: default; }

/* ---------- layout shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 6px; }
.brand-mark { width: 34px; height: 34px; border-radius: var(--radius-md); background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex-shrink: 0; }
.brand-name { font-weight: 750; font-size: 16px; letter-spacing: -0.02em; line-height: 1.1; }
.store-name { font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.3; }
.logo { font-weight: 750; letter-spacing: -0.02em; }
.rate-box { margin: 10px 14px 4px; padding: 7px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md);
  font-size: 12.5px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rate-box b { color: var(--text); font-variant-numeric: tabular-nums; }
.rate-edit { background: none; border: none; color: var(--primary-text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }
.rate-form { display: flex; gap: 4px; width: 100%; }
.rate-form input { padding: 4px 8px; min-height: 30px; font-size: 13px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-height: 38px; border-radius: 9px; color: var(--muted); font-weight: 550; font-size: 14px; margin: 1px 0; }
.sidebar nav a .icon { color: var(--faint); }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--primary-soft); color: var(--primary-text); }
.sidebar nav a.active .icon { color: var(--primary-text); }
.sidebar nav a.pos-link { background: var(--primary); color: var(--on-primary); margin: 8px 0; box-shadow: var(--shadow-sm); }
.sidebar nav a.pos-link .icon { color: inherit; }
.sidebar nav a.pos-link:hover { background: var(--primary-hover); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 650; padding: 16px 10px 5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-right: 2px; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.user-chip { color: var(--text); display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 14px; min-width: 0; }
.user-chip:hover { text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0; }
.user-chip .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .role { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs b { color: var(--text); font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.search-trigger { margin-left: auto; display: flex; align-items: center; gap: 8px; width: min(360px, 40vw); min-height: 38px; padding: 6px 10px 6px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--faint); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.search-trigger:hover { border-color: var(--faint); }
.search-trigger span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: 600 11px/1 var(--font-body); padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--muted); }
.content { padding: 24px 28px 64px; width: 100%; max-width: 1480px; margin: 0 auto; }
.mobile-bar, .backdrop, .bottom-nav, .topbar .menu-btn { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; max-width: 72ch; }
.biz-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.biz-head::before { content: ''; width: 6px; align-self: stretch; border-radius: 6px; background: var(--biz); }
.biz-head h1 { font-size: 24px; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--surface-3);
  border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs a { display: flex; align-items: center; gap: 7px; padding: 8px 14px; min-height: 38px; color: var(--muted); font-weight: 600; font-size: 14px;
  border-radius: 9px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs a.active .icon { color: var(--primary); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card h3 { margin-bottom: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.gap, .gap { gap: 10px; }
.center-y { align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; } .mt-xs { margin-top: 4px; } .pad { padding: 16px; }
.mr-auto { margin-right: auto; }
.muted { color: var(--muted); } .small { font-size: 13px; } .strong { font-weight: 600; }
.c, .center { text-align: center; } .r { text-align: right; } .l { text-align: left; }
.mono { font-family: ui-monospace, 'SF Mono', Consolas, Menlo, monospace; font-size: .92em; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); }
.h1 { font-size: 36px; font-weight: 750; letter-spacing: -0.02em; } .h2 { font-size: 24px; font-weight: 700; } .h3 { font-size: 17px; font-weight: 650; }
.dim { opacity: .55; }
.hide-mobile {} .only-mobile { display: none !important; }

/* loading: shimmering placeholder instead of plain text */
.loading { position: relative; color: transparent; min-height: 120px; border-radius: var(--radius-lg); overflow: hidden;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear; user-select: none; }
.loading.full { min-height: 100vh; border-radius: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat .label .icon { color: var(--faint); }
.stat .value { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; margin: 8px 0 2px; line-height: 1.1; }
.stat .sub { color: var(--muted); font-size: 13px; }
.stat.attention { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.stat.attention .value { color: var(--amber); }
.trend { font-size: 12.5px; font-weight: 650; padding: 2px 7px; border-radius: 999px; }
.trend.up { color: var(--green); background: var(--green-soft); }
.trend.down { color: var(--red); background: var(--red-soft); }
.spark { width: 100%; height: 34px; margin-top: 8px; display: block; }
.spark path.line { fill: none; stroke: var(--primary); stroke-width: 2; }
.spark path.area { fill: var(--primary-soft); }

.biz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.biz-card { display: block; color: inherit; margin: 0; position: relative; overflow: hidden; }
.biz-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--biz, var(--primary)); }
.biz-card.link { transition: box-shadow .15s, transform .15s, border-color .15s; }
.biz-card.link:hover { text-decoration: none; box-shadow: var(--shadow); border-color: var(--line-strong); transform: translateY(-1px); }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.mini-stats div { display: flex; flex-direction: column; }
.mini-stats b { font-size: 16px; font-weight: 700; }
.mini-stats span { font-size: 12px; color: var(--muted); }
.pending-banner { margin-top: 12px; background: var(--amber-soft); color: var(--amber); padding: 8px 11px; border-radius: 9px; font-weight: 600; font-size: 13.5px; }

/* home screen */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hello h1 { font-size: 26px; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.quick a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, transform .12s; }
.quick a:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.quick .qi { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
.quick b { display: block; font-size: 14.5px; }
.quick span { font-size: 12.5px; color: var(--muted); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); color: var(--text); }
.list-row:last-child { border-bottom: none; }
a.list-row:hover { text-decoration: none; background: var(--surface-2); margin: 0 -10px; padding: 10px; border-radius: 9px; }
.list-row .grow b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .grow span { font-size: 12.5px; color: var(--muted); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.section-title h3 { margin: 0; }

/* ---------- toolbar & filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar select { width: auto; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 0 12px;
  flex: 1; min-width: 240px; color: var(--faint); min-height: 40px; transition: border-color .12s, box-shadow .12s; }
.search-box input { border: none; padding: 8px 0; min-height: 0; box-shadow: none !important; background: transparent; }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.chips { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 6px 13px; min-height: 34px; border-radius: 999px;
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-transform: capitalize; }
.chips button:hover { border-color: var(--line-strong); }
.chips button span { color: var(--muted); font-weight: 500; margin-left: 4px; }
.chips button.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chips button.active span { color: inherit; opacity: .7; }
.selection-bar { display: flex; gap: 10px; align-items: center; background: var(--primary-soft); color: var(--primary-text); padding: 8px 12px; border-radius: var(--radius-md); margin-bottom: 12px; }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: none; background: transparent; padding: 7px 13px; min-height: 34px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; text-transform: capitalize; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented.full { display: flex; width: 100%; }
.segmented.full button { flex: 1; }
.segmented.no-cap button { text-transform: none; }

/* ---------- tables ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow-x: auto; box-shadow: var(--shadow-sm); }
.card .table-wrap, .modal .table-wrap { box-shadow: none; border-radius: var(--radius); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 650; padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap; letter-spacing: .02em; }
.table thead th:first-child { border-top-left-radius: var(--radius); } .table thead th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table th.r, .table td.r { text-align: right; } .table th.c, .table td.c { text-align: center; }
.table.compact td, .table.compact th { padding: 8px 12px; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table tr.highlight { background: var(--amber-soft); }
.table tfoot td, .table tfoot th { border-top: 1px solid var(--line); border-bottom: none; background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table-foot { padding: 11px 14px; border-top: 1px solid var(--line-soft); }
.w-check { width: 38px; } .w-thumb { width: 56px; }
.table.products td:nth-child(3) { min-width: 220px; }
.report-table td, .report-table th { white-space: nowrap; }

.thumb { width: 40px; height: 40px; border-radius: 9px; background: var(--surface-3) center/cover no-repeat; display: grid; place-items: center; color: var(--faint); flex-shrink: 0; }
.thumb.lg { width: 88px; height: 88px; border-radius: 12px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; line-height: 1.6;
  background: var(--gray-soft); color: var(--muted); text-transform: capitalize; white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.gray { background: var(--gray-soft); color: var(--muted); }

.alert { padding: 11px 14px; border-radius: var(--radius-md); margin: 0 0 14px; font-size: 14px; border: 1px solid transparent; }
.alert.error { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.alert.warn { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.callout { background: var(--surface-2); border: 1px solid var(--line); padding: 11px 14px; border-radius: var(--radius-md); }
.empty { text-align: center; padding: 56px 20px; color: var(--faint); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.empty h4 { color: var(--text); margin: 12px 0 4px; font-size: 16px; }
.empty .muted { max-width: 48ch; margin: 0 auto; }
.empty .btn { margin-top: 12px; }

/* toggle switch */
.toggle { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; font-weight: 500; font-size: 14px; margin: 0; color: var(--text); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track { width: 40px; height: 24px; background: var(--line-strong); border-radius: 999px; position: relative; transition: background .15s; flex-shrink: 0; }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.toggle input:checked + .track { background: var(--green); }
.toggle input:checked + .track .knob { left: 19px; }
.toggle input:focus-visible + .track { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 20, .5); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; z-index: 60; overflow-y: auto; animation: fade .12s ease; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: pop .16s ease; }
.modal.wide { max-width: 860px; } .modal.xwide { max-width: 1100px; } .modal.small { max-width: 420px; margin-top: 16vh; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 18px 18px; flex-wrap: wrap; align-items: center; }
.email-preview { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: flex-start; gap: 10px; background: var(--inverse); color: var(--inverse-text); padding: 12px 16px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-weight: 550; font-size: 14px; animation: slidein .2s ease; max-width: 440px; }
.toast::before { content: '✓'; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #1fa971; color: #fff; font-size: 12px; font-weight: 800; flex-shrink: 0; margin-top: 1px; }
.toast.error::before { content: '!'; background: #e5484d; }
.toast.warn::before { content: '!'; background: #d99100; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }

/* ---------- command palette (Ctrl+K) ---------- */
.palette-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 20, .45); backdrop-filter: blur(2px); z-index: 80; display: flex; justify-content: center;
  padding: 10vh 16px; animation: fade .1s ease; }
.palette { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  overflow: hidden; align-self: flex-start; animation: pop .14s ease; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--faint); }
.palette-input input { border: none; box-shadow: none !important; padding: 4px 0; font-size: 16px; min-height: 0; background: transparent; }
.palette-list { max-height: 60vh; overflow-y: auto; padding: 6px; }
.palette-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 650; padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: var(--radius-md); border: none; background: none; font: inherit;
  color: var(--text); text-align: left; cursor: pointer; }
.palette-item .grow b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .grow span { font-size: 12.5px; color: var(--muted); }
.palette-item .pi { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
.palette-item.on { background: var(--primary-soft); }
.palette-item.on .pi { background: var(--primary); color: var(--on-primary); }
.palette-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--surface-2); }

/* ---------- user menu ---------- */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 70; animation: pop .12s ease; }
.menu .menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.menu a, .menu button.mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px; border: none; background: none;
  font: inherit; font-size: 14px; color: var(--text); cursor: pointer; text-align: left; }
.menu a:hover, .menu button.mi:hover { background: var(--surface-2); text-decoration: none; }
.menu .theme-pick { display: flex; gap: 4px; padding: 6px 8px; }
.menu .theme-pick button { flex: 1; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; padding: 6px 4px; font: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer; }
.menu .theme-pick button.on { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.avatar-btn { border: none; background: none; padding: 2px; border-radius: 50%; cursor: pointer; }

/* ---------- scanner & products ---------- */
.scan-input { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 2px solid var(--line-strong); border-radius: 14px; padding: 5px 5px 5px 14px;
  transition: border-color .12s, box-shadow .12s; }
.scan-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.scan-input input { border: none; padding: 8px 4px; box-shadow: none !important; background: transparent; }
.scan-input.big input { font-size: 20px; padding: 12px 4px; }
.scan-icon { color: var(--primary); display: flex; }
.camera-box { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; }
.camera-box video { width: 100%; height: 100%; object-fit: cover; }
.camera-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.scan-result { display: flex; align-items: center; gap: 16px; border-left: 4px solid var(--green); }
.scan-result.warn { border-left-color: var(--amber); display: block; }
.added { font-size: 30px; font-weight: 800; color: var(--green); }
.barcode-preview { display: flex; align-items: center; justify-content: center; background: #fff; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); min-height: 72px; padding: 6px; color: #5a6477; }
.barcode-svg { max-width: 100%; height: auto; }
.image-upload { display: flex; gap: 12px; align-items: center; }
.image-upload .stack { gap: 6px; }

/* batch add */
.batch-existing { border: 1px solid color-mix(in srgb, var(--green) 40%, var(--line)); background: var(--green-soft); border-radius: 14px; padding: 16px; }
.batch-details { border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--line)); border-radius: 14px; padding: 16px; }
.batch-step { font-weight: 700; margin-bottom: 12px; }
.batch-list { border-top: 1px solid var(--line); padding-top: 12px; max-height: 32vh; overflow-y: auto; }
.batch-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
.pos-left, .pos-right { min-width: 0; }
.pos-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pos-product { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.pos-product:hover:not(:disabled) { border-color: var(--primary); }
.pos-product:disabled { opacity: .5; cursor: not-allowed; }
.pos-hint { text-align: center; padding: 56px 20px; color: var(--faint); }
.pos-right { position: sticky; top: calc(var(--topbar-h) + 16px); }
.cart-lines { margin: 12px 0; max-height: 45vh; overflow-y: auto; border-top: 1px solid var(--line-soft); }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.cart-line.problem { background: var(--red-soft); }
.qty-stepper { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-md); overflow: hidden; }
.qty-stepper button { border: none; background: var(--surface-2); color: var(--text); padding: 8px 10px; cursor: pointer; display: flex; }
.qty-stepper button:hover { background: var(--surface-3); }
.qty-stepper input { width: 40px; border: none; text-align: center; padding: 4px 0; min-height: 0; border-radius: 0; box-shadow: none !important; }
.price-input { width: 92px !important; text-align: right; padding: 6px 8px; min-height: 36px; }
.totals { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 14px; }
.discount-input { width: 120px !important; text-align: right; padding: 6px 8px; min-height: 36px; }
.total-row { font-size: 24px; font-weight: 800; padding-top: 10px; border-top: 2px solid var(--text); letter-spacing: -0.02em; }
.total-lbp { font-size: 16px; font-weight: 700; color: var(--muted); }
.cash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cash-grid label { margin: 0; }
.change { margin-top: 10px; font-size: 16px; }
.change.big { font-size: 22px; margin: 16px 0; color: var(--green); }
.pos-mobile-bar { display: none; }
.pos-tile-area { margin-top: 14px; }
.pos-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-tile { display: flex; flex-direction: column; gap: 6px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px;
  font: inherit; color: var(--text); cursor: pointer; min-height: 132px; transition: transform .08s, border-color .12s, box-shadow .12s; box-shadow: var(--shadow-sm); }
.pos-tile:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.pos-tile:active { transform: scale(.97); }
.tile-img { height: 64px; border-radius: 9px; background: var(--surface-3) center/contain no-repeat; }
.tile-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* POS mode (full screen till) */
.posmode { min-height: 100vh; display: flex; flex-direction: column; }
.posmode-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap;
  padding-top: calc(10px + env(safe-area-inset-top)); position: sticky; top: 0; z-index: 30; }
.posmode-bar .logo { display: flex; align-items: center; gap: 8px; font-weight: 750; }
.posmode-bar .seg { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface-3); padding: 3px; border-radius: 11px; }
.posmode-bar .seg button { background: transparent; color: var(--muted); border: none; border-radius: 8px; padding: 8px 14px; min-height: 38px; font: inherit; font-weight: 650; cursor: pointer; }
.posmode-bar .seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.posmode-body { padding: 16px; flex: 1; }
.posmode .pos { grid-template-columns: minmax(0, 1fr) 440px; }
.posmode .pos-right { top: 80px; }
.posmode .clock { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

/* ---------- misc components ---------- */
.pay-box { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.pay-box.paid { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.pay-box.pending, .pay-box.stale { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.pay-box.refund_needed { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.shopify-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--radius-md); background: var(--green-soft); border: 1px solid color-mix(in srgb, var(--green) 20%, transparent); }
.shopify-mark { width: 24px; height: 24px; border-radius: 7px; background: #5e8e3e; color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 13px; flex-shrink: 0; }
details summary { cursor: pointer; margin-bottom: 8px; font-weight: 600; }
.time-chip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); padding: 2px 2px 2px 8px; background: var(--surface); }
.time-chip input { border: none; padding: 6px 4px; width: auto; min-height: 0; box-shadow: none !important; }
.danger-zone { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.danger-zone h3 { color: var(--red); }
.user-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.user-card { margin: 0; }
.access-line { margin: 4px 0; }
.access-list { display: flex; flex-direction: column; gap: 8px; }
.access-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.access-row.on { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); background: var(--primary-soft); }
.access-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.perm-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.designer { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 18px; align-items: start; }
.preview-wrap { position: sticky; top: calc(var(--topbar-h) + 16px); }
.receipt-preview { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 14px; background: #d1d5db; }
.report-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.report-type { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 12px; padding: 11px 13px; font: inherit; cursor: pointer; transition: border-color .12s, background .12s; }
.report-type:hover { border-color: var(--line-strong); }
.report-type span { font-size: 12.5px; color: var(--muted); }
.report-type.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.hist-row { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.hist-line { padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.hist-detail { margin: 10px 0 4px; }

/* chart */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 240px; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 3; }
.chart .axis { font-size: 11px; fill: var(--muted); }
.bar-pos { fill: var(--primary); background: var(--primary); }
.bar-online { fill: #22b8cf; background: #22b8cf; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--inverse); color: var(--inverse-text); padding: 8px 10px; border-radius: 9px;
  font-size: 12px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); justify-content: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.bars7 { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bars7 .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars7 .bar { width: 100%; max-width: 44px; background: var(--primary); border-radius: 8px 8px 3px 3px; min-height: 3px; transition: height .3s; position: relative; }
.bars7 .b.today .bar { background: linear-gradient(var(--primary), color-mix(in srgb, var(--primary) 70%, #22b8cf)); }
.bars7 .bar.neg { background: var(--red); }
.bars7 .lbl { font-size: 12px; color: var(--muted); white-space: nowrap; }
.bars7 .amt { font-size: 11.5px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1000px 500px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%),
  radial-gradient(800px 400px at 110% 110%, color-mix(in srgb, #22b8cf 14%, transparent), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; padding: 32px; box-shadow: var(--shadow-lg); border-radius: 20px; }
.logo.big { display: flex; align-items: center; gap: 10px; font-size: 22px; }
.login-card p { margin: 0; }

/* =====================================================================
   Tablets & phones
   ===================================================================== */
@media (max-width: 1100px) {
  .pos, .posmode .pos { grid-template-columns: minmax(0, 1fr); }
  .pos-right, .posmode .pos-right { position: static; }
  .designer { grid-template-columns: 1fr; }
  .preview-wrap { position: static; }
  .receipt-preview { height: 70vh; }
  .home-grid { grid-template-columns: 1fr; }
  .pos-mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0,0,0,.08); }
  .pos { padding-bottom: 76px; }
}

@media (max-width: 860px) {
  :root { font-size: 16px; }
  input, select, textarea { font-size: 16px; } /* stops iPhone zooming in when typing */
  .sidebar { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .shell.menu-open .sidebar { transform: none; }
  .shell.menu-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 12, 20, .45); z-index: 35; }
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .topbar .menu-btn { display: inline-flex; }
  .search-trigger { width: auto; min-width: 0; flex: 1; }
  .search-trigger kbd { display: none; }
  .crumbs { display: none; }
  .content { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  .form-grid, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .search-box { min-width: 100%; }
  .note-input { width: 100%; }
  .toolbar > select { flex: 1 1 45%; }
  .toolbar .spacer { display: none; }
  .tabs { width: 100%; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 94vh; overflow-y: auto; }
  .modal.small { margin-top: 0; }
  .modal-foot { position: sticky; bottom: 0; border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; }
  .perm-checks .check { width: 100%; }
  .toasts { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .palette-backdrop { padding: 0; }
  .palette { max-width: none; border-radius: 0 0 18px 18px; }
  .menu { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 8px); }

  /* bottom navigation bar on phones */
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: none; background: none;
    font: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: var(--radius-md); cursor: pointer; min-width: 0; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav .active { color: var(--primary-text); }
  .bottom-nav .sell { color: var(--on-primary); background: var(--primary); margin: -14px 6px 0; border-radius: 14px; padding: 8px 2px; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 40%, transparent); flex: 0.9; }
  .stat .label { flex-wrap: wrap; }
  .stat .label .trend { margin-left: auto; }
  .has-bottom-nav .pos-mobile-bar { bottom: calc(62px + env(safe-area-inset-bottom)); }
}

@media (max-width: 700px) {
  .only-mobile { display: inline-flex !important; }
  .hide-mobile { display: none !important; }
  h1, .page-head h1, .biz-head h1 { font-size: 21px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px; }
  .stat .value { font-size: 21px; }
  .biz-grid, .user-cards { grid-template-columns: 1fr; }
  .quick { grid-template-columns: 1fr 1fr; gap: 10px; }
  .quick a { flex-direction: column; align-items: flex-start; gap: 8px; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }

  /* product list as cards */
  .table.products thead { display: none; }
  .table.products tbody tr { display: grid; grid-template-columns: 24px 44px minmax(0, 1fr) auto;
    grid-template-areas: "check thumb name price" "check thumb code stock" "check thumb cond online" "actions actions actions actions";
    gap: 2px 10px; padding: 12px; border-bottom: 1px solid var(--line-soft); align-items: center; }
  .table.products td { padding: 0; border: none; min-width: 0 !important; }
  .table.products td[colspan] { grid-column: 1 / -1; }
  .c-check { grid-area: check; } .c-thumb { grid-area: thumb; align-self: start; } .c-name { grid-area: name; }
  .c-price { grid-area: price; } .c-code { grid-area: code; overflow: hidden; text-overflow: ellipsis; }
  .c-stock { grid-area: stock; text-align: right !important; } .c-cond { grid-area: cond; } .c-online { grid-area: online; text-align: right !important; }
  .c-cost { display: none; }
  .c-actions { grid-area: actions; display: flex; gap: 4px; justify-content: flex-end; padding-top: 6px !important; }

  /* order list as cards */
  .table.orders thead { display: none; }
  .table.orders tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ref total" "cust status" "where when";
    gap: 4px 10px; padding: 12px; border-bottom: 1px solid var(--line-soft); }
  .table.orders td { padding: 0; border: none; }
  .o-ref { grid-area: ref; } .o-total { grid-area: total; text-align: right; } .o-cust { grid-area: cust; } .o-status { grid-area: status; text-align: right; }
  .o-where { grid-area: where; } .o-when { grid-area: when; text-align: right; color: var(--muted); font-size: 12px; } .o-items { display: none; }

  .scan-input.big input { font-size: 18px; }
  .cart-line { flex-wrap: wrap; }
  .cart-line .grow { flex-basis: 100%; }
  .cash-grid { grid-template-columns: 1fr; }
  .scan-result { flex-wrap: wrap; }
  .note-input, .qty-input { flex: 1; }
  .pos-hint { padding: 16px 10px; }
  .pos-hint svg { width: 32px; height: 32px; }
  .pos-tiles { grid-template-columns: repeat(2, 1fr); }
  .posmode-body { padding: 10px; }
  .modal .segmented { display: flex; width: 100%; }
  .modal .segmented button { flex: 1 1 100%; white-space: normal; text-align: left; text-transform: none; }
  .designer .card { padding: 14px; }
  .bars7 { gap: 4px; height: 150px; }
  .bars7 .amt { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.tile-img { display: grid; place-items: center; font-size: 20px; font-weight: 750; color: var(--faint); letter-spacing: .02em; }

/* =====================================================================
   Appearance (Account menu → Appearance)
   Every choice is a data-* attribute on <html>, so the whole app follows.
   ===================================================================== */

/* accent-derived colours: work for any colour set, including a custom one */
:root {
  --primary-hover: color-mix(in srgb, var(--primary) 84%, #000);
  --primary-soft: color-mix(in srgb, var(--primary) 10%, var(--surface));
  --primary-text: color-mix(in srgb, var(--primary) 80%, var(--text));
  --ring: color-mix(in srgb, var(--primary) 32%, transparent);
}
:root[data-theme="dark"] {
  --primary-hover: color-mix(in srgb, var(--primary) 85%, #fff);
  --primary-soft: color-mix(in srgb, var(--primary) 20%, var(--surface));
  --primary-text: color-mix(in srgb, var(--primary) 50%, #fff);
  --ring: color-mix(in srgb, var(--primary) 50%, transparent);
}

/* colour sets (light / dark tuned separately) */
:root[data-accent="emerald"]:not([data-theme="dark"]) { --primary: #0b7a52; }
:root[data-accent="teal"]:not([data-theme="dark"])    { --primary: #0e6f8a; }
:root[data-accent="violet"]:not([data-theme="dark"])  { --primary: #6d3fd8; }
:root[data-accent="rose"]:not([data-theme="dark"])    { --primary: #c1285c; }
:root[data-accent="sunset"]:not([data-theme="dark"])  { --primary: #c2410c; }
:root[data-accent="crimson"]:not([data-theme="dark"]) { --primary: #b91c1c; }
:root[data-accent="graphite"]:not([data-theme="dark"]){ --primary: #334155; }
:root[data-theme="dark"][data-accent="emerald"]  { --primary: #178a5e; }
:root[data-theme="dark"][data-accent="teal"]     { --primary: #1a809c; }
:root[data-theme="dark"][data-accent="violet"]   { --primary: #7b58ee; }
:root[data-theme="dark"][data-accent="rose"]     { --primary: #d63a6e; }
:root[data-theme="dark"][data-accent="sunset"]   { --primary: #d3561a; }
:root[data-theme="dark"][data-accent="crimson"]  { --primary: #d33a3a; }
:root[data-theme="dark"][data-accent="graphite"] { --primary: #5d6b80; }
:root[data-accent="custom"] { --primary: var(--custom, #2f5bea); --on-primary: var(--custom-on, #fff); }
:root[data-theme="dark"][data-accent="custom"] { --primary: color-mix(in srgb, var(--custom, #2f5bea) 88%, #fff); }

/* background tone (the greys) */
:root[data-tone="neutral"]:not([data-theme="dark"]) { --bg: #f4f4f5; --surface: #fff; --surface-2: #f8f8f9; --surface-3: #eeeef0; --text: #18181b;
  --muted: #5d5d66; --faint: #8e8e98; --line: #e5e5e8; --line-strong: #d1d1d6; --line-soft: #efeff1; --gray-soft: #eeeef0; }
:root[data-tone="warm"]:not([data-theme="dark"]) { --bg: #f6f2ec; --surface: #fffdf9; --surface-2: #faf6f0; --surface-3: #f1ebe2; --text: #1f1a13;
  --muted: #655b4f; --faint: #968b7d; --line: #e9e1d5; --line-strong: #d9cebe; --line-soft: #f2ece3; --gray-soft: #f1ebe2; }
:root[data-theme="dark"][data-tone="neutral"] { --bg: #0e0e10; --surface: #17171a; --surface-2: #1c1c20; --surface-3: #242428; --text: #ececee;
  --muted: #a3a3ab; --faint: #72727c; --line: #27272c; --line-strong: #35353c; --line-soft: #1f1f23; --gray-soft: #242428; }
:root[data-theme="dark"][data-tone="warm"] { --bg: #12100d; --surface: #1a1713; --surface-2: #201c17; --surface-3: #29241d; --text: #efe9e1;
  --muted: #b0a697; --faint: #7d7366; --line: #2c2620; --line-strong: #3a332a; --line-soft: #221e19; --gray-soft: #29241d; }
:root[data-theme="dark"][data-tone="black"] { --bg: #000; --surface: #0c0c0e; --surface-2: #121215; --surface-3: #1a1a1e; --text: #ededf0;
  --muted: #a1a1aa; --faint: #6b6b75; --line: #1f1f24; --line-strong: #2d2d33; --line-soft: #151518; --gray-soft: #1a1a1e; }

/* page background */
:root[data-bg="tinted"] body { background: color-mix(in srgb, var(--primary) 7%, var(--bg)); }
:root[data-bg="gradient"] body { background-color: var(--bg); background-attachment: fixed; background-image:
  radial-gradient(1100px 560px at 105% -10%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 65%),
  radial-gradient(900px 520px at -10% 108%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 60%); }
:root[data-bg="aurora"] body { background-color: var(--bg); background-attachment: fixed; background-image:
  radial-gradient(800px 480px at 0% 0%, color-mix(in srgb, var(--primary) 20%, transparent), transparent 62%),
  radial-gradient(700px 460px at 100% 10%, color-mix(in srgb, #14b8a6 17%, transparent), transparent 62%),
  radial-gradient(800px 520px at 80% 105%, color-mix(in srgb, #a855f7 15%, transparent), transparent 62%),
  radial-gradient(600px 420px at 10% 100%, color-mix(in srgb, #f59e0b 12%, transparent), transparent 62%); }
:root[data-bg="dots"] body { background-color: var(--bg); background-attachment: fixed; background-size: 20px 20px;
  background-image: radial-gradient(circle, color-mix(in srgb, var(--text) 16%, transparent) 1.1px, transparent 1.7px); }
:root[data-bg="grid"] body { background-color: var(--bg); background-attachment: fixed; background-size: 28px 28px;
  background-image: linear-gradient(color-mix(in srgb, var(--text) 6%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 6%, transparent) 1px, transparent 1px); }
:root[data-bg="image"] body { background-color: var(--bg); background-attachment: fixed; background-size: cover; background-position: center;
  background-image: linear-gradient(color-mix(in srgb, var(--bg) var(--bg-dim, 70%), transparent), color-mix(in srgb, var(--bg) var(--bg-dim, 70%), transparent)), var(--bg-image, none); }
:root[data-bg]:not([data-bg="plain"]) .login-page { background: transparent; }
:root[data-bg]:not([data-bg="plain"]) .topbar { background: color-mix(in srgb, var(--bg) 70%, transparent); }

/* sidebar style */
.sidebar { color: var(--text); }
:root[data-sidebar="dark"] .sidebar { --surface: #111827; --surface-2: #1b2436; --surface-3: #243049; --text: #eef1f7; --muted: #a9b3c5; --faint: #7a869c;
  --line: #222d42; --line-strong: #33405a; --primary-soft: color-mix(in srgb, var(--primary) 34%, #111827); --primary-text: #fff; border-right-color: transparent; }
:root[data-theme="dark"][data-sidebar="dark"] .sidebar { --surface: #07090e; --surface-2: #121722; --line: #161c28; }
:root[data-sidebar="accent"] .sidebar { --surface: color-mix(in srgb, var(--primary) 90%, #000); --surface-2: rgba(255,255,255,.1); --surface-3: rgba(255,255,255,.16);
  --text: #fff; --muted: rgba(255,255,255,.84); --faint: rgba(255,255,255,.66); --line: rgba(255,255,255,.14); --line-strong: rgba(255,255,255,.28);
  --primary-soft: rgba(255,255,255,.18); --primary-text: #fff; border-right-color: transparent; }
:root[data-sidebar="accent"] .sidebar .brand-mark, :root[data-sidebar="accent"] .sidebar nav a.pos-link { background: #fff; color: color-mix(in srgb, var(--primary) 90%, #000); }
:root[data-sidebar="accent"] .sidebar nav a.pos-link:hover { background: rgba(255,255,255,.9); }
:root[data-sidebar="accent"] .sidebar .avatar { background: rgba(255,255,255,.2); color: #fff; }
:root[data-sidebar="glass"] .sidebar { background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(14px) saturate(1.3); }

/* fonts */
:root[data-font="dosis"]    { --font-body: 'Dosis', system-ui, sans-serif; }
:root[data-font="inter"]    { --font-body: 'Inter', system-ui, sans-serif; }
:root[data-font="system"]   { --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
:root[data-heading="titillium"] { --font-head: 'Titillium Web', system-ui, sans-serif; }
:root[data-heading="inter"]     { --font-head: 'Inter', system-ui, sans-serif; }
:root[data-heading="system"]    { --font-head: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
h1, h2, h3, .h1, .h2, .h3, .brand-name, .logo, .stat .value, .modal-head h3, .section-title h3 { font-family: var(--font-head); }
h1, .h1, .stat .value, .brand-name { letter-spacing: 0; }

/* text size (whole working area, like zooming) */
:root[data-size="sm"] .content, :root[data-size="sm"] .posmode-body { zoom: .92; }
:root[data-size="lg"] .content, :root[data-size="lg"] .posmode-body { zoom: 1.08; }
:root[data-size="xl"] .content, :root[data-size="xl"] .posmode-body { zoom: 1.18; }

/* corners */
:root[data-corners="sharp"] { --radius-sm: 3px; --radius-md: 5px; --radius: 6px; --radius-lg: 8px; }
:root[data-corners="round"] { --radius-sm: 12px; --radius-md: 14px; --radius: 18px; --radius-lg: 22px; }

/* ---------- Appearance page ---------- */
.look-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.look-side { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 0; }
.look-section { padding: 20px 0; border-top: 1px solid var(--line); }
.look-section:first-child { border-top: none; padding-top: 0; }
.look-section > h3 { margin-bottom: 2px; font-size: 17px; }
.look-section > .hint { margin: 0 0 14px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.choice { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; transition: border-color .12s, box-shadow .12s; }
.choice:hover { border-color: var(--line-strong); }
.choice.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.choice.on::after { content: '✓'; position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.choice .sw { height: 58px; border-radius: max(3px, calc(var(--radius) - 4px)); border: 1px solid var(--line); overflow: hidden; position: relative; }
.choice small { color: var(--muted); font-weight: 500; font-size: 12.5px; margin-top: -6px; line-height: 1.3; }
.swatches { display: flex; flex-wrap: wrap; gap: 14px 8px; }
.swatch-label { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; width: 70px; cursor: pointer; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line-strong); cursor: pointer; position: relative;
  display: grid; place-items: center; color: #fff; font-weight: 800; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2.5px var(--text); }
.swatch-label.on { color: var(--text); }
.swatch.custom { background: conic-gradient(#ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444); overflow: hidden; }
.swatch.custom input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; width: 60px; height: 60px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: calc(var(--radius-md) + 3px); }
.segmented button { border: none; background: transparent; color: var(--muted); font: inherit; font-weight: 650; font-size: 14px; padding: 8px 16px; min-height: 38px;
  border-radius: var(--radius-md); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.font-choice .sample { font-size: 30px; line-height: 1.1; font-weight: 600; padding: 6px 2px 0; }
.mini-app { display: flex; height: 100%; }
.mini-app .ms { width: 26%; border-right: 1px solid rgba(0,0,0,.06); padding: 5px 4px; display: flex; flex-direction: column; gap: 3px; }
.mini-app .ms i { display: block; height: 4px; border-radius: 2px; background: currentColor; opacity: .35; }
.mini-app .ms i:first-child { opacity: 1; }
.mini-app .mm { flex: 1; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.mini-app .mc { height: 12px; border-radius: 3px; }
.mini-app .mb { width: 38%; height: 9px; border-radius: 3px; }
.preview-card .pv-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.bg-thumb { position: absolute; inset: 0; }
@media (max-width: 1100px) { .look-grid { grid-template-columns: 1fr; } .look-side { position: static; } }

/* ---------- subscription (hosted shops) ---------- */
.alert.info { background: var(--primary-soft); color: var(--primary-text); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.meter span.full { background: var(--amber); }
.checklist { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist li::before { content: '✓'; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex-shrink: 0; background: var(--green-soft); color: var(--green); }
.checklist li.no { color: var(--muted); text-decoration: line-through; }
.checklist li.no::before { content: '✕'; background: var(--gray-soft); color: var(--faint); }

/* ---------- IMEI at the till ---------- */
.serial-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 10px; border-bottom: 1px solid var(--line-soft); margin-top: -4px; }
.serial-field { display: flex; align-items: center; gap: 8px; margin: 0; flex: 1 1 220px; font-size: 12.5px; color: var(--muted); font-weight: 650; flex-wrap: wrap; }
.serial-field input { flex: 1; min-height: 34px; padding: 5px 10px; font-size: 13.5px; border-color: var(--amber); background: var(--amber-soft); }
.serial-field.ok input { border-color: var(--green); background: var(--green-soft); }
.serial-field.bad input { border-color: var(--red); background: var(--red-soft); }
.serial-field small { flex-basis: 100%; color: var(--red); font-weight: 600; }
.serial-ok { font-size: 12.5px; color: var(--green); font-weight: 650; font-family: ui-monospace, Consolas, monospace; }
.customer-required { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- v2: shared till, alerts ---------- */
.till-lock { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 24px 16px; gap: 10px; }
.till-head { width: 100%; max-width: 900px; display: flex; justify-content: space-between; align-items: center; }
.till-people, .till-pin { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; max-width: 900px; text-align: center; }
.till-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; width: 100%; margin-top: 18px; }
.till-person { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 12px; border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; font-weight: 650; cursor: pointer; box-shadow: var(--shadow-sm); }
.till-person:hover { border-color: var(--primary); }
.till-person .avatar { width: 56px; height: 56px; font-size: 20px; }
.pin-dots { display: flex; gap: 14px; margin: 14px 0 4px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); }
.pin-dots span.on { background: var(--primary); border-color: var(--primary); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; }
.pin-pad button { height: 70px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 26px; font-weight: 650; cursor: pointer; }
.pin-pad button:active { background: var(--primary-soft); }
.pin-pad button.muted { font-size: 15px; }
.till-admin { margin-top: 8px; }
.bell-badge { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
.bell-item { display: flex; align-items: flex-start; gap: 6px; padding: 4px; border-bottom: 1px solid var(--line-soft); }
.bell-item a { flex: 1; display: flex; flex-direction: column; padding: 6px 8px; border-radius: 9px; color: var(--text); }
.bell-item a:hover { background: var(--surface-2); text-decoration: none; }
.quick-items { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.quick-item { border: none; border-radius: 12px; padding: 12px 16px; min-height: 52px; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; color: #fff;
  background: var(--primary); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.quick-item small { font-weight: 500; opacity: .9; }
.quick-item.add { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-strong); }

/* ---------- v2: phones & tablets ---------- */
.pm-biz, .pm-menu-btn { display: none; }
.pm-actions { display: contents; }
.pm-full span { display: none; }
.posmode-bar { position: sticky; top: 0; z-index: 40; }

/* tables that turn into cards on phones (add class "stack" + v-stack) */
@media (max-width: 760px) {
  .posmode-bar { gap: 8px; padding: 8px 10px; position: sticky; }
  .posmode-bar .seg, .posmode-bar .clock { display: none; }
  .pm-biz { display: block; width: auto; min-width: 0; max-width: 46vw; min-height: 40px; padding-top: 6px; padding-bottom: 6px; font-weight: 650; }
  .pm-user { max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pm-menu-btn { display: inline-flex; min-height: 40px; }
  .pm-actions { display: none; }
  .pm-actions.open { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: absolute; top: 100%; left: 0; right: 0; padding: 10px; z-index: 50;
    background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); }
  .pm-actions.open .btn { min-height: 48px; justify-content: center; font-size: 14.5px; }
  .pm-actions.open .btn.ghost { border: 1px solid var(--line); background: var(--surface); }
  .pm-full span { display: inline; }
  .posmode .pos-right { top: auto; }

  .table-wrap:has(> .table.to-cards) { border: none; background: transparent; box-shadow: none; overflow: visible; }
  .table.to-cards, .table.to-cards tbody, .table.to-cards tfoot, .table.to-cards tr, .table.to-cards td, .table.to-cards th { display: block; width: 100%; }
  .table.to-cards thead { display: none; }
  .table.to-cards tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
  .table.to-cards tfoot tr { background: var(--surface-2); }
  .table.to-cards td, .table.to-cards tfoot th { border: none !important; padding: 3px 0 !important; display: flex; justify-content: space-between; align-items: baseline; gap: 14px; text-align: right !important; min-height: 0; }
  .table.to-cards td::before, .table.to-cards tfoot th::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; flex-shrink: 0; }
  .table.to-cards td:first-child, .table.to-cards tfoot th:first-child { display: block; text-align: left !important; font-size: 15px; padding-bottom: 6px !important; }
  .table.to-cards td:first-child::before, .table.to-cards tfoot th:first-child::before { display: none; }
  .table.to-cards td:empty, .table.to-cards td[data-label=""]:empty { display: none; }
  .table.to-cards td.actions { justify-content: flex-end; }
  .table.to-cards td.actions::before { display: none; }
  .table.to-cards tr.clickable:active { background: var(--surface-2); }
  .table.to-cards td[colspan] { display: block; text-align: center !important; }
  .table.to-cards td[colspan]::before { display: none; }

  .page-head > .btn, .page-head > div > .btn { flex: 1; justify-content: center; }
  .chips { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .chips button { flex-shrink: 0; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; justify-content: center; padding: 8px 10px; }
  .modal .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .chips, .modal .chips { flex-wrap: wrap; overflow: visible; }
  .till-grid { grid-template-columns: repeat(2, 1fr); }
  .pin-pad { grid-template-columns: repeat(3, 78px); }
  .quick-item { flex: 1 1 calc(50% - 8px); min-height: 56px; }
  .bell-wrap .menu { position: fixed; left: 8px; right: 8px; top: 60px; width: auto !important; }
  .list-row { flex-wrap: wrap; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .posmode-bar .seg { order: 5; width: 100%; }
  .look-grid, .grid-2 { grid-template-columns: 1fr; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
}
@media (min-width: 761px) {
  .table.to-cards td.mono, .table.to-cards td.r, .table.to-cards td .badge { white-space: nowrap; }
}
/* bigger touch targets on touch screens (tablets / phones) */
@media (pointer: coarse) {
  .btn.small { min-height: 38px; padding-left: 12px; padding-right: 12px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .table tr.clickable td { padding-top: 12px; padding-bottom: 12px; }
}
/* POS payment methods: even grid instead of a ragged wrap */
.segmented.pay-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.segmented.pay-methods button { justify-content: center; text-align: center; }
/* customer cohorts: coloured % pills */
.heat { display: inline-block; min-width: 48px; padding: 3px 8px; border-radius: 7px; font-weight: 650; font-variant-numeric: tabular-nums; }
