/* Alcon Ops design system. Dark by default (like the reference), light mode for bright counters. */

/* ---------- tokens ---------- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0c0d;
  --bg-side: #0f0f11;
  --surface: #141416;
  --surface-2: #1b1b1e;
  --surface-3: #242428;
  --border: #25252a;
  --border-strong: #34343b;
  --ink: #f4f4f5;
  --ink-2: #c9c9ce;
  --muted: #8b8b94;
  --accent: #f97316;
  --accent-hover: #fb8534;
  --accent-ink: #1b0e03;
  --accent-soft: rgba(249, 115, 22, .14);
  --accent-text: #fb923c;
  --ok: #22c55e;   --ok-soft: rgba(34, 197, 94, .13);   --ok-text: #4ade80;
  --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .13); --warn-text: #fbbf24;
  --danger: #ef4444; --danger-soft: rgba(239, 68, 68, .13); --danger-text: #f87171;
  --info: #3b82f6; --info-soft: rgba(59, 130, 246, .13); --info-text: #60a5fa;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 10px 30px rgba(0, 0, 0, .28);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, .5);
  --chart-line: #f97316;
  --chart-prev: #6b6b74;
  --chart-grid: #222226;
  --chart-axis: #34343b;
  /* Categorical slots 1-8, dark steps of the validated reference palette (always paired with labels). */
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f2;
  --bg-side: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --surface-3: #eaeae7;
  --border: #e5e4df;
  --border-strong: #d2d1cb;
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --accent: #f97316;
  --accent-hover: #ea6a0c;
  --accent-ink: #1b0e03;
  --accent-soft: #fff0e3;
  --accent-text: #c2410c;
  --ok: #16a34a;   --ok-soft: #e7f6ec;   --ok-text: #15803d;
  --warn: #d97706; --warn-soft: #fdf2df; --warn-text: #b45309;
  --danger: #dc2626; --danger-soft: #fdeaea; --danger-text: #b91c1c;
  --info: #2563eb; --info-soft: #e7eefd; --info-text: #1d4ed8;
  --shadow: 0 1px 2px rgba(24, 24, 27, .05), 0 4px 14px rgba(24, 24, 27, .05);
  --shadow-pop: 0 16px 40px rgba(24, 24, 27, .18);
  --chart-line: #f97316;
  --chart-prev: #a1a1aa;
  --chart-grid: #ececea;
  --chart-axis: #d2d1cb;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
}
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --side-w: 264px;
  --top-h: 60px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 8px; }
.num, td.num, .tab { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.icon { width: 18px; height: 18px; flex: none; }
.icon-xs { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); display: flex; flex-direction: column;
  background: var(--bg-side); border-right: 1px solid var(--border); z-index: 30; transition: width .18s ease;
}
.side-top { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink);
}
.brand-mark .icon { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.brand-text small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.side-collapse { margin-left: auto; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; }
.nav-section {
  margin: 16px 10px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; overflow: hidden;
  flex: none; /* in the scrolling menu a title with overflow hidden would otherwise shrink to nothing once the menu is long */
}
.nav-section:first-child { margin-top: 6px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500; white-space: nowrap;
}
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--surface-2); color: var(--ink); font-weight: 650; }
.nav-item.active .icon { color: var(--accent); }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-item .count {
  margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; font-size: 11px; font-weight: 700; line-height: 18px;
  background: var(--danger); color: #fff; text-align: center;
}
.nav-item .tag { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 99px; padding: 0 6px; }

.main { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .18s ease; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.page-title { font-size: 15px; font-weight: 700; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand-mobile, .search-mobile { display: none; }
.top-search { flex: 1; max-width: 460px; min-width: 120px; position: relative; }
.top-search-gap { flex: 1; }
.top-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top-search input {
  width: 100%; height: 38px; padding: 0 64px 0 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font: inherit;
}
.top-search input::placeholder { color: var(--muted); }
.top-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: flex; gap: 3px; }
.kbd span { font-size: 10.5px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 5px; line-height: 18px; background: var(--surface-2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-chip {
  display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); white-space: nowrap;
}
.top-chip .icon { color: var(--muted); }
.top-chip small { display: block; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); line-height: 1.1; }
.top-chip strong { display: block; font-size: 13px; line-height: 1.2; }
.data-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.data-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.data-pill.sample { background: var(--warn-soft); color: var(--warn-text); }
.data-pill.live { background: var(--ok-soft); color: var(--ok-text); }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex: none;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; font: inherit;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn.boxed { border-color: var(--border); background: var(--surface); }
.icon-btn.accent { background: var(--accent); color: var(--accent-ink); }
.icon-btn.accent:hover { background: var(--accent-hover); }
.dot-count {
  position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg);
}
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 3px 6px 3px 3px; border-radius: 12px; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: var(--surface-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), #fbbf24); color: var(--accent-ink); font-weight: 800; font-size: 13px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.who strong { font-size: 13px; white-space: nowrap; }
.who small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; z-index: 40;
}
.menu-pop .menu-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); border: 0;
  background: none; color: var(--ink-2); font: inherit; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.menu-item.danger { color: var(--danger-text); }
.menu-pop form { margin: 0; }

.content { padding: 24px 24px 56px; width: 100%; max-width: 1600px; margin-inline: auto; }
/* Counter screens (POS, quotation and order builders) use more of a wide screen; on very wide (4K) screens the pages
   grow a little too, and always stay centered between the menu and the right edge. */
.content:has(> .counter) { max-width: 2100px; }
@media (min-width: 2200px) { .content { max-width: 1840px; } .content:has(> .counter) { max-width: 2400px; } }
.bottomnav { display: none; }

/* Collapsed sidebar (desktop toggle) */
:root[data-sidebar="collapsed"] { --side-w: 72px; }
:root[data-sidebar="collapsed"] .sidebar .brand-text,
:root[data-sidebar="collapsed"] .sidebar .nav-label,
:root[data-sidebar="collapsed"] .sidebar .nav-section,
:root[data-sidebar="collapsed"] .sidebar .tag { display: none; }
:root[data-sidebar="collapsed"] .side-top { padding: 0; justify-content: center; flex-direction: column; gap: 0; }
:root[data-sidebar="collapsed"] .side-collapse { margin: 0; position: absolute; top: 12px; right: -14px; width: 28px; height: 28px; border: 1px solid var(--border); background: var(--surface); border-radius: 50%; }
:root[data-sidebar="collapsed"] .side-collapse .icon { transform: rotate(180deg); width: 14px; height: 14px; }
:root[data-sidebar="collapsed"] .nav-item { justify-content: center; padding: 10px 0; }
:root[data-sidebar="collapsed"] .nav-item .count { position: absolute; top: 3px; right: 8px; margin: 0; font-size: 9.5px; min-width: 16px; line-height: 16px; padding: 0 4px; }
:root[data-sidebar="collapsed"] .nav { padding-top: 14px; }

/* ---------- building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-head .link { font-size: 13px; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 14px 20px 18px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { font-size: 15px; display: flex; align-items: center; gap: 10px; }
.section-title h2::before { content: ""; width: 3px; height: 16px; border-radius: 2px; background: var(--accent); }
.section-title .note { margin-left: auto; font-size: 12px; color: var(--muted); }

.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .lead { color: var(--muted); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.back-link:hover { color: var(--ink); text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 7px 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger-text); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 50px; font-size: 16px; padding: 12px 20px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--ink); font: inherit;
}
textarea.input { min-height: 84px; resize: vertical; }
select.input { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[readonly] { color: var(--muted); }
label.field { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
/* Label text, the required mark and a leading hint share the first line; controls, errors and trailing hints take full rows. */
label.field > :is(input:not([type=hidden]), select, textarea, .input-group, .search-input, .row, .error, .hint:last-child, span[style*="display:flex"]) { flex: 1 1 100%; }
label.field > .hint:not(:last-child) { margin-left: 4px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.field .error { font-weight: 500; color: var(--danger-text); font-size: 12px; }
.field.has-error .input { border-color: var(--danger); }
.req { color: var(--accent-text); }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-right: 0; border-radius: 10px 0 0 10px; background: var(--surface-3); color: var(--muted); font-weight: 600; }
.input-group .input { border-radius: 0 10px 10px 0; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input .input { padding-left: 38px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; color: var(--ink); font-size: 14px; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; cursor: pointer; margin: 0; flex: none; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform .15s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(16px); background: var(--accent-ink); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; font-family: inherit;
}
.chip:hover { text-decoration: none; background: var(--surface-2); color: var(--ink); }
.chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-text); font-weight: 600; }
.chip .n { font-size: 11.5px; opacity: .8; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); gap: 2px; }
.seg a, .seg button { padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); border: 0; background: none; cursor: pointer; font-family: inherit; }
.seg a:hover, .seg button:hover { color: var(--ink); text-decoration: none; }
.seg .on { background: var(--surface-3); color: var(--ink); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-warn { background: var(--warn-soft); color: var(--warn-text); }
.badge-ok { background: var(--ok-soft); color: var(--ok-text); }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 99px; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { background: var(--ok-soft); color: var(--ok-text); }
.delta.down { background: var(--danger-soft); color: var(--danger-text); }
.delta.flat { background: var(--surface-3); color: var(--muted); }
.delta-up { color: var(--ok-text); font-weight: 600; }
.delta-down { color: var(--danger-text); font-weight: 600; }

.table-wrap { overflow-x: auto; position: relative; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
  padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--ink); text-decoration: none; }
.table th .sort-on { color: var(--accent-text); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table tbody tr.click, .table tbody tr[data-href], .table tbody tr[data-popup] { cursor: pointer; }
.table .sub { display: block; color: var(--muted); font-size: 12px; }
.table .actions-cell { text-align: right; white-space: nowrap; width: 1%; }
.table td.primary { min-width: 230px; }
.qty-in { color: var(--ok-text); font-weight: 600; }
.qty-out { color: var(--ink); }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.thumb { width: 38px; height: 38px; border-radius: 9px; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--surface-3); color: var(--muted); font-weight: 700; font-size: 13px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .empty-icon { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty .empty-icon .icon { width: 26px; height: 26px; }
.empty h2 { color: var(--ink); margin-bottom: 6px; font-size: 17px; }
.empty p { max-width: 420px; margin: 0 auto 16px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; background: var(--info-soft); color: var(--ink); }
.notice .icon { color: var(--info-text); margin-top: 1px; }
.notice.warn { background: var(--warn-soft); }
.notice.warn .icon { color: var(--warn-text); }
.notice.danger { background: var(--danger-soft); }
.notice.danger .icon { color: var(--danger-text); }
.notice.ok { background: var(--ok-soft); }
.notice.ok .icon { color: var(--ok-text); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); flex-wrap: wrap; }

.flash {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  font-weight: 600; animation: flash-in .2s ease, flash-out .3s ease 4s forwards; max-width: calc(100vw - 32px);
}
.flash .icon { color: var(--ok-text); }
.flash.error .icon { color: var(--danger-text); }
@keyframes flash-in { from { opacity: 0; transform: translate(-50%, -8px); } }
@keyframes flash-out { to { opacity: 0; transform: translate(-50%, -8px); visibility: hidden; } }

dialog { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown .menu-pop { min-width: 190px; }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; padding: 28px; }
.auth-card .brand { justify-content: center; margin-bottom: 6px; }
.auth-card .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
.auth-card .brand-text strong { font-size: 18px; }
.auth-card h1 { text-align: center; font-size: 20px; margin: 14px 0 4px; }
.auth-card .lead { text-align: center; color: var(--muted); margin-bottom: 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card form.demo-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-roles button { justify-content: flex-start; flex-direction: column; align-items: flex-start; gap: 0; min-height: 54px; text-align: left; }
.demo-roles small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 20px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-error { color: var(--danger-text); font-size: 13px; font-weight: 500; }

/* ---------- dashboard ---------- */
.hello { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.hello h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--ok-soft); color: var(--ok-text); }
.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
.hello .meta { color: var(--muted); margin-top: 6px; }
.hello .meta a { color: var(--ok-text); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 16px; }
.hero { padding: 20px 22px 0; display: flex; flex-direction: column; overflow: hidden; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.hero-value { font-size: 40px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--muted); }
.pill strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.hero .chart { margin: 8px -22px 0; flex: 1; min-height: 190px; }
.kpis { display: grid; gap: 16px; grid-template-rows: repeat(3, 1fr); }
.kpi { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.kpi-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-text); }
.kpi-icon.ok { background: var(--ok-soft); color: var(--ok-text); }
.kpi-icon.danger { background: var(--danger-soft); color: var(--danger-text); }
.kpi-icon.warn { background: var(--warn-soft); color: var(--warn-text); }
.kpi-icon.info { background: var(--info-soft); color: var(--info-text); }
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi-value { font-size: 21px; font-weight: 750; font-variant-numeric: tabular-nums; }
.kpi .side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.spark { display: block; width: 92px; height: 30px; }
.spark polyline { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.spark.up polyline { stroke: var(--ok); }
.spark.down polyline { stroke: var(--danger); }
.spark.flat polyline { stroke: var(--muted); }

.ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.op {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; color: var(--ink); border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
a.op:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-2); }
.op.alert { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.op.attn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.op .kpi-icon { width: 44px; height: 44px; }
.op-value { font-size: 22px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.op-label { font-size: 12.5px; color: var(--muted); }
.op .go { margin-left: auto; color: var(--muted); }

.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.metric { padding: 16px 20px; }
.metric + .metric { border-left: 1px solid var(--border); }
.metric .value { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.legend-inline { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-inline i.dash { width: 14px; height: 0; border-radius: 0; border-top: 2px dashed var(--chart-prev); }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .area { fill: url(#gradArea); }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-prev { fill: none; stroke: var(--chart-prev); stroke-width: 1.6; stroke-dasharray: 4 4; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--chart-axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart .cross { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart .dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; opacity: 0; }
.chart .dot-prev { fill: var(--chart-prev); stroke: var(--surface); stroke-width: 2; opacity: 0; }
.chart.hovering .cross, .chart.hovering .dot, .chart.hovering .dot-prev { opacity: 1; }
.chart .endpoint { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.chart .bar { fill: var(--chart-line); }
.chart .bar.today { fill: var(--warn); }
.chart .hit { fill: transparent; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; padding: 8px 11px; border-radius: 10px; font-size: 12.5px;
  background: var(--surface-3); color: var(--ink); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .1s;
}
.tooltip.show { opacity: 1; }
.tooltip strong { display: block; font-size: 13px; margin-bottom: 2px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.tooltip .t-row i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tooltip .t-row b { margin-left: auto; padding-left: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
details.table-view summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 18px 20px 20px; }
.donut { position: relative; width: 190px; height: 190px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 22; }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .center strong { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.donut .center small { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.legend-list { width: 100%; list-style: none; margin: 0; padding: 0; }
.legend-list li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; color: var(--ink-2); }
.legend-list i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-list b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend-list .pct { color: var(--muted); width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .lead { flex: none; margin-top: 1px; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.list .detail { font-size: 12.5px; color: var(--muted); }
.list .meta { flex: none; font-size: 13px; color: var(--ink-2); text-align: right; font-weight: 600; }

/* legacy tiles (kept for other pages) */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.tile { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
a.tile:hover { text-decoration: none; border-color: var(--border-strong); }
.tile-label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tile-value { font-size: 24px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12.5px; color: var(--ink-2); }
.tile.tone-danger .tile-value { color: var(--danger-text); }
.tile.tone-warn .tile-value { color: var(--warn-text); }

/* ---------- alerts ---------- */
.alert-item { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--ink); }
.alert-item:last-child { border-bottom: 0; }
a.alert-item:hover { background: var(--surface-2); text-decoration: none; }
.alert-icon { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; }
.alert-icon.critical { background: var(--danger-soft); color: var(--danger-text); }
.alert-icon.warning { background: var(--warn-soft); color: var(--warn-text); }
.alert-icon.info { background: var(--info-soft); color: var(--info-text); }
.alert-title { font-weight: 600; }
.alert-detail { font-size: 13px; color: var(--ink-2); }
.alert-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.section-label { padding: 9px 18px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.card > .section-label:first-child { border-radius: var(--radius) var(--radius) 0 0; }

/* ---------- stock & item ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .search-input { flex: 1 1 260px; }
.filters select.input { width: auto; min-width: 160px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .search-input { flex: 1 1 240px; }
.toolbar select.input { width: auto; min-width: 150px; flex: 0 1 auto; }
.item-name { font-weight: 600; color: var(--ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 14px 16px; }
.stat .tile-value { font-size: 21px; }
.ledger-filter { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); margin-top: 12px; }
.ledger-filter label.field { min-width: 150px; }
.row-start td { background: var(--surface-2); font-weight: 600; }

/* ---------- profiles (CRUD) ---------- */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.form-section { padding: 20px; }
.form-section + .form-section { border-top: 1px solid var(--border); }
.form-section h2 { margin-bottom: 4px; }
.form-section .section-lead { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fields .span-2 { grid-column: 1 / -1; }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.photo-box { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.photo-preview { width: 140px; height: 140px; border-radius: 18px; background: var(--surface-2); border: 1px dashed var(--border-strong); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview .icon { width: 34px; height: 34px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px; margin-top: 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-zone .card-head h2 { color: var(--danger-text); }
.usage-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.usage-list li { display: flex; justify-content: space-between; padding: 3px 0; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-dot.on { color: var(--ok-text); }
.status-dot.off { color: var(--muted); }
.profile-tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 18px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.profile-tabs::-webkit-scrollbar { display: none; }
.profile-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.profile-tabs a:hover { color: var(--ink); text-decoration: none; }
.profile-tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.profile-tabs a.on .icon { color: var(--accent-text); }
.profile-tabs .n { font-size: 11.5px; padding: 0 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums; }
.search-group h2 { display: flex; align-items: center; gap: 8px; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); gap: 16px; align-items: start; }
.pos-search { position: sticky; top: calc(var(--top-h) + 8px); z-index: 2; background: var(--bg); padding-bottom: 10px; }
.pos-search .input { min-height: 48px; font-size: 16px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.result {
  text-align: left; padding: 13px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 98px; transition: border-color .12s, background .12s;
}
.result:hover { border-color: var(--accent); background: var(--surface-2); }
.result:disabled { opacity: .5; cursor: not-allowed; }
.result .r-name { font-weight: 600; line-height: 1.3; }
.result .r-meta { font-size: 11.5px; color: var(--muted); }
.result .r-price { margin-top: auto; font-weight: 750; font-variant-numeric: tabular-nums; }
.result .r-stock { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cart { position: sticky; top: calc(var(--top-h) + 8px); display: flex; flex-direction: column; max-height: calc(100vh - var(--top-h) - 24px); }
.cart-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.cart-lines { flex: 1; overflow-y: auto; padding: 4px 16px; min-height: 110px; }
.cart-empty { color: var(--muted); text-align: center; padding: 30px 8px; font-size: 13.5px; }
.cline { padding: 12px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; }
.cline:last-child { border-bottom: 0; }
.cline .c-name { font-weight: 600; font-size: 13.5px; }
.cline .c-total { font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }
.cline .c-ctrl { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
.cline select { width: auto; min-height: 36px; padding: 5px 30px 5px 8px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.stepper button { width: 36px; height: 36px; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; display: grid; place-items: center; font-size: 16px; }
.stepper input { width: 62px; height: 36px; border: 0; text-align: center; font: inherit; font-weight: 700; background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums; }
.c-remove { margin-left: auto; }
.cart-foot { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13.5px; font-variant-numeric: tabular-nums; align-items: center; }
.totals .grand { font-size: 24px; font-weight: 800; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pay-methods button { min-height: 40px; padding: 6px; font-size: 13px; }
.pay-methods button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.credit-box { display: none; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.credit-box.show { display: flex; }
.tier-tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.tier-tabs button { border: 0; background: none; color: var(--muted); padding: 4px 10px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; border-radius: 7px; }
.tier-tabs button.on { background: var(--surface-3); color: var(--ink); }
.cart-bar { display: none; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: none; place-items: center; z-index: 60; padding: 16px; }
.modal-backdrop.show { display: grid; }
.modal { width: 100%; max-width: 420px; padding: 26px; text-align: center; }
.modal .big-check { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; background: var(--ok-soft); color: var(--ok-text); }
.modal .big-check .icon { width: 28px; height: 28px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--danger); color: #fff; padding: 11px 16px; border-radius: 10px; z-index: 70; max-width: 92vw; display: none; font-weight: 600; }
.toast.show { display: block; }

/* ---------- counter screens: POS, receiving, shift turnover ---------- */
body.busy { cursor: progress; }
body.busy form[data-ajax] button, body.busy form[data-popup-form] button, body.busy .popup-foot button { pointer-events: none; }
a.top-chip:hover { text-decoration: none; border-color: var(--border-strong); }
.desk { display: grid; grid-template-columns: 188px minmax(0, 1fr) minmax(290px, 350px); gap: 16px; align-items: start; }
.desk.two { grid-template-columns: 196px minmax(0, 1fr); }
.desk-center { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.desk-menu { position: sticky; top: calc(var(--top-h) + 16px); display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.desk-menu form { margin: 0; }
.menu-title { padding: 10px 8px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.menu-title:first-child { padding-top: 4px; }
.menu-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); border: 0;
  background: none; color: var(--ink-2); font: inherit; font-weight: 500; text-align: left; cursor: pointer; line-height: 1.3;
}
.menu-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.menu-btn .icon { color: var(--muted); }
.menu-btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.menu-btn.primary:hover { background: var(--accent-hover); }
.menu-btn.primary .icon { color: inherit; }
.menu-btn.danger, .menu-btn.danger .icon { color: var(--danger-text); }
.menu-btn[disabled] { opacity: .45; cursor: not-allowed; }
.menu-btn .n { margin-left: auto; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); font-variant-numeric: tabular-nums; }

.pick { position: sticky; top: calc(var(--top-h) + 16px); display: flex; flex-direction: column; max-height: calc(100vh - var(--top-h) - 32px); overflow: hidden; }
.pick-head { padding: 14px 14px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.pick-head h2 { display: flex; align-items: center; gap: 8px; }
.pick-list { overflow-y: auto; flex: 1; scrollbar-width: thin; }
.pick-group { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; padding: 7px 14px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.pick-group.critical { color: var(--danger-text); }
.pick-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px 10px; align-items: center; padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--border); }
.pick-row .p-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.pick-row .p-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-row .p-side { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pick-row .p-price { font-weight: 700; font-size: 13.5px; }
.pick-row .p-qty { font-size: 12px; color: var(--muted); }
.pick-row .p-qty.low { color: var(--warn-text); font-weight: 600; }
.pick-row .p-qty.out { color: var(--danger-text); font-weight: 600; }
.pick-none { padding: 30px 14px; text-align: center; color: var(--muted); }

.lines td.qty-cell { width: 120px; }
.lines .qty-in-cell { width: 92px; min-height: 34px; padding: 4px 8px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.lines select.input { min-height: 34px; padding: 4px 28px 4px 8px; width: auto; font-size: 12.5px; }
.lines .code { font-size: 12px; color: var(--muted); }
.sum { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 14px; margin: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; text-align: right; font-weight: 600; color: var(--ink); }
.sum .neg { color: var(--danger-text); }
.sum .sep { grid-column: 1 / -1; height: 1px; background: var(--border); margin: 3px 0; }
.sum dt.big, .sum dd.big { font-size: 19px; font-weight: 800; color: var(--ink); }
.sum dt.accent, .sum dd.accent { color: var(--accent-text); }
.sum-block + .sum-block { border-top: 1px solid var(--border); }
.sum-block { padding: 14px 18px; }
.sum-block h3 { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.remarks { display: inline-flex; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.remarks.BALANCED { background: var(--ok-soft); color: var(--ok-text); }
.remarks.SHORT { background: var(--danger-soft); color: var(--danger-text); }
.remarks.OVER { background: var(--warn-soft); color: var(--warn-text); }
.cust { display: flex; gap: 14px; align-items: center; }
.cust .avatar { width: 48px; height: 48px; font-size: 16px; }
.cust .kv { flex: 1; grid-template-columns: auto 1fr auto 1fr; font-size: 13px; }
.head-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tabs-row { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 0 12px; border-bottom: 1px solid var(--border); }
.tabs-row::-webkit-scrollbar { display: none; }
.tabs-row a { display: inline-flex; align-items: center; gap: 6px; padding: 11px 10px; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs-row a:hover { color: var(--ink); text-decoration: none; }
.tabs-row a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs-row .n { font-size: 11px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums; }
.denoms { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.denoms td { padding: 5px 0; }
.denoms td:first-child { color: var(--muted); width: 70px; }
.denoms td:last-child { text-align: right; font-weight: 600; }
.denoms .input { min-height: 34px; padding: 4px 8px; text-align: right; width: 90px; }
.dlg { width: min(520px, calc(100% - 32px)); padding: 0; }
.dlg.wide { width: min(760px, calc(100% - 32px)); }
.dlg .form-section h2 { margin-bottom: 4px; }
.dlg .form-error { margin-top: 12px; }
.bar-chart { display: block; width: 100%; height: auto; }
.bar-chart .bar { fill: var(--chart-line); }
.bar-chart .bar.dim { fill: color-mix(in srgb, var(--chart-line) 35%, var(--surface-3)); }
.bar-chart a:hover .bar { fill: var(--accent-hover); }
.bar-chart .grid-line { stroke: var(--chart-grid); }
.bar-chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.bar-chart .val { fill: var(--ink-2); font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.view-switch, .phone-bar { display: none; }
.receipt-page .receipt { box-shadow: var(--shadow); }

@media (max-width: 1280px) {
  .desk { grid-template-columns: 180px minmax(0, 1fr) minmax(300px, 340px); }
}
@media (max-width: 1100px) {
  .desk, .desk.two { grid-template-columns: minmax(0, 1fr) minmax(290px, 330px); }
  .desk.two { grid-template-columns: minmax(0, 1fr); }
  .desk-menu { grid-column: 1 / -1; position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 6px; }
  .desk-menu::-webkit-scrollbar { display: none; }
  .desk-menu .menu-title { display: none; }
  .desk-menu .menu-btn { width: auto; flex: none; white-space: nowrap; }
}
@media (max-width: 760px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .pick { position: static; max-height: none; }
  .view-switch { display: flex; }
  .desk[data-view="products"] > .desk-center { display: none; }
  .desk[data-view="cart"] > .pick { display: none; }
  .phone-bar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 35;
    align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); }
  .desk[data-view="cart"] .phone-bar { display: none; }
  .phone-bar.empty { display: none; }
  .desk[data-view="products"] .pick-list { padding-bottom: 70px; }
  .head-fields { grid-template-columns: minmax(0, 1fr); }
  .cust .kv { grid-template-columns: auto 1fr; }
  .lines td.qty-cell { width: auto; }
}
@media print {
  /* Paper is white whatever the screen theme is. */
  :root, :root[data-theme="dark"], :root[data-theme="light"] {
    color-scheme: light; --bg: #fff; --bg-side: #fff; --surface: #fff; --surface-2: #f4f4f2; --surface-3: #eaeae7; --border: #dcdcd7;
    --border-strong: #c9c9c3; --ink: #111; --ink-2: #333; --muted: #666; --accent-text: #b4400a; --ok-text: #15803d;
    --warn-text: #a15c00; --danger-text: #b91c1c; --info-text: #1d4ed8; --shadow: none;
  }
  .sidebar, .topbar, .bottomnav, .desk-menu, .tabs-row form, .flash, .no-print, .phone-bar, .view-switch { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  .desk { display: block; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; margin-bottom: 12px; }
}

/* ---------- calendar ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cal-head h2 { font-size: 17px; min-width: 150px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.cal-day { min-height: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; color: var(--ink); overflow: hidden; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: var(--surface-2); text-decoration: none; }
.cal-day.other { background: color-mix(in srgb, var(--bg) 55%, var(--surface)); }
.cal-day.other .d-num { color: var(--muted); }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.d-num { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-day.today .d-num { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 7px; align-self: flex-start; }
.ev { display: flex; align-items: center; gap: 5px; font-size: 11.5px; line-height: 1.35; padding: 2px 5px; border-radius: 5px; background: var(--surface-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.ev .sw, .legend .sw, .agenda .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.ev.done { color: var(--muted); text-decoration: line-through; }
.ev.late { background: var(--danger-soft); }
.ev-more { font-size: 11.5px; color: var(--muted); padding-left: 5px; }
.dots { display: none; gap: 3px; flex-wrap: wrap; }
.dots .sw { width: 6px; height: 6px; border-radius: 50%; }
.t-incoming { background: var(--s1); }
.t-delivery { background: var(--s2); }
.t-receivable { background: var(--s3); }
.t-payable { background: var(--s4); }
.t-task { background: var(--s5); }
.t-expiry { background: var(--s6); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend a { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--ink-2); background: var(--surface); }
.legend a:hover { text-decoration: none; background: var(--surface-2); }
.legend a.off { opacity: .45; }
.legend a.off .sw { background: transparent; outline: 1.5px solid var(--muted); }
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.agenda li:last-child { border-bottom: 0; }
.agenda .sw { margin-top: 6px; width: 10px; height: 10px; }
.agenda .a-type { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.agenda .a-title { font-weight: 600; font-size: 13.5px; }
.agenda .a-detail { font-size: 12.5px; color: var(--ink-2); }
.agenda li.done .a-title { text-decoration: line-through; color: var(--muted); }

/* ---------- receipt ---------- */
.receipt { max-width: 340px; margin: 24px auto; background: #fff; color: #111; padding: 18px 16px; font-family: "Courier New", monospace; font-size: 13px; border: 1px dashed #bbb; }
.receipt h1 { font-size: 15px; text-align: center; letter-spacing: 0; }
.receipt .c { text-align: center; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 2px 0; vertical-align: top; }
.receipt .r { text-align: right; }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: 8px 0; }
.receipt .sig { text-align: center; font-size: 12px; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .receipt { border: 0; margin: 0; max-width: none; width: 72mm; padding: 0 2mm; }
}

/* ---------- tablet: icon rail ---------- */
@media (max-width: 1180px) {
  .hero-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; }
  .form-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .top-chip.store { display: none; }
}
@media (max-width: 1024px) {
  :root { --side-w: 72px; }
  .sidebar .brand-text, .sidebar .nav-label, .sidebar .nav-section, .sidebar .tag, .side-collapse { display: none; }
  .side-top { padding: 0; justify-content: center; }
  .nav { padding-top: 12px; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-item .count { position: absolute; top: 3px; right: 8px; margin: 0; font-size: 9.5px; min-width: 16px; line-height: 16px; padding: 0 4px; }
  .content { padding: 20px; }
  .topbar { padding: 0 20px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .cal-layout, .form-layout { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos { grid-template-columns: minmax(0, 1fr) 330px; }
  .who.top-who { display: none; }
  .kbd { display: none; }
}

/* ---------- phone: bottom nav, cards instead of tables ---------- */
@media (max-width: 639px) {
  body { font-size: 15px; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 0 12px; gap: 8px; padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); }
  .brand-mobile { display: flex; }
  .brand-mobile .brand-mark { width: 32px; height: 32px; }
  .page-title, .top-search, .top-chip, .user-menu .who { display: none; }
  .search-mobile { display: inline-grid; }
  .data-pill { font-size: 10.5px; padding: 2px 8px; }
  .content { padding: 16px 14px calc(88px + env(safe-area-inset-bottom)); }
  h1 { font-size: 21px; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg-side);
    border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: 10.5px; font-weight: 600; color: var(--muted); }
  .bottomnav a.active { color: var(--accent-text); }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav .icon { width: 22px; height: 22px; }
  .hero-value { font-size: 32px; }
  .kpis { grid-template-columns: 1fr; }
  .metric-row { grid-template-columns: 1fr; }
  .metric + .metric { border-left: 0; border-top: 1px solid var(--border); }
  .ops { grid-template-columns: 1fr 1fr; gap: 10px; }
  .op { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .op .go { display: none; }
  .op .kpi-icon { width: 36px; height: 36px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile-value { font-size: 20px; }
  .grid-2, .stat-row { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .fields, .fields-3 { grid-template-columns: 1fr; }
  .topbar [data-theme-toggle], .topbar .icon-btn.accent, .user-menu > summary > .icon-xs { display: none; }
  .topbar .data-pill { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
  .card-head { padding: 14px 16px 0; }
  .card-body { padding: 12px 16px 16px; }
  .form-section { padding: 16px; }
  .btn { min-height: 44px; }
  .input { min-height: 46px; font-size: 16px; }
  .toolbar select.input, .filters select.input { flex: 1 1 45%; min-width: 0; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .sticky-actions { bottom: calc(60px + env(safe-area-inset-bottom)); margin: 16px -14px 0; }
  .sticky-actions .btn { flex: 1; }

  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: 12px 16px; border-bottom: 1px solid var(--border); position: relative; }
  .table-cards td { border: 0; padding: 2px 0; text-align: left !important; }
  .table-cards td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12.5px; }
  .table-cards td.primary { font-size: 15px; margin-bottom: 4px; }
  .table-cards td.primary::before { content: none; }
  .table-cards td.actions-cell { position: absolute; top: 10px; right: 10px; width: auto; }
  .table-cards td.actions-cell::before { content: none; }

  .pos { grid-template-columns: minmax(0, 1fr); }
  .pos-search { top: calc(var(--top-h) + env(safe-area-inset-top)); }
  .pos-search .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pos-search .chips::-webkit-scrollbar { display: none; }
  .results { grid-template-columns: 1fr; gap: 8px; }
  .result { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: baseline; }
  .result .r-name { flex: 1 1 100%; }
  .result .r-price { margin-left: auto; margin-top: 0; }
  .cart { position: fixed; inset: 0; z-index: 50; max-height: none; border-radius: 0; display: none; }
  .cart.open { display: flex; }
  .cart-bar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 35;
    min-height: 54px; border-radius: 14px; box-shadow: var(--shadow-pop);
  }
  .cart-bar.empty { display: none; }
  .toast { bottom: auto; top: calc(64px + env(safe-area-inset-top)); }
  .cal-day { min-height: 52px; padding: 4px; }
  .cal-day .ev, .cal-day .ev-more { display: none; }
  .cal-day .dots { display: flex; }
  .cal-dow { padding: 6px 2px; text-align: center; font-size: 10.5px; }
  .d-num { font-size: 12px; }
}
.btn.disabled { opacity: .45; pointer-events: none; }
.lines td.primary { min-width: 150px; }
.lines .unit { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; text-align: right; }
.lines td.qty-cell { width: 1%; }
.lines th, .lines td { padding-left: 10px; padding-right: 10px; }
.lines select.input { font-size: 12px; }
.lines .qty-in-cell { width: 72px; }
.lines td.primary { min-width: 130px; }
@media (max-width: 639px) {
  .cart-lines.table-cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-right: 48px; }
  .cart-lines.table-cards td { width: auto; }
  .cart-lines.table-cards td.primary { flex: 1 1 100%; margin: 0; }
  .cart-lines.table-cards td[data-label]::before { content: none; }
  .cart-lines.table-cards td.qty-cell form { display: flex; align-items: center; gap: 6px; }
  .cart-lines .unit { display: inline; margin: 0; }
  .cart-lines.table-cards td[data-label="Total"] { margin-left: auto; font-size: 15px; }
}
@media (max-width: 639px) {
  .cart-lines.table-cards td { padding: 0; }
  .cart-lines.table-cards td.primary { padding-bottom: 2px; }
}
.desk[data-view="cart"] .view-switch [data-view-btn="cart"], .desk[data-view="products"] .view-switch [data-view-btn="products"] { background: var(--surface-3); color: var(--ink); }

/* Pop-up forms (popup_start() in layout.php, [data-popup] in app.js) */
.popup-dlg { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; }
.popup-dlg.wide { width: min(980px, calc(100% - 32px)); }
.popup-dlg.xl { width: min(1320px, calc(100% - 32px)); height: calc(100dvh - 32px); }
.popup-dlg[open] { display: flex; flex-direction: column; }
.popup { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.popup-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); }
.popup-head h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.popup-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.popup-thumb { width: 42px; height: 42px; border-radius: 11px; font-size: 14px; }
.popup-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; background: var(--bg); }
.popup-body > .notice, #popup-flash > .notice { margin-bottom: 14px; }
.popup-body > form + .card, .popup-body > .card + .card { margin-top: 16px; }
.popup-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface); }
.popup-page { padding: 0; overflow: visible; }
.popup-page .popup-body { overflow: visible; border-radius: 0 0 var(--radius) var(--radius); }
.popup-page .popup-foot { position: sticky; bottom: 0; z-index: 10; border-radius: 0 0 var(--radius) var(--radius); }
.popup .form-layout { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 1024px) {
  .popup .form-layout { grid-template-columns: minmax(0, 1fr); }
  .popup-page .popup-foot { bottom: calc(60px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .popup-dlg, .popup-dlg.wide { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .popup-body { padding: 14px; }
  .popup-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .popup-foot .btn { flex: 1; }
}

/* On screen only: where to fill in the store's email, address and contact number when none is saved (store_reach_hint()). */
.reach-hint { margin: 6px 0 2px; padding: 5px 8px; border: 1px dashed #d9a441; border-radius: 6px; background: #fff8e8; color: #8a5a00; font: 500 11px/1.4 "Inter", system-ui, sans-serif; }

/* ---------- Top bar: today's agenda and the alerts bell (layout.php; app.js loads the panels when opened) ---------- */
.top-pop { position: relative; }
.top-pop > summary { list-style: none; }
.top-pop > summary::-webkit-details-marker { display: none; }
.top-pop[open] > summary { background: var(--surface-2); border-color: var(--border-strong); color: var(--ink); }
.pop-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 10.5px; font-weight: 700; line-height: 18px;
  text-align: center; color: #fff; background: var(--info); box-shadow: 0 0 0 2px var(--bg); font-variant-numeric: tabular-nums; }
.pop-badge.danger { background: var(--danger); }
.pop-badge.warn { background: var(--warn); color: #1d1300; }
.pop-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-height: min(72vh, 580px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); z-index: 45; }
.pop-panel.wide { width: 400px; }
.pop-head { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 10px; border-bottom: 1px solid var(--border); }
.pop-head strong { font-size: 14px; }
.pop-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.pop-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.pop-foot form { margin: 0; }
.pop-loading, .pop-none { display: block; padding: 14px; color: var(--muted); font-size: 13px; }
.pop-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.pop-empty .icon { width: 26px; height: 26px; color: var(--ok-text); }
.pop-empty strong { color: var(--ink); font-size: 14px; }
.pop-label { padding: 10px 14px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pop-task, .pop-ev { display: flex; align-items: flex-start; gap: 10px; padding: 8px 14px; color: var(--ink); }
.pop-task:hover, .pop-ev:hover { background: var(--surface-2); text-decoration: none; }
.pop-task form { margin: 0; }
.pop-task .grow, .pop-ev .grow { min-width: 0; color: inherit; }
.pop-task .grow:hover { text-decoration: none; }
.pop-task strong, .pop-ev strong { display: block; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.pop-task small, .pop-ev small { display: block; font-size: 11.5px; color: var(--muted); }
.pop-task.late small { color: var(--danger-text); }
.pop-ev .sw { margin-top: 5px; width: 9px; height: 9px; border-radius: 3px; flex: none; }
.pop-panel .alert-item { padding: 10px 14px; gap: 10px; }
.pop-panel .alert-icon { width: 28px; height: 28px; border-radius: 8px; }
.pop-panel .alert-icon .icon { width: 15px; height: 15px; }
.pop-panel .alert-title { font-size: 13px; }
.pop-panel .alert-detail { font-size: 12px; }
@media (max-width: 640px) {
  .pop-panel, .pop-panel.wide { position: fixed; left: 8px; right: 8px; top: calc(var(--top-h) + 6px); width: auto; max-height: calc(100vh - var(--top-h) - 20px); }
}

/* Alerts: the level's icon, the alert (a link to where to act), and its actions (make it a task, snooze it). */
.alert-item { align-items: flex-start; }
.alert-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--ink); }
.alert-main:hover { text-decoration: none; }
.alert-main:hover .alert-title { text-decoration: underline; }
.alert-title { overflow-wrap: anywhere; }
.alert-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.alert-actions form { margin: 0; }
.alert-item.snoozed { opacity: .72; }

/* Tasks: the tick box, the list (task, its checklist bar, who, when), and the task pop-up (task.php). */
.task-check { flex: none; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border-radius: 7px; border: 2px solid var(--border-strong);
  background: var(--surface); color: #fff; cursor: pointer; }
.task-check:hover { border-color: var(--ok); }
.task-check[aria-pressed="true"], .task-check.on { background: var(--ok); border-color: var(--ok); }
.task-check.locked { border-style: dashed; color: var(--muted); cursor: help; }
.task-check .icon { width: 13px; height: 13px; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.task-list li:last-child { border-bottom: 0; }
.task-list li form { margin: 0; }
.task-list li.late { box-shadow: inset 3px 0 0 var(--danger); }
.task-main { min-width: 0; color: var(--ink); }
.task-main:hover { text-decoration: none; }
.task-main:hover strong { text-decoration: underline; }
.task-main strong { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.task-main small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-list li.done .task-main strong { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; align-items: center; gap: 12px; flex: none; }
.task-mini { display: inline-block; width: 54px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.task-mini i, .task-progress i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.task-who { display: inline-flex; align-items: center; gap: 6px; min-width: 140px; font-size: 12.5px; color: var(--ink-2); }
.task-who .avatar { width: 24px; height: 24px; font-size: 10px; }
.task-due { min-width: 112px; text-align: right; font-size: 13px; font-weight: 600; }
.task-due small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.task-view { display: flex; flex-direction: column; gap: 12px; }
.task-title h3 { margin: 0 0 6px; font-size: 18px; overflow-wrap: anywhere; }
.task-status { align-self: flex-start; flex-wrap: wrap; }
.task-status form { margin: 0; }
.task-kv { margin: 0; }
.task-notes { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.task-section { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 4px; }
.task-progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: -6px; }
.task-steps { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; }
.task-steps li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.task-steps li:last-child { border-bottom: 0; }
.task-steps li form { margin: 0; }
.task-steps li.done .st { color: var(--muted); text-decoration: line-through; }
.task-steps .req { margin-left: 4px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--danger-text); }
.task-note { display: flex; gap: 10px; font-size: 13.5px; overflow-wrap: anywhere; }
.task-note .avatar { width: 28px; height: 28px; font-size: 11px; }
.task-note-add { display: flex; gap: 8px; }
.task-note-add .input { flex: 1; min-width: 0; }
.task-steps-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.task-steps-head select.input { width: auto; min-height: 32px; padding-block: 4px; }
.task-form label.field.check { align-items: center; gap: 8px; font-weight: 600; }
.task-form label.field.check > input[type="checkbox"] { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
@media (max-width: 720px) {
  .task-list li { flex-wrap: wrap; }
  .task-main { flex: 1 1 calc(100% - 40px); }
  .task-meta { width: 100%; padding-left: 34px; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  .task-who, .task-due { min-width: 0; }
}

/* Calendar additions: customer cheques and quotations, the filters, days with something overdue, the day's money. */
.t-cheque { background: var(--s6); }
.t-quote { background: var(--s7); }
.cal-filters { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-filters select.input { width: auto; }
.cal-kpis { margin-bottom: 14px; }
.cal-day.has-late .d-num::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-radius: 50%; background: var(--danger); vertical-align: middle; }
.ev b { font-weight: 700; }
.cal-side .card-head { align-items: flex-start; }
.agenda li form { margin: 0; }
.agenda li .task-check { margin-top: 2px; }
.cal-day-sum { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); }
.cal-day-sum > div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cal-day-sum .sw { width: 9px; height: 9px; border-radius: 3px; }
.cal-day-sum strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.cal-agenda { display: flex; flex-direction: column; gap: 12px; max-width: 920px; }
.cal-day-card .card-head { padding-bottom: 10px; }
.cal-day-card .card-head .sub { margin-right: auto; color: var(--muted); font-size: 12.5px; }
.cal-day-card.today { border-color: var(--accent); }
.cal-day-card.late { border-color: var(--danger); }
.cal-day-card h2 .icon { color: var(--danger-text); vertical-align: -3px; }

/* ---------- Sales agents (agent.php, agents.php) ---------- */
/* The quota bar: delivered (var(--s3)), then pending (var(--s1), lighter), and a line where the month is. The same two
   colors as the day-by-day and six-month charts, each always named in a legend. */
.ag-quota-card { padding: 18px 20px 16px; margin-bottom: 16px; }
.ag-quota-empty { display: flex; align-items: center; gap: 12px; }
.ag-quota-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.ag-quota-pct { font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ag-quota-pct small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.ag-quota-side { display: flex; gap: 24px; text-align: right; }
.ag-quota-side strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.ag-quota-side small { display: block; font-size: 12px; color: var(--muted); }
.ag-bar { position: relative; display: flex; height: 16px; border-radius: 99px; background: var(--surface-3); overflow: visible; }
.ag-bar i { display: block; height: 100%; }
.ag-bar i:first-child { border-radius: 99px 0 0 99px; }
.ag-bar .sold { background: var(--s3); }
.ag-bar .pipe { background: color-mix(in srgb, var(--s1) 55%, transparent); margin-left: 2px; }
.ag-bar .pipe[style*="width:0%"] { margin-left: 0; }
.ag-bar .pace { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 2px; }
.ag-bar.sm { height: 8px; min-width: 120px; }
.ag-bar.sm .pace { top: -3px; bottom: -3px; }
.ag-bar-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.ag-bar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ag-bar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.ag-bar-legend i.sold { background: var(--s3); }
.ag-bar-legend i.pipe { background: color-mix(in srgb, var(--s1) 55%, transparent); }
.ag-bar-legend i.pace { width: 2px; height: 12px; border-radius: 1px; background: var(--ink); }
.ag-other-targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ag-other-targets > div { display: flex; flex-direction: column; gap: 2px; }
.ag-other-targets strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.ag-mini { display: block; height: 6px; margin-top: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.ag-mini i { display: block; height: 100%; background: var(--s3); border-radius: inherit; }
.ag-charts { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.ag-follow { gap: 16px; margin-top: 16px; }
.ag-follow .list a.title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-follow .list .meta.owed { color: var(--danger-text); }
.chart .ag-quota { stroke: var(--chart-prev); stroke-width: 2; stroke-dasharray: 5 3; }
.ag-board .ag-col-bar { min-width: 180px; }
.ag-board .ag-col-bar .sub { display: block; margin-top: 6px; }
@media (max-width: 1100px) { .ag-charts { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .ag-quota-pct { font-size: 30px; }
  .ag-quota-side { width: 100%; justify-content: space-between; text-align: left; }
}
