/*!
 * SalePoint365 design system — one layer over AdminLTE 4 (public/dist).
 *
 * Colours come ONLY from tenant theme tokens (--sp-*), printed by the layout from App\Support\SidebarTheme.
 * Changing a preset there re-colours the whole application: sidebar, header, pages, tables, forms, modals,
 * drawers, POS terminal, product tiles, reports and receipt previews. Pages must not hard-code colours or
 * use inline styles; they compose the classes below (sp-*) and the Blade components in resources/views/components.
 *
 * Sections: 1 tokens · 2 bootstrap mapping · 3 base · 4 header · 5 sidebar · 6 page header · 7 cards & KPIs ·
 * 8 buttons · 9 forms & filter bar · 10 tables & pagination · 11 badges/chips · 12 states · 13 modals/drawers/toasts ·
 * 14 POS terminal · 15 receipts & documents · 16 guest pages · 17 legacy class names · 18 responsive · 19 print
 */

/* ===================================================================== 1. tokens */
:root {
    /* fallbacks when no tenant tokens are printed (same as the default "ocean" preset) */
    --sp-primary: #1f6feb; --sp-primary-rgb: 31,111,235; --sp-primary-contrast: #fff; --sp-primary-soft: #e7f0fe; --sp-accent: #0ea5a4;
    --sp-secondary: #5b6475; --sp-secondary-contrast: #fff;
    --sp-body-bg: #f4f6fa; --sp-surface: #fff; --sp-surface-2: #f8f9fc; --sp-border: #e3e7ef; --sp-text: #1d2433; --sp-text-muted: #6b7385;
    --sp-hover: #f1f4f9; --sp-focus: #1f6feb;
    --sp-sidebar-bg: #0f2747; --sp-sidebar-text: #dbe6f6; --sp-sidebar-muted: #8ea3c2; --sp-sidebar-hover: #183a66;
    --sp-sidebar-active-bg: #1f6feb; --sp-sidebar-active-text: #fff; --sp-sidebar-indicator: #7cc4ff;
    --sp-header-bg: #fff; --sp-header-text: #1d2433; --sp-header-border: #e3e7ef;
    --sp-success: #1f9d55; --sp-warning: #d98a00; --sp-danger: #d64545; --sp-info: #2b7bb9;
    --sp-table-head-bg: #f1f4f9; --sp-table-stripe: #fafbfd; --sp-input-bg: #fff;
    --sp-pos-bg: #eef1f6; --sp-pos-tile-bg: #fff; --sp-pos-tile-text: #1d2433; --sp-pos-cart-bg: #fff; --sp-pos-total-bg: #0f2747; --sp-pos-total-text: #fff;
    --sp-receipt-bg: #fff; --sp-receipt-text: #111; --sp-receipt-muted: #555; --sp-receipt-rule: #222;

    /* derived tones (computed from tokens, so they follow every theme) */
    --sp-success-soft: color-mix(in srgb, var(--sp-success) 14%, var(--sp-surface));
    --sp-warning-soft: color-mix(in srgb, var(--sp-warning) 16%, var(--sp-surface));
    --sp-danger-soft: color-mix(in srgb, var(--sp-danger) 14%, var(--sp-surface));
    --sp-info-soft: color-mix(in srgb, var(--sp-info) 14%, var(--sp-surface));
    --sp-accent-soft: color-mix(in srgb, var(--sp-accent) 15%, var(--sp-surface));
    --sp-secondary-soft: color-mix(in srgb, var(--sp-secondary) 12%, var(--sp-surface));
    --sp-shade: color-mix(in srgb, var(--sp-text) 8%, transparent);
    /* Stage 19 visibility tokens (derived, so every preset follows): controls and cards get a border that is actually
       visible, table headers and danger text reach WCAG AA on their backgrounds, the newest scanned cart line gets an accent */
    --sp-border-strong: color-mix(in srgb, var(--sp-text-muted) 72%, var(--sp-border));
    --sp-card-border: color-mix(in srgb, var(--sp-text-muted) 22%, var(--sp-border));
    --sp-table-head-text: color-mix(in srgb, var(--sp-text) 45%, var(--sp-text-muted));
    --sp-danger-text: color-mix(in srgb, var(--sp-danger) 80%, var(--sp-text));
    --sp-latest-bg: color-mix(in srgb, var(--sp-success) 12%, var(--sp-surface));
    /* Stage 20.1 POS tokens (derived, so every preset follows): raised cards, latest-scan green, restored-hold stock errors,
       and SOLID action tones darkened towards black so white text keeps WCAG AA on them in every theme (see Stage20Test) */
    --sp-surface-raised: var(--sp-pos-tile-bg);
    --sp-latest-border: var(--sp-success);
    --sp-stock-error-bg: color-mix(in srgb, var(--sp-danger) 11%, var(--sp-surface));
    --sp-stock-error-border: var(--sp-danger);
    --sp-stock-error-text: var(--sp-danger-text);
    --sp-on-solid: #fff;
    --sp-tone-primary: color-mix(in srgb, var(--sp-primary) 78%, #000);
    --sp-tone-success: color-mix(in srgb, var(--sp-success) 62%, #000);
    --sp-tone-info: color-mix(in srgb, var(--sp-info) 66%, #000);
    --sp-tone-danger: color-mix(in srgb, var(--sp-danger) 72%, #000);
    --sp-tone-slate: color-mix(in srgb, var(--sp-secondary) 62%, #000);
    --sp-tone-teal: color-mix(in srgb, var(--sp-accent) 55%, #000);
    --sp-tone-violet: #6d28d9;
    --sp-tone-warning: var(--sp-warning);
    --sp-on-warning: color-mix(in srgb, var(--sp-warning) 18%, #000);

    /* Stage 20.2 checkout-tray accents (fixed hue pulled towards the theme text: darker on light presets, lighter on dark ones) */
    --sp-acc-hold:     color-mix(in srgb, #d97706 78%, var(--sp-text));
    --sp-acc-recent:   color-mix(in srgb, #1d4ed8 78%, var(--sp-text));
    --sp-acc-discount: color-mix(in srgb, #475569 80%, var(--sp-text));
    --sp-acc-customer: color-mix(in srgb, #059669 78%, var(--sp-text));
    --sp-acc-voucher:  color-mix(in srgb, #6d28d9 82%, var(--sp-text));
    --sp-acc-review:   color-mix(in srgb, #1d4ed8 78%, var(--sp-text));
    --sp-acc-slip:     color-mix(in srgb, #1d4ed8 78%, var(--sp-text));
    --sp-acc-print:    color-mix(in srgb, #1d4ed8 78%, var(--sp-text));
    --sp-acc-clear:    color-mix(in srgb, #dc2626 80%, var(--sp-text));
    --sp-acc-help:     color-mix(in srgb, #475569 75%, var(--sp-text));
    --sp-acc-return:   color-mix(in srgb, #475569 80%, var(--sp-text));
    /* Stage 20.3 data tables: derived from each theme's own tokens, so every preset (incl. Midnight) keeps its contrast */
    --sp-table-row-border: color-mix(in srgb, var(--sp-text) 13%, var(--sp-surface));
    --sp-table-col-border: color-mix(in srgb, var(--sp-text) 7%, var(--sp-surface));
    --sp-table-selected:   color-mix(in srgb, var(--sp-primary) 13%, var(--sp-surface));
    --sp-table-selected-edge: var(--sp-primary);
    --sp-acc-temp:     color-mix(in srgb, #475569 80%, var(--sp-text));
    --sp-pay-bg: var(--sp-tone-success);
    --sp-pay-text: var(--sp-on-solid);
    --sp-tray-bg: var(--sp-surface);
    --sp-tray-border: var(--sp-card-border);
    /* Stage 20.4 premium POS zones — semantic tokens, all derived from the preset so Ocean, Midnight and every other theme follow.
       Section headers (owner, 17 Nov): ONE solid Facebook-logo blue on every preset, white text 4.8:1 (tested) */
    --pos-section-header:   #0866ff;
    --pos-section-header-2: var(--pos-section-header);
    --pos-section-header-text: #ffffff;
    /* checkout block (owner-approved): one rich colour per action, text colour chosen for ≥ 4.5:1 (tested for every theme map) */
    --pos-act-hold-bg: #f59e0b;     --pos-act-hold-fg: #111827;
    --pos-act-recent-bg: #0866ff;   --pos-act-recent-fg: #ffffff;
    --pos-act-return-bg: #0f766e;   --pos-act-return-fg: #ffffff;
    --pos-act-discount-bg: #f97316; --pos-act-discount-fg: #111827;
    --pos-act-customer-bg: #0b7a43; --pos-act-customer-fg: #ffffff;
    --pos-act-voucher-bg: #7c3aed;  --pos-act-voucher-fg: #ffffff;
    --pos-act-temp-bg: #be185d;     --pos-act-temp-fg: #ffffff;
    --pos-act-review-bg: #4f46e5;   --pos-act-review-fg: #ffffff;
    --pos-act-slip-bg: #06b6d4;     --pos-act-slip-fg: #062a33;
    --pos-act-print-bg: #1d4ed8;    --pos-act-print-fg: #ffffff;
    --pos-act-clear-bg: #dc2626;    --pos-act-clear-fg: #ffffff;
    --pos-act-help-bg: #475569;     --pos-act-help-fg: #ffffff;
    --pos-act-edge: color-mix(in srgb, #000000 16%, transparent);
    --pos-act-highlight: color-mix(in srgb, #ffffff 30%, transparent);
    --pos-act-press: color-mix(in srgb, #000000 28%, transparent);
    --pos-act-count-bg: #ffffff;    --pos-act-count-fg: #111827;
    --pos-grand-solid: #15803d;     --pos-grand-solid-text: #ffffff; --pos-grand-solid-edge: #0f6a31;
    --pos-pay-bg: #047857;          --pos-pay-fg: #ffffff;         --pos-pay-edge: #035e43;
    --pos-dock-bg: color-mix(in srgb, var(--sp-primary) 5%, var(--sp-surface));
    --pos-dock-border: var(--pos-panel-border);
    --pos-focus-strong: var(--sp-text);
    /* Stage 20.5: hover / pressed = a light tint of the button's own colour with black icon, label and shortcut (contrast tested ≥ 4.5:1) */
    --pos-act-hover-fg: #000000;
    --pos-act-hover-tint: #ffffff;
    --pos-act-hover-mix: 38%;
    --pos-act-press-mix: 50%;
    /* Stage 20.5: red quantity circle on the changed cart row */
    --pos-qty-pulse-bg: #dc2626;
    --pos-qty-pulse-fg: #ffffff;
    --pos-qty-pulse-ring: #ffffff;
    /* Stage 20.5: price & stock check — pink / red band, white product card (customer-facing, same on every theme) */
    --pos-pc-band: #e11d48;
    --pos-pc-band-2: #be123c;
    --pos-pc-band-text: #ffffff;
    --pos-pc-card: #ffffff;
    --pos-pc-text: #111827;
    --pos-pc-muted: #4b5563;
    --pos-pc-media: #f3f4f6;
    --pos-pc-price: #be123c;
    --pos-pc-save-bg: #fee2e2;
    --pos-pc-save-fg: #991b1b;
    --pos-pay: #047857;
    --pos-panel-bg: var(--sp-surface);
    --pos-panel-border: color-mix(in srgb, var(--sp-text) 16%, var(--sp-surface));
    --pos-canvas: var(--sp-pos-bg);
    --pos-tab-active: var(--pos-section-header);
    --pos-tab-active-text: var(--pos-section-header-text);
    --pos-tab-inactive: var(--sp-surface);
    --pos-tab-inactive-text: var(--sp-text);
    --pos-tab-border: var(--sp-border-strong);
    --pos-cart-line-border: color-mix(in srgb, var(--sp-text) 13%, var(--sp-surface));
    --pos-cart-head-bg: color-mix(in srgb, var(--sp-primary) 6%, var(--sp-surface));
    --pos-command-bg: var(--sp-surface);
    --pos-command-text: var(--sp-text);
    --pos-command-border: color-mix(in srgb, var(--sp-text) 22%, var(--sp-surface));
    --pos-command-hover: color-mix(in srgb, var(--sp-primary) 9%, var(--sp-surface));
    --pos-command-pressed: color-mix(in srgb, var(--sp-primary) 16%, var(--sp-surface));
    --pos-on-header-soft: color-mix(in srgb, #ffffff 16%, transparent);
    --pos-on-header-line: color-mix(in srgb, #ffffff 38%, transparent);
    --pos-latest-bg: var(--sp-latest-bg);
    --pos-latest-edge: var(--sp-latest-border);
    --pos-danger-bg: var(--sp-stock-error-bg);
    --pos-danger-edge: var(--sp-stock-error-border);
    --pos-grand-bg: color-mix(in srgb, var(--sp-success) 10%, var(--sp-surface));
    --pos-grand-text: color-mix(in srgb, var(--sp-success) 70%, var(--sp-text));
    --pos-focus-ring: 0 0 0 3px color-mix(in srgb, var(--sp-focus) 50%, transparent);

    /* non-colour scale */
    --sp-font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --sp-radius-sm: 8px; --sp-radius: 12px; --sp-radius-lg: 16px; --sp-ctl-h: 38px;
    --sp-shadow-sm: 0 1px 2px var(--sp-shade);
    --sp-shadow: 0 1px 2px var(--sp-shade), 0 6px 18px -10px color-mix(in srgb, var(--sp-text) 35%, transparent);
    --sp-shadow-lg: 0 18px 40px -16px color-mix(in srgb, var(--sp-text) 45%, transparent);
    --sp-ring: 0 0 0 3px color-mix(in srgb, var(--sp-focus) 28%, transparent);
    --sp-ease: cubic-bezier(.2, .7, .2, 1);
    --lte-sidebar-width: 264px;
}

/* Stage 20.4 checkout map for Midnight (same hierarchy on dark surfaces; contrast tested) */
html[data-theme="midnight"] {
    --pos-act-hold-bg: #fbbf24;     --pos-act-discount-bg: #fb923c; --pos-act-slip-bg: #22d3ee;
    --pos-act-recent-bg: #0866ff;   --pos-act-print-bg: #2563eb;    --pos-act-help-bg: #52627a;
    --pos-act-edge: color-mix(in srgb, #ffffff 14%, transparent);
    --pos-act-highlight: color-mix(in srgb, #ffffff 16%, transparent);
    --pos-act-press: color-mix(in srgb, #000000 45%, transparent);
    --pos-act-count-bg: #ffffff;    --pos-act-count-fg: #0b1220;
    --pos-grand-solid: #15803d;     --pos-grand-solid-edge: #22a35a;
    --pos-pay-bg: #047857;          --pos-pay-edge: #10a36f;
    --pos-dock-bg: var(--sp-surface-2);
}

/* ===================================================================== 2. bootstrap / AdminLTE variables */
:root, [data-bs-theme]:not(.app-sidebar) {
    --bs-primary: var(--sp-primary); --bs-primary-rgb: var(--sp-primary-rgb);
    --bs-success: var(--sp-success); --bs-warning: var(--sp-warning); --bs-danger: var(--sp-danger); --bs-info: var(--sp-info);
    --bs-secondary: var(--sp-secondary);
    --bs-body-bg: var(--sp-surface); --bs-body-color: var(--sp-text); --bs-secondary-color: var(--sp-text-muted);
    --bs-tertiary-bg: var(--sp-body-bg); --bs-secondary-bg: var(--sp-surface-2); --bs-border-color: var(--sp-border); --bs-emphasis-color: var(--sp-text);
    --bs-link-color: var(--sp-primary); --bs-link-hover-color: var(--sp-primary); --bs-link-color-rgb: var(--sp-primary-rgb); --bs-link-hover-color-rgb: var(--sp-primary-rgb);
    --bs-primary-bg-subtle: var(--sp-primary-soft); --bs-primary-text-emphasis: var(--sp-primary); --bs-primary-border-subtle: var(--sp-primary);
    --bs-focus-ring-color: color-mix(in srgb, var(--sp-focus) 25%, transparent);
    --bs-border-radius: var(--sp-radius-sm); --bs-border-radius-lg: var(--sp-radius); --bs-body-font-family: var(--sp-font);
}
.bg-body-tertiary { background-color: var(--sp-body-bg) !important; }
.text-muted, .text-secondary { color: var(--sp-text-muted) !important; }
.text-primary { color: var(--sp-primary) !important; }
.text-success { color: var(--sp-success) !important; } .text-danger { color: var(--sp-danger-text) !important; }
.text-warning { color: var(--sp-warning) !important; } .text-info { color: var(--sp-info) !important; }
.bg-primary, .text-bg-primary { background-color: var(--sp-primary) !important; color: var(--sp-primary-contrast) !important; }
.text-bg-success, .bg-success { background-color: var(--sp-success) !important; color: #fff !important; }
.text-bg-warning, .bg-warning { background-color: var(--sp-warning) !important; color: #fff !important; }
.text-bg-danger, .bg-danger { background-color: var(--sp-danger) !important; color: #fff !important; }
.text-bg-info, .bg-info { background-color: var(--sp-info) !important; color: #fff !important; }
.text-bg-secondary, .bg-secondary { background-color: var(--sp-secondary) !important; color: var(--sp-secondary-contrast) !important; }
.bg-success-subtle { background-color: var(--sp-success-soft) !important; }
.bg-danger-subtle { background-color: var(--sp-danger-soft) !important; }
.bg-warning-subtle { background-color: var(--sp-warning-soft) !important; }
.bg-primary-subtle, .bg-info-subtle { background-color: var(--sp-primary-soft) !important; }
.border-primary { border-color: var(--sp-primary) !important; }
.link-reset { color: inherit; text-decoration: none; }

/* ===================================================================== 3. base */
body { font-family: var(--sp-font); color: var(--sp-text); -webkit-font-smoothing: antialiased; }
.app-main { background-color: var(--sp-body-bg); color: var(--sp-text); }
.app-content > .container-fluid { padding-left: 1.25rem; padding-right: 1.25rem; padding-bottom: 1.5rem; }
.sp-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.sp-hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--sp-focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--sp-primary) 22%, transparent); }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--sp-text-muted) 45%, transparent) transparent; }

/* ===================================================================== 4. header */
.app-header { background-color: var(--sp-header-bg) !important; color: var(--sp-header-text); border-bottom: 1px solid var(--sp-header-border);
    min-height: 56px; box-shadow: var(--sp-shadow-sm); }
.app-header .nav-link { color: var(--sp-header-text); border-radius: var(--sp-radius-sm); }
.app-header .nav-link:hover { background: var(--sp-hover); }
.sp-header-title { display: flex; flex-direction: column; line-height: 1.15; padding: 0 .5rem; }
.sp-header-title strong { font-size: .98rem; font-weight: 700; }
.sp-header-title small { font-size: .72rem; color: var(--sp-text-muted); }
.sp-header-btn { display: inline-flex; align-items: center; gap: .4rem; height: 36px; padding: 0 .8rem; border-radius: 999px; font-weight: 600; font-size: .85rem;
    border: 1px solid var(--sp-border); background: var(--sp-surface); color: var(--sp-header-text); text-decoration: none; transition: background .15s, transform .15s; }
.sp-header-btn:hover { background: var(--sp-hover); color: var(--sp-header-text); transform: translateY(-1px); }
.sp-header-btn.is-primary { background: var(--sp-primary); border-color: var(--sp-primary); color: var(--sp-primary-contrast); }
.sp-header-btn.is-primary:hover { filter: brightness(1.06); }
.sp-branch-pill { display: inline-flex; align-items: center; gap: .35rem; background: var(--sp-primary-soft); color: var(--sp-primary); font-weight: 600; font-size: .78rem; padding: .3rem .7rem; border-radius: 999px; }
.sp-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sp-primary); color: var(--sp-primary-contrast); display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; vertical-align: middle; }
.sp-avatar-lg { width: 72px; height: 72px; font-size: 1.8rem; display: grid; border: 3px solid color-mix(in srgb, var(--sp-primary-contrast) 40%, transparent); }
.navbar-badge { font-size: .62rem; }

/* ===================================================================== 5. sidebar (AutoKhata-style layout, rebuilt on tokens) */
.app-sidebar {
    background-color: var(--sp-sidebar-bg) !important; border-right: 1px solid color-mix(in srgb, var(--sp-sidebar-text) 10%, transparent);
    --lte-sidebar-color: var(--sp-sidebar-text); --lte-sidebar-hover-color: var(--sp-sidebar-text); --lte-sidebar-hover-bg: var(--sp-sidebar-hover);
    --lte-sidebar-active-color: var(--sp-sidebar-text); --lte-sidebar-menu-active-bg: var(--sp-sidebar-active-bg); --lte-sidebar-menu-active-color: var(--sp-sidebar-active-text);
    --lte-sidebar-submenu-bg: transparent; --lte-sidebar-submenu-color: var(--sp-sidebar-text);
    --lte-sidebar-submenu-hover-bg: var(--sp-sidebar-hover); --lte-sidebar-submenu-hover-color: var(--sp-sidebar-text);
    --lte-sidebar-submenu-active-bg: var(--sp-sidebar-active-bg); --lte-sidebar-submenu-active-color: var(--sp-sidebar-active-text);
    --lte-sidebar-header-color: var(--sp-sidebar-muted);
    --sp-sb-item-bg: color-mix(in srgb, var(--sp-sidebar-text) 5%, transparent);
    --sp-sb-item-border: color-mix(in srgb, var(--sp-sidebar-text) 8%, transparent);
}
/* the sidebar is exactly the visible viewport and scrolls on its own, so its last items (My Account / sign out) are always reachable */
@media (min-width: 992px) { .app-sidebar { max-height: 100vh; max-height: 100dvh; } }
.app-sidebar .sidebar-wrapper { overscroll-behavior: contain; scroll-padding-bottom: 1rem; }
.app-sidebar .sidebar-wrapper { padding-bottom: 1rem; scrollbar-color: color-mix(in srgb, var(--sp-sidebar-text) 25%, transparent) transparent; }
/* brand card */
.sp-brand { margin: 12px 10px 10px; padding: 12px 10px; border-radius: 14px; background: var(--sp-surface); color: var(--sp-text);
    display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.18);
    transition: box-shadow .18s, transform .18s; }
.sp-brand:hover { transform: translateY(-1px); color: var(--sp-text); }
.app-sidebar .sp-brand, .app-sidebar .sp-brand:hover, .app-sidebar .sp-brand-name { color: var(--sp-text) !important; }
.sp-brand-logo { max-width: 100%; max-height: 52px; object-fit: contain; }
.sp-brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: var(--sp-primary); color: var(--sp-primary-contrast); }
.sp-brand-name { font-weight: 800; font-size: .95rem; line-height: 1.2; text-align: center; letter-spacing: -.01em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-brand-sub { font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--sp-primary); text-align: center; }
/* profile box */
.sp-profile { margin: 4px 10px 8px; padding: 9px 12px; border-radius: 14px; display: flex; align-items: center; gap: 10px;
    background: color-mix(in srgb, #000 16%, transparent); border: 1px solid var(--sp-sb-item-border); }
.sp-profile-avatar { width: 38px; height: 38px; min-width: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .82rem;
    background: var(--sp-sidebar-active-bg); color: var(--sp-sidebar-active-text); border: 1.5px solid color-mix(in srgb, var(--sp-sidebar-text) 35%, transparent); }
.sp-profile-name { color: var(--sp-sidebar-text); font-weight: 700; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-profile-role { display: inline-block; margin-top: 2px; font-size: .6rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px;
    background: color-mix(in srgb, #000 28%, transparent); color: var(--sp-sidebar-indicator); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-profile-meta { min-width: 0; flex: 1; }
/* menu */
.app-sidebar .sidebar-menu { padding: 0 6px; }
.app-sidebar .sidebar-menu .nav-header { color: var(--sp-sidebar-muted); font-size: .64rem; font-weight: 800; letter-spacing: .1em; padding: 14px 8px 5px; display: flex; align-items: center; gap: 8px; }
.app-sidebar .sidebar-menu .nav-header::after { content: ''; flex: 1; height: 1px; background: color-mix(in srgb, var(--sp-sidebar-text) 12%, transparent); }
.app-sidebar .sidebar-menu .nav-link { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 10px; margin: 2px 0; border-radius: 10px;
    color: var(--sp-sidebar-text); background: var(--sp-sb-item-bg); border: 1px solid var(--sp-sb-item-border); transition: background .15s, transform .15s, box-shadow .15s; }
.app-sidebar .sidebar-menu .nav-link:hover { background: var(--sp-sidebar-hover); color: var(--sp-sidebar-text); }
.app-sidebar .sidebar-menu .nav-link .nav-icon { width: 20px; min-width: 20px; text-align: center; font-size: 1rem; margin: 0; }
.app-sidebar .sidebar-menu .nav-link p { margin: 0; flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-sidebar .sidebar-menu .nav-link p > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.app-sidebar .sidebar-menu .nav-link.active { background: var(--sp-sidebar-active-bg); color: var(--sp-sidebar-active-text); border-color: transparent;
    box-shadow: inset 4px 0 0 var(--sp-sidebar-indicator), 0 4px 12px rgba(0,0,0,.18); }
.app-sidebar .sidebar-menu > .nav-item.menu-open > .nav-link:not(.active),
.app-sidebar .sidebar-menu > .nav-item > .nav-link.is-group-active { background: color-mix(in srgb, var(--sp-sidebar-text) 10%, transparent);
    border-color: color-mix(in srgb, var(--sp-sidebar-text) 22%, transparent); color: var(--sp-sidebar-text); box-shadow: none; }
.app-sidebar .sp-nav-arrow { margin-left: auto; width: 20px; height: 20px; flex: 0 0 20px; border-radius: 6px; display: inline-grid; place-items: center;
    background: color-mix(in srgb, var(--sp-sidebar-text) 8%, transparent); border: 1px solid color-mix(in srgb, var(--sp-sidebar-text) 12%, transparent);
    font-size: .55rem; transition: transform .18s var(--sp-ease); }
.app-sidebar .nav-item.menu-open > .nav-link .sp-nav-arrow { transform: rotate(90deg); }
.app-sidebar .nav-treeview { margin: 2px 0 6px 10px; padding-left: 8px; border-left: 1px dashed color-mix(in srgb, var(--sp-sidebar-text) 18%, transparent); }
.app-sidebar .nav-treeview .nav-link { min-height: 34px; padding: 6px 9px; background: transparent; border-color: transparent; }
.app-sidebar .nav-treeview .nav-link .nav-icon { font-size: .82rem; }
.sp-nav-count { flex: 0 0 auto; min-width: 22px; padding: 1px 6px; border-radius: 999px; font-size: .66rem; font-weight: 700; text-align: center;
    background: color-mix(in srgb, var(--sp-sidebar-text) 20%, transparent); color: var(--sp-sidebar-text); font-variant-numeric: tabular-nums; }
.sp-logout { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; margin: 14px 0 6px; border: 0; border-radius: 10px;
    background: var(--sp-danger); color: #fff; font-weight: 700; font-size: .84rem; box-shadow: 0 4px 12px color-mix(in srgb, var(--sp-danger) 35%, transparent); }
.sp-logout:hover { filter: brightness(1.07); }
.sp-logout .bi { width: 20px; text-align: center; }
/* compact (icon-only) rail: no hover expansion; labels appear in a flyout (sp-core.js) */
.sidebar-mini.sidebar-collapse .app-sidebar .sp-brand { margin: 10px 6px; padding: 6px; border-radius: 10px; }
.sidebar-mini.sidebar-collapse .app-sidebar .sp-brand-logo { max-height: 30px; }
.sidebar-mini.sidebar-collapse .app-sidebar .sp-brand-mark { width: 34px; height: 34px; font-size: 1rem; border-radius: 9px; }
.sidebar-mini.sidebar-collapse .app-sidebar .sp-brand-name, .sidebar-mini.sidebar-collapse .app-sidebar .sp-brand-sub,
.sidebar-mini.sidebar-collapse .app-sidebar .sp-profile-meta, .sidebar-mini.sidebar-collapse .app-sidebar .nav-treeview,
.sidebar-mini.sidebar-collapse .app-sidebar .sp-nav-arrow, .sidebar-mini.sidebar-collapse .app-sidebar .sp-nav-count,
.sidebar-mini.sidebar-collapse .app-sidebar .sp-logout span { display: none !important; }
.sidebar-mini.sidebar-collapse .app-sidebar .sp-profile { margin: 4px 6px 8px; padding: 6px; justify-content: center; background: transparent; border-color: transparent; }
.sidebar-mini.sidebar-collapse .app-sidebar .sidebar-menu .nav-header { padding: 8px 0 4px; font-size: 0; }
.sidebar-mini.sidebar-collapse .app-sidebar .sidebar-menu .nav-link { justify-content: center; padding: 8px 0; }
.sidebar-mini.sidebar-collapse .app-sidebar .sidebar-menu .nav-link .nav-icon { font-size: 1.1rem; }
.sidebar-mini.sidebar-collapse .app-sidebar .sp-logout { justify-content: center; padding: 8px 0; }
.sp-flyout { position: fixed; z-index: 1085; min-width: 190px; max-width: 280px; padding: 6px; border-radius: 12px; background: var(--sp-sidebar-bg); color: var(--sp-sidebar-text);
    border: 1px solid color-mix(in srgb, var(--sp-sidebar-text) 16%, transparent); box-shadow: var(--sp-shadow-lg); animation: sp-in .14s var(--sp-ease); }
.sp-flyout-title { font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--sp-sidebar-muted); padding: 4px 8px 6px; }
.sp-flyout a { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; color: var(--sp-sidebar-text); text-decoration: none; font-size: .84rem; font-weight: 600; }
.sp-flyout a:hover { background: var(--sp-sidebar-hover); }
.sp-flyout a.active { background: var(--sp-sidebar-active-bg); color: var(--sp-sidebar-active-text); }
.sp-flyout.is-label { min-width: 0; padding: 7px 11px; font-size: .8rem; font-weight: 700; }
.app-sidebar, .app-main, .app-header, .app-footer { transition: width .22s var(--sp-ease), min-width .22s var(--sp-ease), margin .22s var(--sp-ease); }
/* focus mode (POS): sidebar and footer hidden; only the compact header remains */
body.sp-focus .app-sidebar, body.sp-focus .app-footer { display: none !important; }
body.sp-focus .app-wrapper { grid-template-columns: 0 1fr !important; }
body.sp-focus .app-main, body.sp-focus .app-header { margin-left: 0 !important; }

/* ===================================================================== 6. page header */
.sp-page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sp-page-title { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.sp-page-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem;
    background: var(--sp-primary); color: var(--sp-primary-contrast); box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--sp-primary) 70%, transparent); }
.sp-page-header h1 { font-size: 1.35rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.sp-page-header p { margin: .1rem 0 0; color: var(--sp-text-muted); font-size: .86rem; }
.sp-crumbs { font-size: .72rem; color: var(--sp-text-muted); display: flex; gap: .35rem; align-items: center; margin-bottom: .1rem; }
.sp-crumbs a { color: inherit; text-decoration: none; } .sp-crumbs a:hover { color: var(--sp-primary); }
.sp-toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ===================================================================== 7. cards, widgets, KPIs */
.card { --bs-card-bg: var(--sp-surface); --bs-card-border-color: var(--sp-border); --bs-card-cap-bg: var(--sp-surface); --bs-card-border-radius: var(--sp-radius);
    --bs-card-inner-border-radius: calc(var(--sp-radius) - 1px); color: var(--sp-text); box-shadow: var(--sp-shadow); border: 1px solid var(--sp-card-border); }
.card-header { padding: .8rem 1rem; } .card-title { font-weight: 700; font-size: .98rem; }
.card-primary.card-outline, .card-success.card-outline, .card-danger.card-outline, .card-warning.card-outline { border-top: 3px solid var(--sp-primary); }
.card-success.card-outline { border-top-color: var(--sp-success); } .card-danger.card-outline { border-top-color: var(--sp-danger); } .card-warning.card-outline { border-top-color: var(--sp-warning); }
.card-primary:not(.card-outline) > .card-header { background: var(--sp-primary); color: var(--sp-primary-contrast); }
.card-header.d-flex::after { display: none; }
.card-header.d-flex .card-title { float: none; margin: 0; }
.sp-card { background: var(--sp-surface); border: 1px solid var(--sp-card-border); border-radius: var(--sp-radius); box-shadow: var(--sp-shadow); color: var(--sp-text); }
.sp-card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .8rem 1rem; border-bottom: 1px solid var(--sp-border); }
.sp-card-head h2, .sp-card-head h3 { font-size: .98rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .5rem; }
.sp-card-body { padding: 1rem; }
.sp-card-foot { padding: .65rem 1rem; border-top: 1px solid var(--sp-border); }
.small-box { border-radius: var(--sp-radius); box-shadow: var(--sp-shadow); }
.small-box .small-box-icon { opacity: .22; } .small-box .small-box-footer { color: inherit !important; }
.info-box { border-radius: var(--sp-radius); box-shadow: var(--sp-shadow); background: var(--sp-surface); color: var(--sp-text); }
.info-box .info-box-icon { border-radius: 10px; }
/* KPI cards */
.sp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.sp-kpi { --tone: var(--sp-primary); position: relative; overflow: hidden; display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border-radius: var(--sp-radius);
    background: var(--sp-surface); border: 1px solid var(--sp-border); box-shadow: var(--sp-shadow); }
.sp-kpi::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--tone); }
.sp-kpi-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 11px; display: grid; place-items: center; font-size: 1.15rem;
    background: color-mix(in srgb, var(--tone) 14%, var(--sp-surface)); color: var(--tone); }
.sp-kpi-label { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sp-text-muted); }
.sp-kpi-value { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.sp-kpi-note { font-size: .74rem; color: var(--sp-text-muted); }
.sp-tone-primary { --tone: var(--sp-primary); } .sp-tone-success { --tone: var(--sp-success); } .sp-tone-warning { --tone: var(--sp-warning); }
.sp-tone-danger { --tone: var(--sp-danger); } .sp-tone-info { --tone: var(--sp-info); } .sp-tone-accent { --tone: var(--sp-accent); } .sp-tone-secondary { --tone: var(--sp-secondary); }
/* hero (report banner) */
.sp-hero { border-radius: var(--sp-radius-lg); padding: 1.1rem 1.25rem; margin-bottom: 1rem; color: var(--sp-primary-contrast);
    background: linear-gradient(120deg, var(--sp-sidebar-bg), color-mix(in srgb, var(--sp-primary) 85%, var(--sp-sidebar-bg))); box-shadow: var(--sp-shadow);
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.sp-hero h1 { font-size: 1.3rem; font-weight: 800; margin: 0; display: flex; align-items: center; gap: .6rem; color: #fff; }
.sp-hero p { margin: .15rem 0 0; color: color-mix(in srgb, #fff 78%, transparent); font-size: .86rem; }
.sp-hero .btn { --bs-btn-color: #fff; --bs-btn-border-color: color-mix(in srgb, #fff 45%, transparent); --bs-btn-hover-bg: color-mix(in srgb, #fff 16%, transparent);
    --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #fff; --bs-btn-bg: color-mix(in srgb, #fff 8%, transparent); }

/* ===================================================================== 8. buttons */
.btn { --bs-btn-border-radius: 10px; --bs-btn-font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { --bs-btn-border-radius: 8px; } .btn-lg { --bs-btn-border-radius: 12px; }
.btn-group > .btn { display: inline-flex; }
.btn-primary { --bs-btn-bg: var(--sp-primary); --bs-btn-border-color: var(--sp-primary); --bs-btn-color: var(--sp-primary-contrast);
    --bs-btn-hover-bg: var(--sp-primary); --bs-btn-hover-border-color: var(--sp-primary); --bs-btn-hover-color: var(--sp-primary-contrast);
    --bs-btn-active-bg: var(--sp-primary); --bs-btn-active-border-color: var(--sp-primary); --bs-btn-active-color: var(--sp-primary-contrast);
    --bs-btn-disabled-bg: var(--sp-primary); --bs-btn-disabled-border-color: var(--sp-primary); --bs-btn-disabled-color: var(--sp-primary-contrast);
    box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--sp-primary) 80%, transparent); }
.btn-primary:hover, .btn-success:hover, .btn-danger:hover, .btn-warning:hover, .btn-info:hover { filter: brightness(1.07); }
.btn-outline-primary { --bs-btn-color: var(--sp-primary); --bs-btn-border-color: var(--sp-primary); --bs-btn-hover-bg: var(--sp-primary);
    --bs-btn-hover-border-color: var(--sp-primary); --bs-btn-hover-color: var(--sp-primary-contrast); --bs-btn-active-bg: var(--sp-primary); --bs-btn-active-color: var(--sp-primary-contrast); }
.btn-success { --bs-btn-bg: var(--sp-success); --bs-btn-border-color: var(--sp-success); --bs-btn-hover-bg: var(--sp-success); --bs-btn-hover-border-color: var(--sp-success); --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--sp-success); --bs-btn-disabled-bg: var(--sp-success); --bs-btn-disabled-border-color: var(--sp-success); }
.btn-danger { --bs-btn-bg: var(--sp-danger); --bs-btn-border-color: var(--sp-danger); --bs-btn-hover-bg: var(--sp-danger); --bs-btn-hover-border-color: var(--sp-danger); --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--sp-danger); }
.btn-warning { --bs-btn-bg: var(--sp-warning); --bs-btn-border-color: var(--sp-warning); --bs-btn-color: #fff; --bs-btn-hover-bg: var(--sp-warning); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: var(--sp-warning); --bs-btn-active-bg: var(--sp-warning); --bs-btn-active-color: #fff; }
.btn-info { --bs-btn-bg: var(--sp-info); --bs-btn-border-color: var(--sp-info); --bs-btn-color: #fff; --bs-btn-hover-bg: var(--sp-info); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: var(--sp-info); }
.btn-outline-danger { --bs-btn-color: var(--sp-danger-text); --bs-btn-border-color: var(--sp-danger); --bs-btn-hover-bg: var(--sp-danger); --bs-btn-hover-border-color: var(--sp-danger); --bs-btn-hover-color: #fff; }
.btn-outline-success { --bs-btn-color: var(--sp-success); --bs-btn-border-color: var(--sp-success); --bs-btn-hover-bg: var(--sp-success); --bs-btn-hover-border-color: var(--sp-success); --bs-btn-hover-color: #fff; }
.btn-outline-warning { --bs-btn-color: var(--sp-warning); --bs-btn-border-color: var(--sp-warning); --bs-btn-hover-bg: var(--sp-warning); --bs-btn-hover-border-color: var(--sp-warning); --bs-btn-hover-color: #fff; }
.btn-outline-info { --bs-btn-color: var(--sp-info); --bs-btn-border-color: var(--sp-info); --bs-btn-hover-bg: var(--sp-info); --bs-btn-hover-border-color: var(--sp-info); --bs-btn-hover-color: #fff; }
.btn-outline-secondary, .btn-default { --bs-btn-color: var(--sp-text); --bs-btn-border-color: var(--sp-border); --bs-btn-bg: var(--sp-surface); --bs-btn-hover-bg: var(--sp-hover);
    --bs-btn-hover-color: var(--sp-text); --bs-btn-hover-border-color: color-mix(in srgb, var(--sp-text-muted) 40%, var(--sp-border)); --bs-btn-active-bg: var(--sp-hover); --bs-btn-active-color: var(--sp-text); box-shadow: var(--sp-shadow-sm); }
.btn-light { --bs-btn-bg: var(--sp-surface-2); --bs-btn-border-color: var(--sp-border); --bs-btn-color: var(--sp-text); --bs-btn-hover-bg: var(--sp-hover); --bs-btn-hover-color: var(--sp-text); --bs-btn-hover-border-color: var(--sp-border); }
.btn-secondary { --bs-btn-bg: var(--sp-secondary); --bs-btn-border-color: var(--sp-secondary); --bs-btn-color: var(--sp-secondary-contrast); --bs-btn-hover-bg: var(--sp-secondary); --bs-btn-hover-color: var(--sp-secondary-contrast); }
.btn-link { --bs-btn-color: var(--sp-primary); --bs-btn-hover-color: var(--sp-primary); }
.btn-icon { width: var(--sp-ctl-h); height: var(--sp-ctl-h); padding: 0; }
.btn-sm.btn-icon { width: 30px; height: 30px; }
.sp-kbd, kbd { display: inline-block; padding: 1px 5px; border-radius: 5px; font-size: .66rem; font-weight: 700; font-family: var(--sp-font); line-height: 1.35;
    background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); box-shadow: none; }

/* ===================================================================== 9. forms and the filter bar */
.form-control, .form-select { background-color: var(--sp-input-bg); border-color: var(--sp-border-strong); color: var(--sp-text); border-radius: 10px; }
.form-control::placeholder { color: color-mix(in srgb, var(--sp-text-muted) 80%, transparent); }
.form-control:focus, .form-select:focus { border-color: var(--sp-focus); box-shadow: var(--sp-ring); background-color: var(--sp-input-bg); color: var(--sp-text); }
.form-control:disabled, .form-select:disabled { background-color: var(--sp-surface-2); }
.form-check-input { border-color: color-mix(in srgb, var(--sp-text-muted) 55%, transparent); background-color: var(--sp-input-bg); }
.form-check-input:checked { background-color: var(--sp-primary); border-color: var(--sp-primary); }
.form-check-input:focus { box-shadow: var(--sp-ring); border-color: var(--sp-focus); }
.input-group-text { background: var(--sp-surface-2); border-color: var(--sp-border-strong); color: var(--sp-text-muted); border-radius: 10px; }
.form-label { font-weight: 600; font-size: .82rem; color: var(--sp-text); }
.form-text { color: var(--sp-text-muted); }
.invalid-feedback { color: var(--sp-danger-text); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--sp-danger); }
/* filter bar: equal-height controls, Apply / Reset, active chips */
.sp-filterbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; }
.sp-filterbar .sp-field { display: flex; flex-direction: column; gap: 3px; flex: 0 1 180px; min-width: 140px; }
.sp-filterbar .sp-field.is-grow { flex: 1 1 240px; }
.sp-filterbar .sp-field > label { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--sp-text-muted); margin: 0; }
.sp-filterbar .form-control, .sp-filterbar .form-select, .sp-filterbar .btn, .sp-filterbar .input-group-text { height: var(--sp-ctl-h); font-size: .86rem; }
.sp-filterbar .sp-actions { display: flex; gap: .4rem; margin-left: auto; }
.sp-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; align-items: end; }
.sp-filters .form-label { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--sp-text-muted); }
.sp-filters .form-control, .sp-filters .form-select, .sp-filters .btn { height: var(--sp-ctl-h); }
.sp-quick-ranges { display: flex; gap: .35rem; flex-wrap: wrap; }
.sp-quick-ranges .btn { --bs-btn-padding-y: .2rem; --bs-btn-padding-x: .65rem; --bs-btn-font-size: .76rem; border-radius: 999px; }
.sp-quick-ranges .btn.active { background: var(--sp-primary); color: var(--sp-primary-contrast); border-color: var(--sp-primary); }
.sp-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; min-height: 0; }
.sp-chips:empty { display: none; }
.sp-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .3rem .22rem .65rem; border-radius: 999px; font-size: .76rem; font-weight: 600;
    background: var(--sp-primary-soft); color: var(--sp-primary); border: 1px solid color-mix(in srgb, var(--sp-primary) 30%, transparent); }
.sp-chip b { font-weight: 800; }
.sp-chip button { width: 20px; height: 20px; border: 0; border-radius: 50%; display: inline-grid; place-items: center; background: color-mix(in srgb, var(--sp-primary) 16%, transparent); color: inherit; font-size: .8rem; line-height: 1; padding: 0; }
.sp-chip button:hover { background: var(--sp-primary); color: var(--sp-primary-contrast); }
.sp-search { position: relative; }
.sp-search > .bi { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--sp-text-muted); pointer-events: none; }
.sp-search > .form-control { padding-left: 2.2rem; }
/* searchable dropdown (SP.combo) */
.sp-combo { position: relative; }
.sp-combo-list { position: absolute; z-index: 1070; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto; padding: 4px; border-radius: 12px;
    background: var(--sp-surface); border: 1px solid var(--sp-border); box-shadow: var(--sp-shadow-lg); }
.sp-combo-item { display: flex; justify-content: space-between; gap: .5rem; width: 100%; padding: .45rem .6rem; border: 0; border-radius: 8px; background: transparent; color: var(--sp-text); text-align: left; font-size: .86rem; }
.sp-combo-item small { color: var(--sp-text-muted); }
.sp-combo-item:hover, .sp-combo-item.is-active { background: var(--sp-primary-soft); }

/* ===================================================================== 10. tables and pagination */
.table { --bs-table-bg: transparent; --bs-table-color: var(--sp-text); --bs-table-border-color: var(--sp-border); --bs-table-striped-bg: var(--sp-table-stripe);
    --bs-table-striped-color: var(--sp-text); --bs-table-hover-bg: var(--sp-hover); --bs-table-hover-color: var(--sp-text); margin-bottom: 0; font-size: .875rem; }
.table > thead th { background: var(--sp-table-head-bg); color: var(--sp-table-head-text); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; white-space: nowrap;
    border-bottom-width: 1px; padding-top: .6rem; padding-bottom: .6rem; }
.table td, .table th { vertical-align: middle; }
.table > tbody > tr:last-child > td { border-bottom: 0; }
/* Stage 20.3: visible row separators, light column boundaries, selected row, two densities, header that stays in view */
.table > tbody > tr > td { border-bottom: 1px solid var(--sp-table-row-border); }
.table > thead > tr > th { border-bottom: 1px solid var(--sp-table-row-border); }
.sp-table-wrap .table > :not(caption) > tr > :is(td, th) + :is(td, th) { border-left: 1px solid var(--sp-table-col-border); }
.sp-table-wrap .table > :not(caption) > tr > * { padding: .55rem .7rem; }
html[data-density="compact"] .sp-table-wrap .table > :not(caption) > tr > * { padding: .26rem .5rem; font-size: .8125rem; }
.table > tbody > tr.is-selected > * { --bs-table-bg-state: var(--sp-table-selected); background: var(--sp-table-selected); }
.table > tbody > tr.is-selected > td:first-child { box-shadow: inset 3px 0 0 var(--sp-table-selected-edge); }
.sp-density-toggle { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; }
@media (min-width: 992px) { .sp-card > .sp-table-wrap { --sp-table-max: calc(100dvh - 240px); } }
.table tfoot td, .table tfoot th { background: var(--sp-surface-2); font-weight: 800; }
.sp-table-wrap { overflow: auto; max-height: var(--sp-table-max, none); }
.sp-table-wrap > .table > thead th { position: sticky; top: 0; z-index: 2; }
.sp-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; cursor: pointer; }
.sp-sort .bi { opacity: .45; font-size: .7rem; } .sp-sort.is-active { color: var(--sp-primary); } .sp-sort.is-active .bi { opacity: 1; }
.table .sp-row-actions { white-space: nowrap; text-align: right; }
.sp-pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; }
.sp-pager-info { font-size: .8rem; color: var(--sp-text-muted); display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.sp-pager-info .form-select { width: auto; height: 30px; padding-top: 0; padding-bottom: 0; font-size: .8rem; }
.pagination { --bs-pagination-color: var(--sp-text); --bs-pagination-bg: var(--sp-surface); --bs-pagination-border-color: var(--sp-border); --bs-pagination-border-radius: 8px;
    --bs-pagination-active-bg: var(--sp-primary); --bs-pagination-active-border-color: var(--sp-primary); --bs-pagination-active-color: var(--sp-primary-contrast);
    --bs-pagination-disabled-bg: var(--sp-surface-2); --bs-pagination-disabled-color: var(--sp-text-muted); --bs-pagination-hover-bg: var(--sp-hover); --bs-pagination-hover-color: var(--sp-text);
    --bs-pagination-focus-box-shadow: var(--sp-ring); gap: 4px; }
.pagination .page-link { border-radius: 8px !important; min-width: 32px; text-align: center; font-weight: 600; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--sp-primary); --bs-nav-pills-link-active-color: var(--sp-primary-contrast); --bs-nav-pills-border-radius: 999px; }
.nav-pills .nav-link { color: var(--sp-text); font-weight: 600; font-size: .84rem; padding: .35rem .85rem; }
.nav-pills .nav-link:not(.active):hover { background: var(--sp-hover); }
.nav-tabs { --bs-nav-tabs-link-active-color: var(--sp-primary); --bs-nav-tabs-border-color: var(--sp-border); --bs-nav-tabs-link-active-border-color: var(--sp-border) var(--sp-border) var(--sp-surface); --bs-nav-tabs-link-active-bg: var(--sp-surface); }
.nav-tabs .nav-link { color: var(--sp-text-muted); font-weight: 600; }

/* ===================================================================== 11. badges and status */
.badge { font-weight: 700; letter-spacing: .02em; border-radius: 7px; padding: .32em .6em; }
.sp-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
    background: var(--sp-secondary-soft); color: var(--sp-secondary); }
.sp-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sp-badge.is-success { background: var(--sp-success-soft); color: var(--sp-success); }
.sp-badge.is-warning { background: var(--sp-warning-soft); color: var(--sp-warning); }
.sp-badge.is-danger { background: var(--sp-danger-soft); color: var(--sp-danger); }
.sp-badge.is-info { background: var(--sp-info-soft); color: var(--sp-info); }
.sp-badge.is-primary { background: var(--sp-primary-soft); color: var(--sp-primary); }
.sp-badge.is-accent { background: var(--sp-accent-soft); color: var(--sp-accent); }

/* ===================================================================== 12. empty / loading / error states */
.sp-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: 2.2rem 1rem; text-align: center; color: var(--sp-text-muted); }
.sp-state-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 1.5rem; background: var(--sp-primary-soft); color: var(--sp-primary); }
.sp-state.is-error .sp-state-icon { background: var(--sp-danger-soft); color: var(--sp-danger); }
.sp-state-title { font-weight: 700; color: var(--sp-text); }
.sp-skel { display: block; border-radius: 6px; min-height: .8rem; background: linear-gradient(90deg, var(--sp-surface-2), var(--sp-hover), var(--sp-surface-2)); background-size: 200% 100%; animation: sp-shimmer 1.2s infinite linear; }
@keyframes sp-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner-border { color: var(--sp-primary); }
.alert { border-radius: var(--sp-radius-sm); border-width: 1px; }
.alert-danger { background: var(--sp-danger-soft); color: var(--sp-danger); border-color: color-mix(in srgb, var(--sp-danger) 30%, transparent); }
.alert-warning { background: var(--sp-warning-soft); color: color-mix(in srgb, var(--sp-warning) 75%, var(--sp-text)); border-color: color-mix(in srgb, var(--sp-warning) 30%, transparent); }
.alert-success { background: var(--sp-success-soft); color: var(--sp-success); border-color: color-mix(in srgb, var(--sp-success) 30%, transparent); }
.alert-info { background: var(--sp-info-soft); color: var(--sp-info); border-color: color-mix(in srgb, var(--sp-info) 30%, transparent); }
.sp-banner { padding: .5rem 1rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; background: var(--sp-warning); color: #fff; }

/* ===================================================================== 13. modals, drawers, dropdowns, toasts */
.modal-content { background: var(--sp-surface); color: var(--sp-text); border: 1px solid var(--sp-border); border-radius: var(--sp-radius-lg); box-shadow: var(--sp-shadow-lg); }
.modal-header { border-color: var(--sp-border); padding: .9rem 1.1rem; }
.modal-header .modal-title { font-weight: 800; font-size: 1.02rem; display: flex; align-items: center; gap: .55rem; }
.modal-header .modal-title > .bi { width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--sp-primary-soft); color: var(--sp-primary); font-size: 1rem; }
.modal-footer { border-color: var(--sp-border); padding: .75rem 1.1rem; }
.modal-backdrop.show { opacity: .45; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }
.offcanvas { --bs-offcanvas-bg: var(--sp-surface); --bs-offcanvas-color: var(--sp-text); --bs-offcanvas-border-color: var(--sp-border); box-shadow: var(--sp-shadow-lg); }
.offcanvas-header { border-bottom: 1px solid var(--sp-border); padding: .85rem 1.1rem; }
.offcanvas-title { font-weight: 800; display: flex; align-items: center; gap: .55rem; font-size: 1.02rem; }
.offcanvas-title > .bi { width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--sp-primary-soft); color: var(--sp-primary); }
.sp-drawer-xl { --bs-offcanvas-width: min(960px, 96vw); }
.sp-drawer-lg { --bs-offcanvas-width: min(560px, 94vw); }
.dropdown-menu { --bs-dropdown-bg: var(--sp-surface); --bs-dropdown-color: var(--sp-text); --bs-dropdown-border-color: var(--sp-border); --bs-dropdown-border-radius: var(--sp-radius);
    --bs-dropdown-link-color: var(--sp-text); --bs-dropdown-link-hover-bg: var(--sp-hover); --bs-dropdown-link-hover-color: var(--sp-text); --bs-dropdown-link-active-bg: var(--sp-primary);
    --bs-dropdown-link-active-color: var(--sp-primary-contrast); box-shadow: var(--sp-shadow-lg); padding: .35rem; }
.dropdown-item { border-radius: 8px; display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.user-menu .user-header { background: var(--sp-primary) !important; color: var(--sp-primary-contrast) !important; border-radius: calc(var(--sp-radius) - 4px) calc(var(--sp-radius) - 4px) 0 0; }
.list-group { --bs-list-group-bg: var(--sp-surface); --bs-list-group-color: var(--sp-text); --bs-list-group-border-color: var(--sp-border); --bs-list-group-action-hover-bg: var(--sp-hover); --bs-list-group-action-hover-color: var(--sp-text); }
.tooltip { --bs-tooltip-bg: var(--sp-text); --bs-tooltip-color: var(--sp-surface); --bs-tooltip-font-size: .76rem; }
.sp-toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.sp-toast { display: flex; gap: .65rem; align-items: flex-start; padding: .75rem .9rem; border-radius: 12px; color: #fff; box-shadow: var(--sp-shadow-lg); animation: sp-in .18s var(--sp-ease); font-size: .88rem; }
.sp-toast button { border: 0; background: transparent; color: inherit; font-size: 1.1rem; line-height: 1; margin-left: auto; opacity: .85; }
.sp-toast-success { background: var(--sp-success); } .sp-toast-danger { background: var(--sp-danger); } .sp-toast-warning { background: var(--sp-warning); } .sp-toast-info { background: var(--sp-info); }
.sp-toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all .3s; }
@keyframes sp-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* shortcut help */
.sp-shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .35rem 1rem; }
.sp-shortcut { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .4rem .55rem; border-radius: 8px; font-size: .86rem; }
.sp-shortcut:nth-child(odd) { background: var(--sp-surface-2); }
.sp-shortcut kbd { font-size: .74rem; padding: 2px 7px; }

/* scrollable modals whose content is wrapped in a <form>: the form passes the height on, so only the body scrolls and the
   footer (Complete sale / Save) is always on screen */
.modal-dialog-scrollable .modal-content > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.modal-dialog-scrollable .modal-content > form > .modal-body { overflow-y: auto; }

/* themed dialogs (SP.confirm / SP.form) opened from inside another modal: above it, with their own dimming backdrop */
.modal.sp-dialog { z-index: 1065; }
.modal-backdrop.show ~ .modal-backdrop { z-index: 1060; }

/* ===================================================================== 14. POS terminal */
body.sp-pos-page .app-main { background: var(--sp-pos-bg); }
body.sp-pos-page .app-footer { display: none; }
body.sp-pos-page .app-content > .container-fluid { padding: .6rem .7rem .6rem !important; }
body.sp-pos-page .app-main { overflow: hidden; }
.sp-pos { display: grid; grid-template-columns: minmax(380px, 40%) 1fr; gap: .7rem; }
/* Desktop POS = exactly the visible viewport (100dvh): the header and any banner (e.g. the Super Admin "working inside
   shop" bar) keep their natural height, the POS flexes into what is left, and only the cart lines / product grid scroll.
   Nothing is a fixed pixel height, so it holds at any resolution, zoom level or banner. */
@media (min-width: 992px) {
    body.sp-pos-page { overflow: hidden; }
    body.sp-pos-page .app-wrapper { height: 100vh; height: 100dvh; min-height: 0; grid-template-rows: auto minmax(0, 1fr) 0; }
    body.sp-pos-page .app-main { min-height: 0; display: flex; flex-direction: column; }
    body.sp-pos-page .app-main > .sp-banner { flex: 0 0 auto; }
    body.sp-pos-page .app-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
    body.sp-pos-page .app-content > .container-fluid { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
    body.sp-pos-page .app-content > .container-fluid > :not(.sp-pos) { flex: 0 0 auto; }
    .sp-pos { flex: 1 1 auto; min-height: 0; }
    .sp-pos-panel.is-cart, .sp-catalog { min-height: 0; max-height: 100%; }
    /* the cart: lines scroll; head, totals, actions and Pay stay pinned inside the panel */
    .sp-pos-panel.is-cart > :not(.sp-cart-lines) { flex: 0 0 auto; }
    .sp-pos-panel.is-cart > .sp-cart-lines { flex: 1 1 0; min-height: 3rem; }
}
.sp-pos-panel { background: var(--sp-pos-cart-bg); border: 1px solid var(--sp-border); border-radius: var(--sp-radius); box-shadow: var(--sp-shadow); display: flex; flex-direction: column; min-height: 0; }
/* cart: head */
.sp-cart-head { padding: .6rem .65rem; border-bottom: 1px solid var(--sp-border); display: grid; gap: .45rem; }
.sp-cart-meta { display: flex; flex-wrap: wrap; gap: .3rem .55rem; font-size: .72rem; color: var(--sp-text-muted); align-items: center; }
.sp-cart-meta > span { display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.sp-cart-meta .sp-order-no { font-weight: 800; color: var(--sp-text); font-size: .8rem; }
.sp-cart-meta .is-open { color: var(--sp-success); } .sp-cart-meta .is-closed { color: var(--sp-danger); }
.sp-cart-row { display: flex; gap: .4rem; }
.sp-cart-row > .sp-combo, .sp-cart-row > .sp-search { flex: 1; min-width: 0; }
.sp-hold-active { display: flex; align-items: center; gap: .4rem; padding: .3rem .55rem; border-radius: 8px; font-size: .76rem; font-weight: 700;
    background: var(--sp-warning-soft); color: color-mix(in srgb, var(--sp-warning) 70%, var(--sp-text)); }
/* cart: lines */
.sp-cart-lines { flex: 1; overflow: auto; min-height: 0; padding: .3rem; }
.sp-line { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "name qty total" "meta qty acts"; gap: .1rem .55rem; align-items: center;
    padding: .45rem .5rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer; transition: background .12s; }
.sp-line + .sp-line { margin-top: 2px; }
.sp-line:hover { background: var(--sp-hover); }
.sp-line.is-selected { background: var(--sp-primary-soft); border-color: color-mix(in srgb, var(--sp-primary) 35%, transparent); }
.sp-line.is-flash { animation: sp-flash .6s var(--sp-ease); }
/* Stage 19: the newest scanned line stays marked (accent bar + tint) until another line is scanned */
.sp-line.is-latest { background: var(--sp-latest-bg); box-shadow: inset 4px 0 0 var(--sp-latest-border); }
.sp-line.is-latest.is-selected { background: var(--sp-primary-soft); }
@keyframes sp-flash { from { background: color-mix(in srgb, var(--sp-success) 25%, transparent); } }
.sp-line-name { grid-area: name; font-weight: 700; font-size: .86rem; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-line-meta { grid-area: meta; font-size: .7rem; color: var(--sp-text-muted); display: flex; flex-wrap: wrap; gap: .15rem .5rem; min-width: 0; }
.sp-line-meta .is-disc { color: var(--sp-success); font-weight: 700; } .sp-line-meta .is-note { color: var(--sp-info); }
.sp-line-qty { grid-area: qty; display: inline-flex; align-items: center; border: 1px solid var(--sp-border-strong); border-radius: 10px; overflow: hidden; background: var(--sp-surface); }
.sp-line-qty button { width: 30px; height: 32px; border: 0; background: transparent; color: var(--sp-text); font-size: 1rem; display: grid; place-items: center; }
.sp-line-qty button:hover { background: var(--sp-hover); color: var(--sp-primary); }
.sp-line-qty input { width: 48px; height: 32px; border: 0; border-left: 1px solid var(--sp-border); border-right: 1px solid var(--sp-border); text-align: center; font-weight: 800;
    background: transparent; color: var(--sp-text); font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.sp-line-qty input::-webkit-inner-spin-button, .sp-line-qty input::-webkit-outer-spin-button { -webkit-appearance: none; }
.sp-line-total { grid-area: total; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; font-size: .9rem; }
.sp-line-acts { grid-area: acts; display: flex; justify-content: flex-end; gap: 2px; }
.sp-line-acts button { width: 26px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--sp-text-muted); font-size: .85rem; display: grid; place-items: center; }
.sp-line-acts button:hover { background: var(--sp-hover); color: var(--sp-primary); }
.sp-line-acts button.is-del:hover { color: var(--sp-danger); background: var(--sp-danger-soft); }
.sp-cart-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; color: var(--sp-text-muted); text-align: center; padding: 1rem; }
.sp-cart-empty .bi { font-size: 2.2rem; color: color-mix(in srgb, var(--sp-primary) 55%, transparent); }
/* cart: totals */
.sp-cart-totals { border-top: 1px solid var(--sp-border); padding: .45rem .7rem .35rem; display: grid; grid-template-columns: 1fr auto 1fr auto; gap: .12rem .7rem; font-size: .8rem; margin: 0; }
.sp-cart-totals .is-change { color: var(--sp-success); font-size: .95rem; font-weight: 900; }
.sp-cart-totals .is-due { color: var(--sp-danger); }
.sp-pay-inline { margin: .35rem .55rem 0; padding: .4rem .7rem; border-radius: 10px; display: flex; justify-content: space-between; align-items: center; font-weight: 800;
    background: var(--sp-success-soft); color: var(--sp-success); font-variant-numeric: tabular-nums; }
.sp-pay-inline strong { font-size: 1.15rem; }
.sp-pay-inline.is-due { background: var(--sp-danger-soft); color: var(--sp-danger); }
.sp-cart-totals dt { font-weight: 600; color: var(--sp-text-muted); margin: 0; }
.sp-cart-totals dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.sp-cart-totals .is-credit { color: var(--sp-success); }
.sp-cart-totals button { border: 0; background: none; padding: 0; color: var(--sp-primary); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 3px; }
.sp-grand { margin: 0 .55rem; padding: .55rem .8rem; border-radius: 12px; background: var(--sp-pos-total-bg); color: var(--sp-pos-total-text); display: flex; align-items: center; justify-content: space-between; }
.sp-grand span { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.sp-grand strong { font-size: 1.55rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
/* action buttons (colourful but restrained: soft tone background, strong tone icon) */
.sp-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; padding: .45rem .55rem .55rem; }
.sp-act { --tone: var(--sp-primary); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: clamp(44px, 6.2dvh, 50px); padding: .25rem .2rem;
    border-radius: 12px; border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent); background: color-mix(in srgb, var(--tone) 11%, var(--sp-surface));
    color: color-mix(in srgb, var(--tone) 80%, var(--sp-text)); font-weight: 700; font-size: .74rem; line-height: 1.1; transition: transform .12s, box-shadow .12s, background .12s; }
.sp-act .bi { font-size: 1.15rem; color: var(--tone); }
.sp-act:hover:not(:disabled) { transform: translateY(-1px); background: color-mix(in srgb, var(--tone) 18%, var(--sp-surface)); box-shadow: 0 6px 14px -8px var(--tone); }
.sp-act:active:not(:disabled) { transform: translateY(0); }
.sp-act:disabled { opacity: .45; cursor: not-allowed; }
.sp-act kbd { position: absolute; top: 3px; right: 4px; font-size: .55rem; padding: 0 3px; opacity: .75; }
.sp-act .sp-act-count { position: absolute; top: -6px; left: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
    font-size: .66rem; font-weight: 800; background: var(--tone); color: #fff; box-shadow: 0 2px 6px var(--sp-shade); }
.sp-act.is-pay { --tone: var(--sp-success); grid-column: 1 / -1; flex-direction: row; gap: .55rem; font-size: 1rem; min-height: clamp(48px, 7dvh, 56px); background: var(--sp-success); color: #fff; border-color: var(--sp-success);
    box-shadow: 0 8px 18px -10px var(--sp-success); }
.sp-act.is-pay .bi { color: #fff; font-size: 1.35rem; }
.sp-act.is-pay kbd { position: static; color: #fff; }
.sp-act.is-pay:hover:not(:disabled) { background: var(--sp-success); filter: brightness(1.06); }
.sp-act.t-hold { --tone: var(--sp-warning); } .sp-act.t-recent { --tone: var(--sp-info); } .sp-act.t-discount { --tone: var(--sp-accent); }
.sp-act.t-customer { --tone: var(--sp-primary); } .sp-act.t-voucher { --tone: var(--sp-accent); } .sp-act.t-print { --tone: var(--sp-secondary); }
.sp-act.t-clear { --tone: var(--sp-danger); } .sp-act.t-help { --tone: var(--sp-secondary); }
/* catalogue: toolbar */
.sp-catalog { display: flex; flex-direction: column; min-height: 0; min-width: 0; gap: .55rem; }
.sp-pos > * { min-width: 0; }
.sp-cat-toolbar { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.sp-cat-toolbar .sp-search { flex: 1 1 260px; min-width: 200px; }
.sp-cat-toolbar .sp-search .form-control { height: 44px; font-size: .95rem; border-radius: 12px; box-shadow: var(--sp-shadow-sm); }
.sp-cat-toolbar .sp-search kbd { position: absolute; right: .65rem; top: 50%; transform: translateY(-50%); color: var(--sp-text-muted); }
.sp-tool { height: 44px; border-radius: 12px; padding: 0 .85rem; font-weight: 700; font-size: .84rem; display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
    border: 1px solid var(--sp-border); background: var(--sp-surface); color: var(--sp-text); box-shadow: var(--sp-shadow-sm); position: relative; }
.sp-tool:hover { background: var(--sp-hover); }
.sp-tool .bi { font-size: 1.05rem; color: var(--sp-primary); }
.sp-tool kbd { color: var(--sp-text-muted); }
.sp-tool.is-on { background: var(--sp-primary); border-color: var(--sp-primary); color: var(--sp-primary-contrast); }
.sp-tool.is-on .bi, .sp-tool.is-on kbd { color: var(--sp-primary-contrast); }
.sp-tool-count { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center; font-size: .68rem; font-weight: 800; background: var(--sp-warning); color: #fff; }
.sp-active-cat { display: inline-flex; align-items: center; gap: .45rem; height: 34px; padding: 0 .3rem 0 .7rem; border-radius: 999px; font-weight: 700; font-size: .82rem;
    background: var(--sp-primary); color: var(--sp-primary-contrast); box-shadow: 0 4px 12px -6px var(--sp-primary); }
.sp-active-cat button { width: 24px; height: 24px; border: 0; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--sp-primary-contrast) 22%, transparent); color: inherit; }
.sp-active-cat button:hover { background: color-mix(in srgb, var(--sp-primary-contrast) 38%, transparent); }
/* held bills strip */
.sp-held-strip { display: flex; gap: .4rem; overflow-x: auto; padding: 2px 2px 4px; scroll-snap-type: x proximity; }
.sp-held-strip:empty { display: none; }
.sp-held { scroll-snap-align: start; flex: 0 0 auto; display: flex; flex-direction: column; gap: 1px; min-width: 150px; max-width: 220px; padding: .35rem .6rem; border-radius: 10px; text-align: left;
    border: 1px solid color-mix(in srgb, var(--sp-warning) 35%, transparent); background: color-mix(in srgb, var(--sp-warning) 9%, var(--sp-surface)); color: var(--sp-text); font-size: .74rem; }
.sp-held:hover { background: color-mix(in srgb, var(--sp-warning) 17%, var(--sp-surface)); }
.sp-held b { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-held small { color: var(--sp-text-muted); white-space: nowrap; }
.sp-held .sp-held-amt { font-weight: 800; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--sp-warning) 65%, var(--sp-text)); }
.sp-held.is-active { background: var(--sp-warning); border-color: var(--sp-warning); color: #fff; box-shadow: 0 6px 14px -8px var(--sp-warning); }
.sp-held.is-active small, .sp-held.is-active .sp-held-amt { color: #fff; }
/* product grid — every card has the SAME size with or without an image (fixed media box, no layout shift) */
.sp-grid { flex: 1; overflow: auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--sp-tile-w, 138px), 1fr)); grid-auto-rows: var(--sp-tile-h, 150px);
    gap: .5rem; align-content: start; padding: 2px; overscroll-behavior: contain; }
.sp-tile { position: relative; display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; border-radius: 12px; border: 1px solid var(--sp-card-border); height: 100%;
    background: var(--sp-pos-tile-bg); color: var(--sp-pos-tile-text); box-shadow: var(--sp-shadow-sm); transition: transform .1s var(--sp-ease), box-shadow .1s, border-color .1s; }
.sp-tile:hover { transform: translateY(-1px); border-color: var(--sp-primary); box-shadow: 0 8px 18px -12px color-mix(in srgb, var(--sp-primary) 70%, transparent); }
.sp-tile:active { transform: scale(.98); }
.sp-tile.is-added { animation: sp-pop .3s var(--sp-ease); }
@keyframes sp-pop { 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-success) 55%, transparent); } }
.sp-tile-media { position: relative; flex: 1 1 var(--sp-tile-media, 62px); min-height: var(--sp-tile-media, 62px); overflow: hidden; display: grid; place-items: center;
    background: color-mix(in srgb, var(--sp-primary) 7%, var(--sp-surface-2)); }
.sp-tile-media img { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Stage 19: the photo fills the media area (cover, centred); name / price sit on their own strip below, never on the photo */
.sp-tile-bg { display: none; }
.sp-tile-fg { object-fit: cover; object-position: center; }
.sp-tile-initials { font-size: 1.25rem; font-weight: 900; letter-spacing: .02em; color: color-mix(in srgb, var(--sp-primary) 70%, var(--sp-text)); opacity: .75; display: none; }
.sp-tile-media.is-noimg img { display: none; }
.sp-tile-media.is-noimg .sp-tile-initials { display: block; }
.sp-tile-tag { position: absolute; top: 4px; left: 4px; padding: 1px 6px; border-radius: 999px; font-size: .6rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
    background: var(--sp-surface); box-shadow: var(--sp-shadow-sm); }
.sp-tile-tag.is-service { color: var(--sp-info); } .sp-tile-tag.is-combo { color: var(--sp-accent); }
.sp-tile-body { padding: .3rem .45rem .35rem; display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; min-height: 0;
    background: var(--sp-pos-tile-bg); border-top: 1px solid var(--sp-card-border); }
.sp-tile-name { font-weight: 700; font-size: .78rem; line-height: 1.18; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-tile-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 4px; flex-wrap: nowrap; min-width: 0; }
.sp-tile-foot .sp-stock { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Stage 20.2: a deal's availability ("Service deal", "3 deals left", "Out of stock") sits on the picture so it is never cut */
.sp-tile-dealstock { position: absolute; right: 4px; bottom: 4px; max-width: calc(100% - 8px); z-index: 1; display: flex; }
.sp-tile-dealstock .sp-stock { box-shadow: 0 1px 3px color-mix(in srgb, var(--sp-text) 25%, transparent); overflow: hidden; text-overflow: ellipsis; }
.sp-tile.is-out .sp-tile-media:has(.sp-tile-dealstock) { filter: none; }   /* grey the picture, keep the red "Out of stock" badge red */
.sp-tile.is-out .sp-tile-media:has(.sp-tile-dealstock) > :not(.sp-tile-dealstock) { filter: grayscale(1); }
.sp-tile-price { font-weight: 900; font-size: .88rem; color: var(--sp-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* stock badge: large, readable in every theme (text colour mixed towards the theme text for contrast) */
.sp-stock { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 7px; font-size: .74rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-stock.is-in { background: var(--sp-success-soft); color: color-mix(in srgb, var(--sp-success) 78%, var(--sp-text)); }
.sp-stock.is-low { background: var(--sp-warning-soft); color: color-mix(in srgb, var(--sp-warning) 70%, var(--sp-text)); }
.sp-stock.is-out { background: var(--sp-danger); color: #fff; }
.sp-stock.is-service { background: var(--sp-info-soft); color: color-mix(in srgb, var(--sp-info) 78%, var(--sp-text)); }
.sp-tile.is-out { opacity: .55; cursor: not-allowed; } .sp-tile.is-out .sp-tile-media { filter: grayscale(1); }
.sp-tile.is-out:hover { transform: none; border-color: var(--sp-border); }
.sp-tile.is-skel { pointer-events: none; }
.sp-tile.is-skel .sp-tile-media { background: none; } .sp-tile.is-skel .sp-skel { width: 100%; height: 100%; border-radius: 0; }
.sp-grid-more { display: contents; }
.sp-grid-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .76rem; color: var(--sp-text-muted); padding: .1rem .1rem .35rem; min-height: 1.4rem; }
.sp-grid-end { display: inline-flex; gap: .3rem; align-items: center; }
/* search box: clear X + scan feedback */
.sp-search-clear { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 50%; display: grid; place-items: center;
    background: var(--sp-hover); color: var(--sp-text); z-index: 2; }
.sp-search-clear:hover { background: var(--sp-danger-soft); color: var(--sp-danger); }
.sp-cat-toolbar .sp-search:has(.sp-search-clear:not([hidden])) kbd { display: none; }
.sp-search.is-ok > .form-control { animation: sp-ok .45s; } .sp-search.is-err > .form-control { animation: sp-err .45s; }
@keyframes sp-ok { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-success) 55%, transparent); border-color: var(--sp-success); } }
@keyframes sp-err { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-danger) 55%, transparent); border-color: var(--sp-danger); } }
/* recently used products row */
.sp-recent-row { display: flex; gap: .3rem; overflow-x: auto; align-items: center; min-height: 0; }
.sp-recent-row:empty { display: none; }
.sp-recent-label { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--sp-text-muted); display: inline-flex; gap: .25rem; white-space: nowrap; }
.sp-recent-chip { flex: 0 0 auto; max-width: 170px; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--sp-border); background: var(--sp-surface); color: var(--sp-text);
    font-size: .74rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-recent-chip:hover { border-color: var(--sp-primary); background: var(--sp-primary-soft); }
/* categories drawer */
.sp-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.sp-cat { display: flex; align-items: center; gap: .55rem; padding: .6rem .7rem; border-radius: 12px; border: 1px solid var(--sp-border); background: var(--sp-surface); color: var(--sp-text);
    font-weight: 700; font-size: .84rem; text-align: left; min-height: 52px; }
.sp-cat:hover { border-color: var(--sp-primary); background: var(--sp-primary-soft); }
.sp-cat .sp-cat-ico { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px; display: grid; place-items: center; background: var(--sp-primary-soft); color: var(--sp-primary); font-weight: 900; font-size: .8rem; }
.sp-cat.is-active { background: var(--sp-primary); border-color: var(--sp-primary); color: var(--sp-primary-contrast); }
.sp-cat.is-active .sp-cat-ico { background: color-mix(in srgb, var(--sp-primary-contrast) 22%, transparent); color: var(--sp-primary-contrast); }
/* payment modal */
.sp-pay-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1rem; }
.sp-pay-sum { display: grid; gap: .35rem; padding: .85rem; border-radius: 14px; background: var(--sp-surface-2); border: 1px solid var(--sp-border); font-size: .9rem; }
.sp-pay-sum > div { display: flex; justify-content: space-between; gap: .5rem; } .sp-pay-sum b { font-variant-numeric: tabular-nums; }
.sp-pay-sum .is-total { font-size: 1.15rem; font-weight: 900; border-top: 1px dashed var(--sp-border); padding-top: .35rem; }
.sp-pay-sum .is-credit { color: var(--sp-success); } .sp-pay-sum .is-due { color: var(--sp-danger); }
.sp-change { margin-top: .6rem; padding: .8rem 1rem; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; background: var(--sp-success); color: #fff; }
.sp-change span { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .78rem; opacity: .9; }
.sp-change strong { font-size: 2rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.sp-change.is-due { background: var(--sp-danger); }
.sp-change.is-zero { background: var(--sp-secondary-soft); color: var(--sp-text); }
.sp-tender { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; }
.sp-tender input { position: absolute; opacity: 0; pointer-events: none; }
.sp-tender label { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .45rem .2rem; border-radius: 10px; border: 1px solid var(--sp-border); background: var(--sp-surface);
    font-size: .74rem; font-weight: 700; cursor: pointer; color: var(--sp-text); }
.sp-tender label .bi { font-size: 1.1rem; color: var(--sp-primary); }
.sp-tender input:checked + label { background: var(--sp-primary); border-color: var(--sp-primary); color: var(--sp-primary-contrast); }
.sp-tender input:checked + label .bi { color: var(--sp-primary-contrast); }
.sp-tender input:focus-visible + label { box-shadow: var(--sp-ring); }
.sp-quick-cash { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.sp-quick-cash .btn { --bs-btn-padding-y: .25rem; --bs-btn-padding-x: .6rem; --bs-btn-font-size: .8rem; }
.sp-amount { font-size: 1.6rem; font-weight: 900; height: 56px; text-align: right; font-variant-numeric: tabular-nums; }
/* Stage 17 payment: 4 methods, part payments, voucher credit box, vertical cash-notes counter (Cash widens the modal) */
.sp-tender { grid-template-columns: repeat(4, 1fr); }
.sp-pay-grid.has-denoms { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(220px, .85fr); }
.sp-pay-grid.has-denoms .sp-change { flex-wrap: wrap; gap: .25rem .5rem; }
.sp-pay-grid.has-denoms .sp-change strong { font-size: 1.55rem; white-space: nowrap; margin-left: auto; }
.sp-exact { font-size: 1.05rem; font-weight: 900; padding: .55rem .75rem; display: flex; align-items: center; justify-content: center; gap: .45rem; }
.sp-pay-applied { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .3rem; }
.sp-pay-applied li { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; border-radius: 10px; background: var(--sp-success-soft, var(--sp-surface-2)); border: 1px solid var(--sp-border); font-size: .84rem; }
.sp-pay-applied li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-voucher-box { padding: .6rem .7rem; border-radius: 12px; border: 1px dashed var(--sp-border); background: var(--sp-surface-2); }
.sp-denoms { display: flex; flex-direction: column; gap: .3rem; padding: .55rem; border-radius: 14px; border: 1px solid var(--sp-border); background: var(--sp-surface-2); }
.sp-denoms-head, .sp-denoms-total { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--sp-text-muted); }
.sp-denoms-total { border-top: 1px dashed var(--sp-border); padding-top: .35rem; color: var(--sp-text); }
.sp-denoms-total b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.sp-denoms.is-manual .sp-denoms-head span::after { content: ' · starts from 0'; font-weight: 600; text-transform: none; letter-spacing: 0; }
#pay-denom-rows { display: grid; gap: .3rem; }
.sp-denom { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; grid-template-areas: "minus note plus" "minus count plus"; align-items: center; gap: 0 .45rem;
    padding: .2rem; border-radius: 12px; background: var(--sp-surface); border: 1px solid var(--sp-border); }
.sp-denom .is-minus { grid-area: minus; } .sp-denom .is-plus { grid-area: plus; }
.sp-denom-note { grid-area: note; font-weight: 900; font-size: 1rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.sp-denom-count { grid-area: count; font-size: .78rem; color: var(--sp-text-muted); font-variant-numeric: tabular-nums; }
.sp-denom-sub { grid-area: note; justify-self: end; font-weight: 800; font-size: .86rem; font-variant-numeric: tabular-nums; color: var(--sp-text-muted); }
.sp-denom.is-on { border-color: var(--sp-success); }
.sp-denom.is-on .sp-denom-sub { color: var(--sp-success); }
.sp-denom-btn { width: 44px; height: 44px; border-radius: 10px; border: 0; font-size: 1.35rem; font-weight: 900; line-height: 1; color: #fff; display: grid; place-items: center; }
.sp-denom-btn.is-minus { background: var(--sp-danger); } .sp-denom-btn.is-plus { background: var(--sp-success); }
.sp-denom-btn:disabled { opacity: .35; cursor: not-allowed; }
.sp-denom-btn:focus-visible { box-shadow: var(--sp-ring); outline: 0; }
/* scan feedback: centre pulse (does not block input), cart scan numbers, Recent quantity badges */
.sp-scan-pulse { position: fixed; left: 50%; top: 50%; z-index: 1090; width: 168px; height: 168px; margin: -84px 0 0 -84px; border-radius: 50%; pointer-events: none;
    display: grid; place-items: center; background: var(--sp-danger); color: #fff; box-shadow: 0 0 0 0 color-mix(in srgb, var(--sp-danger) 55%, transparent); opacity: 0; transform: scale(.6); }
.sp-scan-pulse span { font-size: 4.6rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sp-scan-pulse.is-on { animation: sp-qty-pulse 1s var(--sp-ease) forwards; }
@keyframes sp-qty-pulse {
    0% { opacity: 0; transform: scale(.6); box-shadow: 0 0 0 0 color-mix(in srgb, var(--sp-danger) 55%, transparent); }
    15% { opacity: .96; transform: scale(1.06); }
    30% { transform: scale(1); }
    75% { opacity: .96; box-shadow: 0 0 0 36px color-mix(in srgb, var(--sp-danger) 0%, transparent); }
    100% { opacity: 0; transform: scale(.92); }
}
@media (prefers-reduced-motion: reduce) { .sp-scan-pulse.is-on { animation: sp-qty-fade 1s linear forwards; } @keyframes sp-qty-fade { 0%, 80% { opacity: .96; transform: none; } 100% { opacity: 0; transform: none; } } }
.sp-line-seq { display: inline-block; margin-right: .35rem; padding: 0 .35rem; border-radius: 6px; font-size: .68rem; font-weight: 800; vertical-align: 1px; background: var(--sp-primary-soft); color: var(--sp-primary); font-variant-numeric: tabular-nums; }
.sp-line.is-conflict .sp-line-seq { background: var(--sp-tone-danger); color: var(--sp-on-solid); }
.sp-recent-chip.is-in-cart { border-color: var(--sp-primary); }
.sp-recent-qty { margin-left: .3rem; padding: 0 .35rem; border-radius: 999px; font-size: .68rem; font-weight: 900; background: var(--sp-primary); color: var(--sp-primary-contrast); }
/* recent orders */
.sp-recent-row.is-due td:first-child { box-shadow: inset 3px 0 0 var(--sp-danger); }
.sp-pay-methods { display: flex; gap: 3px; flex-wrap: wrap; }
.sp-pay-methods span { padding: 0 6px; border-radius: 6px; font-size: .66rem; font-weight: 800; text-transform: uppercase; background: var(--sp-surface-2); border: 1px solid var(--sp-border); }
.sp-print-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.sp-print-choice { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; padding: .75rem; border-radius: 12px; border: 1px solid var(--sp-border); background: var(--sp-surface);
    color: var(--sp-text); text-align: left; font-weight: 700; font-size: .86rem; }
.sp-print-choice .bi { font-size: 1.3rem; color: var(--sp-primary); }
.sp-print-choice small { font-weight: 500; color: var(--sp-text-muted); font-size: .72rem; }
.sp-print-choice:hover { border-color: var(--sp-primary); background: var(--sp-primary-soft); }

/* ===================================================================== 15. receipts and documents (on-screen previews) */
.sp-paper { background: var(--sp-receipt-bg); color: var(--sp-receipt-text); margin: 0 auto; box-shadow: var(--sp-shadow); border-radius: 4px; }
.sp-paper-58 { width: 58mm; } .sp-paper-80 { width: 80mm; } .sp-paper-a4 { width: 100%; max-width: 210mm; }
.sp-preview-wrap { background: var(--sp-surface-2); border-radius: var(--sp-radius); padding: 1rem; max-height: 68vh; overflow: auto; }
.sp-preview-wrap iframe { display: block; width: 100%; border: 0; background: transparent; }
.sp-receipt { max-width: 340px; margin: 0 auto; font-family: "Courier New", monospace; font-size: 12px; color: var(--sp-receipt-text); background: var(--sp-receipt-bg); padding: 12px; }
.sp-receipt table { width: 100%; border-collapse: collapse; } .sp-receipt td { padding: 2px 0; vertical-align: top; } .sp-receipt .r { text-align: right; }
.sp-receipt hr { border: 0; border-top: 1px dashed var(--sp-receipt-rule); margin: 6px 0; opacity: 1; }

/* ===================================================================== 16. guest pages */
.sp-guest { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--sp-primary) 55%, transparent), transparent 55%), linear-gradient(135deg, var(--sp-sidebar-bg), color-mix(in srgb, var(--sp-primary) 70%, var(--sp-sidebar-bg))); }
.sp-guest-card, .tm-guest-card { width: min(420px, 100%); background: var(--sp-surface); color: var(--sp-text); border-radius: 18px; box-shadow: 0 24px 60px rgba(0,0,0,.3); padding: 2rem; }
.sp-guest-logo, .tm-guest-logo { width: 56px; height: 56px; margin: 0 auto .75rem; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; background: var(--sp-primary); color: var(--sp-primary-contrast); }
.tm-guest-title { text-align: center; font-weight: 800; font-size: 1.2rem; }
.tm-guest-sub { text-align: center; color: var(--sp-text-muted); font-size: .85rem; margin-bottom: 1rem; }

/* ===================================================================== 17. retained admin pages + theme picker (older class names mapped onto tokens) */
.tm-card { --bs-card-bg: var(--sp-surface); border-color: var(--sp-border); }
.tm-modal-green .modal-header, .tm-modal-primary .modal-header { background: var(--sp-primary); color: var(--sp-primary-contrast); border-radius: calc(var(--sp-radius-lg) - 1px) calc(var(--sp-radius-lg) - 1px) 0 0; }
.tm-modal-green .modal-header .btn-close, .tm-modal-primary .modal-header .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.tm-filter-card { border: 1px solid var(--sp-border); border-radius: var(--sp-radius); background: var(--sp-surface); margin-bottom: 1rem; box-shadow: var(--sp-shadow); }
.tm-filter-header { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--sp-border); }
.tm-fh-icon-badge { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--sp-primary-soft); color: var(--sp-primary); }
.tm-fh-title { font-weight: 700; } .tm-fh-sub { font-size: .8rem; color: var(--sp-text-muted); }
.tm-fh-toggle-btn { margin-left: auto; }
.tm-filter-body { padding: 1rem; }
.tm-summary-card { border: 1px solid var(--sp-border); border-radius: var(--sp-radius); background: var(--sp-surface); padding: 1rem; display: flex; gap: .75rem; align-items: center; box-shadow: var(--sp-shadow); }
.tm-sc-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--sp-primary-soft); color: var(--sp-primary); font-size: 1.2rem; }
.tm-sc-label { color: var(--sp-text-muted); font-size: .8rem; } .tm-sc-value { font-weight: 800; font-size: 1.2rem; }
.sp-theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.sp-theme-option { border: 2px solid var(--sp-border); border-radius: var(--sp-radius); background: var(--sp-surface); padding: .6rem; text-align: left; display: flex; flex-direction: column; gap: .5rem; color: var(--sp-text); }
.sp-theme-option.is-active { border-color: var(--sp-primary); box-shadow: var(--sp-ring); }
.sp-theme-option:disabled { opacity: .7; }
.sp-theme-preview { display: flex; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid rgba(0,0,0,.08); background: var(--b); }
.sp-theme-preview-side { width: 30%; background: var(--s); }
.sp-theme-preview-main { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.sp-theme-preview-main i { display: block; height: 10px; border-radius: 4px; background: var(--c); }
.sp-theme-preview-main b { display: block; width: 50%; height: 14px; border-radius: 4px; background: var(--p); margin-top: auto; box-shadow: 14px 0 0 -2px var(--a); }
.sp-theme-name { font-weight: 700; font-size: .9rem; }
.app-footer { background: var(--sp-surface); color: var(--sp-text-muted); border-top: 1px solid var(--sp-border); font-size: .8rem; padding: .6rem 1.25rem; }

/* ===================================================================== 18. responsive */
@media (max-width: 1599.98px) { .sp-tool kbd { display: none; } }
@media (max-width: 1439.98px) {
    .sp-tool.is-compact .sp-tool-label { display: none; }
    .sp-pos { grid-template-columns: minmax(360px, 42%) 1fr; }
    .sp-pos { --sp-tile-w: 128px; --sp-tile-h: 140px; --sp-tile-media: 56px; }
}
@media (max-width: 1199.98px) {
    .sp-pos { grid-template-columns: minmax(340px, 46%) 1fr; }
    .sp-tool .sp-tool-label { display: none; }
    .sp-cat-toolbar .sp-search { flex-basis: 180px; min-width: 150px; }
    .sp-cat-toolbar .sp-search kbd { display: none; }
    .sp-act { font-size: .68rem; } .sp-act kbd { display: none; }
    .sp-pay-grid { grid-template-columns: 1fr; }
    /* cash at ≤ 1199px (e.g. 1024 × 768): summary + entry stacked on the left, the notes counter stays a vertical column on the right */
    .sp-pay-grid.has-denoms { grid-template-columns: minmax(0, 1fr) minmax(200px, .72fr); }
    .sp-pay-grid.has-denoms > .sp-denoms { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
}
@media (max-width: 991.98px) {
    .sp-pos { grid-template-columns: 1fr; height: auto; }
    .sp-pos-panel.is-cart { min-height: 70vh; }
    .sp-grid { max-height: 70vh; }
}
@media (min-width: 1600px) { .sp-pos { --sp-tile-w: 150px; --sp-tile-h: 168px; --sp-tile-media: 76px; } }
@media (max-height: 800px) and (min-width: 992px) {
    .sp-pos { --sp-tile-h: 132px; --sp-tile-media: 52px; }
    .sp-cart-totals { padding-top: .3rem; padding-bottom: .25rem; }
    .sp-grand { padding: .4rem .75rem; } .sp-grand strong { font-size: 1.35rem; }
    .sp-actions { padding: .4rem .5rem .5rem; gap: .3rem; }
    .sp-act .bi { font-size: 1.05rem; }
}
@media (max-width: 575.98px) {
    .sp-filterbar .sp-field { flex: 1 1 calc(50% - .6rem); }
    .sp-filterbar .sp-actions { margin-left: 0; width: 100%; }
    .sp-page-icon { display: none; }
    .sp-tender { grid-template-columns: repeat(3, 1fr); }
}

/* ===================================================================== 19. print (pages printed from the browser; documents use sp-print.css) */
@media print {
    .app-sidebar, .app-header, .app-footer, .sp-banner, .no-print, .sp-filterbar, .sp-pager, .sp-toolbar, .sp-hero .btn { display: none !important; }
    .app-main { margin: 0 !important; } body, .app-main { background: #fff !important; }
    .card, .sp-card, .sp-kpi { box-shadow: none !important; }
    .sp-table-wrap { max-height: none !important; overflow: visible !important; }
}

/* ===================================================================== 20. product images (Product Master) */
.sp-thumb { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; display: inline-grid; place-items: center; background: var(--sp-surface-2); border: 1px solid var(--sp-border); cursor: pointer; color: var(--sp-text-muted); }
.sp-thumb img { width: 100%; height: 100%; object-fit: contain; }
.sp-thumb:hover { border-color: var(--sp-primary); }
/* editor "Product image" block: fixed-size preview (same box with or without an image) + actions; the block is a drop zone */
.sp-pimg { --sp-pimg-size: 112px; display: flex; gap: .8rem; align-items: center; padding: .55rem; border-radius: var(--sp-radius); border: 1px dashed var(--sp-border); background: var(--sp-surface-2); transition: border-color .15s, background .15s; }
.sp-pimg.is-drag { border-color: var(--sp-primary); background: color-mix(in srgb, var(--sp-primary) 8%, var(--sp-surface)); }
.sp-pimg.is-invalid { border-color: var(--sp-danger); }
.sp-pimg-preview { position: relative; flex: 0 0 var(--sp-pimg-size); width: var(--sp-pimg-size); height: var(--sp-pimg-size); border-radius: var(--sp-radius-sm); overflow: hidden; display: grid; place-items: center;
    background: var(--sp-surface); border: 1px solid var(--sp-border); color: var(--sp-text-muted); }
.sp-pimg-preview img { position: absolute; inset: 0; width: 100%; height: 100%; }
.sp-pimg-preview .sp-pimg-bg { object-fit: cover; filter: blur(10px) saturate(1.1); transform: scale(1.2); opacity: .45; }
.sp-pimg-preview .sp-pimg-fg { object-fit: contain; padding: 4px; }
.sp-pimg-empty { display: grid; justify-items: center; gap: 2px; font-size: .68rem; font-weight: 700; text-align: center; }
.sp-pimg-empty .bi { font-size: 1.7rem; color: color-mix(in srgb, var(--sp-primary) 55%, transparent); }
.sp-pimg-badge { position: absolute; left: 4px; bottom: 4px; padding: 0 6px; border-radius: 999px; font-size: .6rem; font-weight: 800; background: var(--sp-warning); color: #fff; }
.sp-pimg-badge.is-remove { background: var(--sp-danger); }
.sp-pimg-body { flex: 1; min-width: 0; display: grid; gap: .3rem; }
.sp-pimg-hint { font-size: .74rem; color: var(--sp-text-muted); overflow-wrap: anywhere; }
.sp-pimg-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.sp-pimg-progress .progress { height: 6px; }
.sp-pimg.is-busy .sp-pimg-actions { pointer-events: none; opacity: .6; }

/* ===================================================================== 21. Product Master editor (Stage 13) */
.sp-type-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.sp-type-cards input { position: absolute; opacity: 0; pointer-events: none; }
.sp-type-cards label { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: .55rem; align-items: center; padding: .6rem .75rem; border-radius: 12px;
    border: 1px solid var(--sp-border); background: var(--sp-surface); cursor: pointer; height: 100%; }
.sp-type-cards label .bi { grid-row: 1 / 3; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--sp-primary-soft); color: var(--sp-primary); font-size: 1.05rem; }
.sp-type-cards label small { color: var(--sp-text-muted); font-size: .72rem; line-height: 1.25; }
.sp-type-cards input:checked + label { border-color: var(--sp-primary); box-shadow: var(--sp-ring); background: var(--sp-primary-soft); }
.sp-type-cards input:focus-visible + label { box-shadow: var(--sp-ring); }
.sp-deal { border: 1px solid var(--sp-border); border-radius: var(--sp-radius); padding: .75rem; background: var(--sp-surface-2); }
.sp-deal .sp-qty-in { width: 80px; margin: 0 auto; }
.sp-deal-sum { display: grid; gap: .15rem; padding: .5rem .7rem; border-radius: 10px; background: var(--sp-surface); border: 1px solid var(--sp-border); font-size: .85rem; }
.sp-deal-sum > div { display: flex; justify-content: space-between; gap: .5rem; } .sp-deal-sum b { font-variant-numeric: tabular-nums; }
.sp-deal-sum .is-final { font-size: 1rem; color: var(--sp-success); border-top: 1px dashed var(--sp-border); padding-top: .2rem; }
.sp-specs { padding-left: 0; margin: 0; display: grid; gap: .3rem; list-style: none; counter-reset: spec; }
.sp-spec { display: flex; align-items: center; gap: .3rem; }
.sp-spec-grip { cursor: grab; color: var(--sp-text-muted); padding: 0 .1rem; }
@media (max-width: 767.98px) { .sp-type-cards { grid-template-columns: 1fr; } }
/* POS: deal children, serials and details under cart lines */
.sp-line-children { grid-column: 1 / -1; margin: .1rem 0 0 .6rem; padding: 0; list-style: none; font-size: .72rem; color: var(--sp-text-muted); }
.sp-line-children li::before { content: '• '; color: var(--sp-accent); }
.sp-line-serials { grid-column: 1 / -1; font-size: .7rem; color: var(--sp-info); margin-left: .6rem; }
.sp-details-specs { margin: .4rem 0 0; padding-left: 1.1rem; }
.sp-details-img { height: 220px; border-radius: var(--sp-radius); background: var(--sp-surface-2); display: grid; place-items: center; overflow: hidden; }
.sp-details-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* 22. Customer statement opening / closing rows (Stage 15) - theme tokens, readable in every theme */
.sp-st-total > td { background: var(--sp-surface-2); color: var(--sp-text); }

/* ===================================================================== 23. Stage 20 keyboard-first POS
   Focus outlines (theme token --sp-focus), shortcut badges at every width, on-screen keyboard (F1), price check (F5),
   keyboard rows in the held / recent / approval lists. Colours only from tokens, so every preset follows. */
.sp-tile:focus, .sp-tile:focus-visible, .sp-cat:focus, .sp-cat:focus-visible, .sp-price-item:focus, .sp-price-item:focus-visible {
    outline: 3px solid var(--sp-focus); outline-offset: -3px; border-color: var(--sp-focus);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--sp-focus) 30%, transparent), var(--sp-shadow); z-index: 1; }
/* the ring is drawn by an overlay so no image, badge or dimmed (sold out) tile can hide it */
.sp-tile:focus::after, .sp-cat:focus::after, .sp-price-item:focus::after { content: ""; position: absolute; inset: 0; border: 3px solid var(--sp-focus); border-radius: inherit; pointer-events: none; z-index: 3; }
.sp-cat { position: relative; }
.sp-tile.is-out:focus { opacity: 1; }
/* recent orders table: its rows share a class name with the recent-products chip row (a flex box), which broke the column alignment */
tr.sp-recent-row { display: table-row; overflow: visible; }
.sp-krow { cursor: pointer; }
.sp-krow:focus, .sp-krow:focus-visible, #held-list .list-group-item:focus, #held-list .list-group-item:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: -3px; }
.sp-krow:focus > td { background: var(--sp-primary-soft); color: var(--sp-text); }
#held-list .list-group-item:focus { background: var(--sp-primary-soft); color: var(--sp-text); }
#review-actions .btn:focus, #review-actions .btn:focus-visible, #appr-detail-pane .btn:focus, #appr-detail-pane .btn:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: 2px; }
/* shortcut badges stay visible on narrow screens as a small corner tag (they were hidden below 1600 / 1200 px) */
@media (max-width: 1599.98px) {
    .sp-tool kbd:not([hidden]) { display: inline-block; position: absolute; top: -7px; right: -5px; padding: 0 3px; font-size: .52rem; line-height: 1.5;
        background: var(--sp-surface); color: var(--sp-text-muted); border-color: var(--sp-border-strong); }
    .sp-tool.is-on kbd:not([hidden]) { background: var(--sp-primary); color: var(--sp-primary-contrast); }
}
@media (max-width: 1199.98px) { .sp-act kbd:not([hidden]) { display: inline-block; font-size: .5rem; top: 1px; right: 2px; } }

/* ---- on-screen keyboard: fixed to the bottom, slides up; the page is fitted above it while it is open (nothing is covered) */
.sp-osk { --k: clamp(30px, 4.6dvh, 46px); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1090; padding: .35rem .5rem .45rem;
    background: var(--sp-surface); color: var(--sp-text); border-top: 2px solid var(--sp-border-strong);
    box-shadow: 0 -16px 36px -20px color-mix(in srgb, var(--sp-text) 70%, transparent);
    transform: translateY(105%); visibility: hidden; transition: transform .16s var(--sp-ease), visibility 0s linear .16s; }
.sp-osk.is-open { transform: none; visibility: visible; transition: transform .16s var(--sp-ease); }
.sp-osk-bar { display: flex; gap: 4px; margin-bottom: 4px; }
.sp-osk-short { flex: 1 1 0; min-width: 0; height: var(--k); display: flex; align-items: center; justify-content: center; gap: .3rem; padding: 0 .3rem; border-radius: 8px;
    border: 1px solid var(--sp-border-strong); background: var(--sp-primary-soft); color: var(--sp-text); font-weight: 700; font-size: .78rem; white-space: nowrap; overflow: hidden; touch-action: manipulation; }
.sp-osk-short .bi { color: var(--sp-primary); }
.sp-osk-short kbd { font-size: .58rem; }
.sp-osk-short.is-close { flex: 0 0 auto; padding: 0 .7rem; background: var(--sp-surface-2); }
.sp-osk-body { display: grid; grid-template-columns: minmax(0, 1fr) clamp(190px, 23vw, 320px); gap: .55rem; }
.sp-osk-main, .sp-osk-pad { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sp-osk-row { display: flex; gap: 4px; }
.sp-osk-key { flex: var(--w, 1) 1 0; min-width: 0; height: var(--k); padding: 0; border-radius: 7px; border: 1px solid var(--sp-border-strong);
    background: var(--sp-surface-2); color: var(--sp-text); font-size: .98rem; font-weight: 700; white-space: nowrap; overflow: hidden; touch-action: manipulation; }
.sp-osk-key:hover, .sp-osk-short:hover { background: var(--sp-hover); }
.sp-osk-key.is-fn { background: var(--sp-secondary-soft); font-size: .76rem; }
.sp-osk-key.is-op { background: var(--sp-info-soft); }
.sp-osk-key.is-apply { background: var(--sp-success-soft); border-color: var(--sp-success); font-size: .76rem; }
.sp-osk-key.is-on { background: var(--sp-primary); color: var(--sp-primary-contrast); border-color: var(--sp-primary); }
.sp-osk-key:active, .sp-osk-short:active { background: var(--sp-primary); color: var(--sp-primary-contrast); border-color: var(--sp-primary); }
.sp-osk-key:active .bi, .sp-osk-short:active .bi { color: inherit; }
.sp-osk-display { flex: 3.4 1 0; min-width: 0; height: var(--k); line-height: calc(var(--k) - 2px); padding: 0 .6rem; text-align: right; border-radius: 7px; border: 1px solid var(--sp-border-strong);
    background: var(--sp-input-bg); color: var(--sp-text); font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; overflow: hidden; }
@media (max-width: 699.98px) {   /* phones: letters only (the numbers are on the top row); the shortcut bar scrolls sideways */
    .sp-osk-body { grid-template-columns: minmax(0, 1fr); } .sp-osk-pad { display: none; }
    .sp-osk-bar { overflow-x: auto; } .sp-osk-short { flex: 0 0 auto; padding: 0 .6rem; } .sp-osk-key { font-size: .8rem; } .sp-osk-key.is-fn { font-size: .6rem; }
}
@media (min-width: 992px) { body.sp-osk-open.sp-pos-page .app-wrapper { height: calc(100vh - var(--sp-osk-h, 0px)); height: calc(100dvh - var(--sp-osk-h, 0px)); } }
@media (max-width: 991.98px) { body.sp-osk-open { padding-bottom: var(--sp-osk-h, 0px); } }
body.sp-osk-open .modal { height: calc(100% - var(--sp-osk-h, 0px)); }
body.sp-osk-open .offcanvas { bottom: var(--sp-osk-h, 0px); }
body.sp-osk-open .sp-toasts { bottom: calc(var(--sp-osk-h, 0px) + .75rem); }

/* ---- price & stock check (F5): search + matches on top (about 80 %), the chosen product large below (about 20 %) */
.sp-price-body { display: flex; flex-direction: column; gap: .6rem; height: min(76dvh, 720px); padding: .8rem; }
body.sp-osk-open .sp-price-body { height: min(calc(76dvh - var(--sp-osk-h, 0px)), 720px); min-height: 220px; }
.sp-price-top { flex: 4 1 0; min-height: 0; display: flex; flex-direction: column; gap: .55rem; }
.sp-price-results { flex: 1 1 auto; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .45rem; align-content: start; padding: 3px; }
.sp-price-hint { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: .5rem; padding: 1.2rem; color: var(--sp-text-muted); font-size: .92rem; }
.sp-price-item { position: relative; display: flex; align-items: center; gap: .55rem; padding: .4rem .55rem; text-align: left; border-radius: 10px; border: 1px solid var(--sp-card-border);
    background: var(--sp-surface); color: var(--sp-text); }
.sp-price-item:hover { background: var(--sp-hover); }
.sp-price-item.is-picked { border-color: var(--sp-primary); background: var(--sp-primary-soft); }
.sp-price-thumb { flex: 0 0 46px; height: 46px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--sp-surface-2); color: var(--sp-text-muted); font-weight: 800; }
.sp-price-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sp-price-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.sp-price-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.sp-price-meta small { color: var(--sp-text-muted); font-size: .72rem; }
.sp-price-amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.sp-price-detail { flex: 1 1 0; min-height: 92px; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.4rem; padding-top: .55rem; border-top: 2px solid var(--sp-border-strong); }
.sp-price-name { flex: 1 1 280px; min-width: 0; font-size: clamp(1.25rem, 2.6vw, 2.1rem); font-weight: 800; line-height: 1.15; color: var(--sp-text); }
.sp-price-name small { display: block; font-size: .78rem; font-weight: 600; color: var(--sp-text-muted); margin-top: .15rem; }
.sp-price-fig { text-align: right; }
.sp-price-fig small { display: block; font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--sp-text-muted); }
.sp-price-fig b { font-size: clamp(1.3rem, 2.8vw, 2.2rem); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--sp-text); }

/* ===================================================================== 24. Stage 20.1 premium POS (owner reference screenshot)
   Cart ~36 % / catalogue ~64 %, solid semantic action colours, category tabs, cart thumbnails, fixed-size product cards
   (6 / 5 / 3 columns), latest-scan green, restored-hold stock errors in red (red always wins over green). Tokens only. */
.sp-pos { grid-template-columns: minmax(350px, 36%) minmax(0, 1fr); gap: .65rem; }
.sp-pos-panel { border-color: var(--sp-card-border); border-radius: 12px; }
/* cart lines: thumbnail | name + meta | stepper | total + actions */
.sp-cart-lines { padding: .35rem; scrollbar-width: thin; scrollbar-color: var(--sp-border-strong) transparent; }
.sp-cart-lines::-webkit-scrollbar { width: 8px; } .sp-cart-lines::-webkit-scrollbar-thumb { background: var(--sp-border-strong); border-radius: 8px; }
.sp-line { grid-template-columns: 48px minmax(0, 1fr) auto auto; grid-template-areas: "thumb name qty total" "thumb meta qty acts"; gap: .05rem .55rem; min-height: 60px;
    padding: .35rem .5rem .35rem .4rem; border: 1px solid var(--sp-card-border); background: var(--sp-surface-raised); }
.sp-line + .sp-line { margin-top: 4px; }
.sp-line:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: -1px; }
.sp-line-thumb { grid-area: thumb; position: relative; width: 48px; height: 48px; border-radius: 9px; overflow: hidden; display: grid; place-items: center;
    background: color-mix(in srgb, var(--sp-primary) 8%, var(--sp-surface-2)); border: 1px solid var(--sp-card-border); }
.sp-line-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.sp-line-thumb span { display: none; font-weight: 900; font-size: .8rem; color: color-mix(in srgb, var(--sp-primary) 70%, var(--sp-text)); }
.sp-line-thumb.is-noimg span { display: block; }
.sp-line-name { font-size: .88rem; display: flex; align-items: center; gap: .35rem; }
.sp-line-seq { flex: 0 0 auto; padding: 0 .4rem; border-radius: 999px; font-size: .68rem; font-weight: 900; line-height: 1.5; background: var(--sp-tone-success); color: var(--sp-on-solid); }
.sp-line-qty { border-color: var(--sp-border-strong); border-radius: 9px; }
.sp-line-qty button { width: 28px; height: 30px; } .sp-line-qty input { width: 44px; height: 30px; }
.sp-line-total { font-size: .92rem; }
/* latest accepted scan: pale green + strong green bar, one short arrival pulse (no repeated flashing) */
.sp-line.is-latest { border-color: color-mix(in srgb, var(--sp-latest-border) 45%, var(--sp-card-border)); }
.sp-line.is-latest.is-selected { background: var(--sp-latest-bg); }
.sp-line.is-flash { animation: sp-arrive .32s var(--sp-ease); }
@keyframes sp-arrive { from { box-shadow: inset 4px 0 0 var(--sp-latest-border), 0 0 0 3px color-mix(in srgb, var(--sp-success) 40%, transparent); } }
/* restored held line whose stock is no longer available: red dominates (also over "latest") */
.sp-line.is-conflict, .sp-line.is-conflict.is-selected { background: var(--sp-stock-error-bg); border: 2px solid var(--sp-stock-error-border); box-shadow: inset 6px 0 0 var(--sp-stock-error-border); }
.sp-line.is-conflict .sp-line-name { color: var(--sp-stock-error-text); }
.sp-line.is-conflict .sp-line-qty { border: 2px solid var(--sp-stock-error-border); }
.sp-line.is-conflict.is-flash { animation: none; }
.sp-line-conflict { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; margin-top: .3rem; font-size: .75rem; font-weight: 700; color: var(--sp-stock-error-text); }
.sp-conflict-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border-radius: 6px; font-weight: 900; letter-spacing: .03em; background: var(--sp-tone-danger); color: var(--sp-on-solid); }
.sp-conflict-latest { padding: 0 .4rem; border-radius: 999px; font-size: .64rem; font-weight: 800; border: 1px solid var(--sp-stock-error-border); }
.sp-conflict-act { margin-left: auto; display: inline-flex; align-items: center; gap: .3rem; min-height: 30px; padding: .15rem .65rem; border-radius: 8px; font-weight: 800; font-size: .76rem;
    border: 2px solid var(--sp-stock-error-border); background: var(--sp-surface); color: var(--sp-stock-error-text); }
.sp-conflict-act.is-remove { background: var(--sp-tone-danger); border-color: var(--sp-tone-danger); color: var(--sp-on-solid); }
.sp-conflict-act:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: 2px; }
/* attention banner (stays above the scrolling lines) + blocked Pay */
.sp-attn { display: flex; align-items: center; gap: .5rem; margin: .4rem .45rem 0; padding: .45rem .55rem; border-radius: 10px; font-size: .8rem;
    background: var(--sp-stock-error-bg); border: 2px solid var(--sp-stock-error-border); color: var(--sp-stock-error-text); }
.sp-attn[hidden] { display: none; }
.sp-attn > .bi { font-size: 1.15rem; }
.sp-attn > span { flex: 1 1 auto; min-width: 0; } .sp-attn-first { font-weight: 600; }
.sp-attn-btn { flex: 0 0 auto; border: 0; border-radius: 8px; padding: .3rem .7rem; font-weight: 800; font-size: .78rem; background: var(--sp-tone-danger); color: var(--sp-on-solid); }
.sp-attn-btn:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: 2px; }
.sp-pay-block { grid-column: 1 / -1; padding: .25rem .5rem; border-radius: 8px; text-align: center; font-weight: 800; font-size: .78rem;
    background: var(--sp-stock-error-bg); color: var(--sp-stock-error-text); border: 1px solid var(--sp-stock-error-border); }
.sp-pay-block[hidden] { display: none; }
/* totals + grand total */
.sp-cart-totals { padding: .4rem .7rem .3rem; font-size: .82rem; }
.sp-grand { background: var(--sp-tone-success); color: var(--sp-on-solid); border-radius: 10px; }
.sp-grand span { opacity: .95; }
/* action buttons: solid semantic colours (yellow = hold / discount, blue = recent / print, green = customer / pay, violet = voucher, red = clear, slate = neutral) */
.sp-actions { gap: .3rem; padding: .4rem .5rem .5rem; }
.sp-act { --tone: var(--sp-tone-slate); --on: var(--sp-on-solid); background: var(--tone); color: var(--on); border: 1px solid var(--tone); border-radius: 10px; font-size: .78rem; font-weight: 800; }
.sp-act .bi { color: inherit; }
.sp-act:hover:not(:disabled) { background: var(--tone); filter: brightness(1.08); box-shadow: 0 6px 14px -8px var(--tone); }
.sp-act kbd { background: color-mix(in srgb, var(--on) 22%, transparent); border-color: color-mix(in srgb, var(--on) 35%, transparent); color: inherit; opacity: 1; }
.sp-act:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: 2px; }
.sp-act.t-hold, .sp-act.t-discount { --tone: var(--sp-tone-warning); --on: var(--sp-on-warning); }
.sp-act.t-recent, #act-print { --tone: var(--sp-tone-info); }
.sp-act.t-customer { --tone: var(--sp-tone-success); }
.sp-act.t-voucher { --tone: var(--sp-tone-violet); }
.sp-act.t-clear { --tone: var(--sp-tone-danger); }
#act-bill, #act-slip, .sp-act.t-help { --tone: var(--sp-tone-slate); }
.sp-act .sp-act-count { background: var(--sp-on-warning); color: var(--sp-tone-warning); }
.sp-act.is-pay { --tone: var(--sp-tone-success); background: var(--sp-tone-success); border-color: var(--sp-tone-success); color: var(--sp-on-solid); font-size: 1.05rem; }
.sp-act.is-pay.is-blocked { background: var(--sp-surface-2); border: 2px dashed var(--sp-stock-error-border); color: var(--sp-stock-error-text); box-shadow: none; filter: none; cursor: not-allowed; }
.sp-act.is-pay.is-blocked kbd { color: inherit; }
/* toolbar: solid Categories / Hold / Recent / Register / sound, outlined small tools */
.sp-tool.t-cats { background: var(--sp-tone-primary); border-color: var(--sp-tone-primary); color: var(--sp-on-solid); }
.sp-tool.t-held { background: var(--sp-tone-warning); border-color: var(--sp-tone-warning); color: var(--sp-on-warning); }
.sp-tool.t-recent { background: var(--sp-tone-teal); border-color: var(--sp-tone-teal); color: var(--sp-on-solid); }
.sp-tool.t-register { background: var(--sp-tone-slate); border-color: var(--sp-tone-slate); color: var(--sp-on-solid); }
.sp-tool.t-audio.is-on { background: var(--sp-tone-success); border-color: var(--sp-tone-success); color: var(--sp-on-solid); }
.sp-tool.t-cats .bi, .sp-tool.t-cats kbd, .sp-tool.t-recent .bi, .sp-tool.t-recent kbd, .sp-tool.t-register .bi, .sp-tool.t-audio.is-on .bi { color: inherit; }
.sp-tool.t-held .bi, .sp-tool.t-held kbd { color: inherit; }
.sp-tool.t-held .sp-tool-count { background: var(--sp-on-warning); color: var(--sp-tone-warning); }
.sp-tool:focus-visible, .sp-cat-tab:focus-visible, .sp-recent-chip:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: 2px; }
/* recent products: compact chips, cart quantity badge */
.sp-recent-row { flex: 0 0 auto; padding-bottom: 2px; scrollbar-width: thin; }
.sp-recent-chip { padding: .2rem .65rem; border-color: var(--sp-border-strong); font-weight: 700; text-transform: uppercase; font-size: .7rem; display: inline-flex; align-items: center; gap: .35rem; }
.sp-recent-chip.is-in-cart { border-color: var(--sp-tone-success); }
.sp-recent-qty { padding: 0 .35rem; border-radius: 999px; background: var(--sp-tone-success); color: var(--sp-on-solid); font-size: .66rem; font-weight: 900; }
/* category tabs */
.sp-cat-tabs { flex: 0 0 auto; display: flex; gap: .4rem; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; }
.sp-cat-tabs:empty { display: none; }
.sp-cat-tab { flex: 1 0 auto; min-width: 118px; height: 42px; padding: 0 .9rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border-radius: 10px;
    border: 1px solid var(--sp-card-border); background: var(--sp-surface-raised); color: var(--sp-text); font-weight: 800; font-size: .86rem; white-space: nowrap; box-shadow: var(--sp-shadow-sm); }
.sp-cat-tab .bi { font-size: 1.05rem; color: var(--sp-text-muted); }
.sp-cat-tab:hover { border-color: var(--sp-tone-success); }
.sp-cat-tab.is-active { background: var(--sp-tone-success); border-color: var(--sp-tone-success); color: var(--sp-on-solid); }
.sp-cat-tab.is-active .bi { color: inherit; }
/* product cards: same size with or without a photo; name max 2 lines; price lower left, stock lower right */
.sp-pos { --sp-cols: 5; --sp-tile-h: 172px; }
.sp-grid { grid-template-columns: repeat(var(--sp-cols), minmax(0, 1fr)); grid-auto-rows: var(--sp-tile-h); gap: .5rem; }
.sp-tile { border-radius: 12px; background: var(--sp-surface-raised); }
.sp-tile-media { flex: 1 1 auto; min-height: 0; background: var(--sp-surface-2); }
.sp-tile-body { flex: 0 0 64px; height: 64px; padding: .35rem .5rem .4rem; background: var(--sp-surface-raised); }
.sp-tile-name { font-weight: 800; font-size: .82rem; line-height: 1.2; min-height: 2.4em; }
.sp-tile-price { color: color-mix(in srgb, var(--sp-success) 72%, var(--sp-text)); font-size: .86rem; }
.sp-tile-initials { font-size: 1.6rem; }
.sp-tile.is-out { opacity: .72; } .sp-tile.is-out .sp-tile-name { color: var(--sp-text-muted); }
@media (min-width: 1600px) { .sp-pos { --sp-cols: 6; --sp-tile-h: 206px; } }
@media (max-width: 1599.98px) and (min-width: 1200px) { .sp-pos { --sp-cols: 5; --sp-tile-h: 168px; } }
@media (max-width: 1199.98px) { .sp-pos { --sp-cols: 3; --sp-tile-h: 162px; grid-template-columns: minmax(340px, 40%) minmax(0, 1fr); } .sp-cat-tab { min-width: 96px; height: 38px; font-size: .8rem; } }
@media (max-height: 800px) and (min-width: 992px) { .sp-held-strip { display: none; } }   /* short screens: the Held button (count) opens the bills */
/* 20.1 density at 1366 × 768 and below: one toolbar row, compact actions, one-line conflict strip and banner (more cart lines visible) */
.sp-cat-toolbar { flex-wrap: nowrap; gap: .4rem; }
.sp-cat-toolbar .sp-search { flex: 1 1 180px; min-width: 150px; }
.sp-attn > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-attn { padding: .35rem .5rem; }
.sp-hold-active { padding: .2rem .55rem; }
.sp-line-conflict { flex-wrap: nowrap; gap: .4rem; }
.sp-conflict-why { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-conflict-why.is-reason { flex: 1 1 100%; order: 3; white-space: normal; }   /* Stage 20.2: a blocked deal's reason is a sentence — wrap it */
.sp-conflict-act { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 1599.98px) {
    .sp-tool { padding: 0 .6rem; }
    .sp-tool.is-compact { padding: 0; width: 40px; justify-content: center; }
    .sp-tool.t-recent .sp-tool-label, .sp-tool.t-register .sp-tool-label { display: none; }
    .sp-conflict-latest { display: none; }
}
@media (max-height: 820px) and (min-width: 992px) {
    .sp-act { min-height: 40px; font-size: .72rem; } .sp-act .bi { font-size: 1rem; }
    .sp-act.is-pay { min-height: 46px; }
    .sp-cart-head { padding: .45rem .55rem; gap: .35rem; }
    .sp-cart-totals { padding: .3rem .7rem .25rem; }
    .sp-grand { padding: .4rem .8rem; } .sp-grand strong { font-size: 1.35rem; }
}
/* blocked Pay says why on the button itself (the separate status line stays for screen readers only) */
.sp-pay-block { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; border: 0; }
.sp-act.is-pay.is-blocked > span, .sp-act.is-pay.is-blocked > kbd { display: none; }
.sp-act.is-pay.is-blocked::after { content: attr(data-block); font-size: .84rem; font-weight: 800; }
.sp-conflict-badge { white-space: nowrap; }
@media (max-width: 1279.98px) {
    .sp-line { grid-template-columns: 40px minmax(0, 1fr) auto auto; grid-template-areas: "thumb name name total" "thumb meta qty acts"; min-height: 52px; }
    .sp-line-thumb { width: 40px; height: 40px; }
    .sp-conflict-latest { display: none; }
    .sp-line-conflict { font-size: .7rem; } .sp-conflict-act { padding: .1rem .5rem; font-size: .72rem; min-height: 28px; }
}
/* small tools (Items, Price check, Approvals, Keyboard) stay icons with a corner key tag on every desktop width, so the toolbar keeps one row */
@media (max-width: 2199.98px) {
    .sp-tool.is-compact { padding: 0; width: 42px; justify-content: center; }
    .sp-tool.is-compact .sp-tool-label { display: none; }
    .sp-tool.is-compact kbd:not([hidden]) { position: absolute; top: -7px; right: -5px; padding: 0 3px; font-size: .52rem; line-height: 1.5;
        background: var(--sp-surface); color: var(--sp-text-muted); border-color: var(--sp-border-strong); }
}
/* on-screen keyboard open: the subtotal rows give way (grand total, banner, actions and Pay stay above the keyboard) */
body.sp-osk-open .sp-cart-totals { display: none; }
body.sp-osk-open .sp-hold-active { display: none; }

/* ===================================================================== 25. Stage 20.2 premium split checkout (all colours from tokens)
   Ten neutral actions — colour lives only in the outline icon and a slim left accent line — beside one emerald Pay block
   that spans both rows. Each accent is a fixed hue pulled towards the theme's text colour, so it is darker on light presets
   and lighter on dark ones (Midnight) and keeps contrast everywhere without a per-theme override. */
.sp-pos .sp-grand { background: color-mix(in srgb, var(--sp-success) 9%, var(--sp-surface)); color: var(--sp-text); border: 1px solid color-mix(in srgb, var(--sp-success) 30%, var(--sp-card-border)); }
.sp-pos .sp-grand span { opacity: 1; color: var(--sp-text-muted); }
.sp-pos .sp-grand strong { color: color-mix(in srgb, var(--sp-success) 70%, var(--sp-text)); }
.sp-checkout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(132px, 30%, 210px); gap: .4rem; margin: .4rem .55rem .55rem; padding: .4rem;
    background: var(--sp-tray-bg); border: 1px solid var(--sp-tray-border); border-radius: 12px; box-shadow: var(--sp-shadow-sm); }
.sp-checkout .sp-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: .3rem; padding: 0; }
.sp-pos .sp-act:not(.is-pay) { --acc: var(--sp-acc-help); background: var(--sp-surface); color: var(--sp-text); border: 1px solid var(--sp-card-border);
    border-left: 3px solid var(--acc); border-radius: 8px; font-size: .74rem; font-weight: 700; min-height: clamp(42px, 5.6dvh, 50px); padding: .3rem .15rem .2rem; gap: 2px; box-shadow: none; filter: none; }
.sp-pos .sp-act:not(.is-pay) .bi { color: var(--acc); font-size: 1.05rem; }
.sp-pos .sp-act:not(.is-pay) .sp-act-label { line-height: 1.1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sp-pos .sp-act:not(.is-pay) kbd { position: absolute; top: 2px; right: 3px; font-size: .52rem; padding: 0 3px; line-height: 1.45; background: var(--sp-surface-2); color: var(--sp-text-muted);
    border: 1px solid var(--sp-border); border-radius: 4px; opacity: 1; }
.sp-pos .sp-act:not(.is-pay):hover:not(:disabled) { background: color-mix(in srgb, var(--acc) 7%, var(--sp-surface)); border-color: color-mix(in srgb, var(--acc) 40%, var(--sp-card-border)); border-left-color: var(--acc); transform: none; box-shadow: none; filter: none; }
.sp-pos .sp-act:not(.is-pay):focus-visible { outline: 2px solid var(--sp-focus); outline-offset: 1px; }
/* same specificity as the neutral base rule above and later in the file, so each action keeps its own accent */
.sp-pos .sp-act.a-hold { --acc: var(--sp-acc-hold); } .sp-pos .sp-act.a-recent { --acc: var(--sp-acc-recent); } .sp-pos .sp-act.a-discount { --acc: var(--sp-acc-discount); }
.sp-pos .sp-act.a-customer { --acc: var(--sp-acc-customer); } .sp-pos .sp-act.a-voucher { --acc: var(--sp-acc-voucher); } .sp-pos .sp-act.a-review { --acc: var(--sp-acc-review); }
.sp-pos .sp-act.a-slip { --acc: var(--sp-acc-slip); } .sp-pos .sp-act.a-print { --acc: var(--sp-acc-print); } .sp-pos .sp-act.a-clear { --acc: var(--sp-acc-clear); } .sp-pos .sp-act.a-help { --acc: var(--sp-acc-help); }
.sp-pos .sp-act .sp-act-count { background: var(--sp-acc-hold); color: var(--sp-surface); top: -6px; left: -5px; }
/* Pay: one emerald block spanning both rows; the payable amount is the largest figure in the tray */
.sp-checkout .sp-act.is-pay { grid-column: 2; grid-row: 1; height: 100%; min-height: 0; margin: 0; flex-direction: column; align-items: stretch; justify-content: center; gap: .15rem;
    padding: .45rem .6rem; border-radius: 10px; background: var(--sp-pay-bg); border: 1px solid var(--sp-pay-bg); color: var(--sp-pay-text); text-align: left; box-shadow: 0 6px 16px -10px var(--sp-pay-bg); }
.sp-checkout .sp-act.is-pay:hover:not(:disabled) { background: var(--sp-pay-bg); filter: brightness(1.07); transform: none; }
.sp-act.is-pay .sp-pay-top { display: flex; align-items: center; gap: .4rem; font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.sp-act.is-pay .sp-pay-top .bi { font-size: 1.1rem; color: inherit; }
.sp-act.is-pay .sp-pay-amount { font-size: clamp(1.05rem, 1.55vw, 1.45rem); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-act.is-pay kbd { position: static; align-self: flex-start; font-size: .6rem; padding: 0 4px; background: color-mix(in srgb, var(--sp-pay-text) 20%, transparent);
    border: 1px solid color-mix(in srgb, var(--sp-pay-text) 35%, transparent); color: var(--sp-pay-text); }
.sp-checkout .sp-act.is-pay.is-blocked { background: var(--sp-stock-error-bg); border: 2px dashed var(--sp-stock-error-border); color: var(--sp-stock-error-text); box-shadow: none; filter: none; }
.sp-checkout .sp-act.is-pay.is-blocked > span, .sp-checkout .sp-act.is-pay.is-blocked > kbd { display: none; }
.sp-checkout .sp-act.is-pay.is-blocked::after { content: attr(data-block); font-size: .76rem; font-weight: 800; white-space: normal; text-align: center; }
.sp-checkout .sp-pay-block { grid-column: 1 / -1; }
@media (max-height: 820px) and (min-width: 992px) {
    .sp-pos .sp-act:not(.is-pay) { min-height: 38px; font-size: .7rem; padding-top: .25rem; } .sp-pos .sp-act:not(.is-pay) .bi { font-size: .95rem; }
    .sp-checkout { margin-top: .3rem; padding: .3rem; gap: .3rem; }
}
@media (max-width: 1279.98px) {
    .sp-checkout { grid-template-columns: minmax(0, 1fr) clamp(118px, 28%, 170px); }
    .sp-pos .sp-act:not(.is-pay) { font-size: .66rem; } .sp-pos .sp-act:not(.is-pay) kbd { display: none; }
}
/* product cards: identical size with or without a photo; real photos cover the frame, missing ones get a calm neutral plate */
.sp-tile-media.is-noimg { background: linear-gradient(135deg, var(--sp-surface-2), color-mix(in srgb, var(--sp-primary) 6%, var(--sp-surface-2))); }
.sp-tile-fg { object-fit: cover; }/* Stage 20.2 layout: cart ≈ 38–40 % (room for the ten labelled actions), catalogue takes the rest */
.sp-pos { grid-template-columns: minmax(380px, 39%) minmax(0, 1fr); }
@media (min-width: 1600px) { .sp-pos { grid-template-columns: minmax(380px, 37%) minmax(0, 1fr); } }
@media (max-width: 1199.98px) { .sp-pos { grid-template-columns: minmax(360px, 40%) minmax(0, 1fr); } }
.sp-checkout { grid-template-columns: minmax(0, 1fr) clamp(118px, 26%, 200px); }
.sp-pos .sp-act:not(.is-pay) .sp-act-label { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .7rem; }/* Stage 20.2: cart converting goods out on approval (linked to the challan) */
.sp-appr-mode { display: flex; align-items: flex-start; gap: .45rem; margin: .35rem .55rem 0; padding: .4rem .6rem; border-radius: 10px; font-size: .78rem;
    background: color-mix(in srgb, var(--sp-acc-voucher) 10%, var(--sp-surface)); border: 1px solid color-mix(in srgb, var(--sp-acc-voucher) 40%, var(--sp-card-border)); color: var(--sp-text); }
.sp-appr-mode[hidden] { display: none; }
.sp-appr-mode .bi { color: var(--sp-acc-voucher); font-size: 1rem; line-height: 1.2; }
.sp-line-meta .is-appr { color: var(--sp-acc-voucher); font-weight: 700; }.sp-checkout { grid-template-columns: minmax(0, 1fr) clamp(128px, 28%, 210px); }
.sp-act.is-pay .sp-pay-amount { text-overflow: clip; }   /* never "…": fitPayAmount() scales it down instead *//* below 1280 px the cart is too narrow for actions + a side Pay block: actions take the full tray width (5 × 2) and the emerald Pay
   block becomes a full-width bar under them; the scrolling cart list gives up the height, so Pay stays on screen */
@media (max-width: 1279.98px) {
    .sp-checkout { grid-template-columns: minmax(0, 1fr); }
    .sp-checkout .sp-act.is-pay { grid-column: 1; grid-row: auto; flex-direction: row; align-items: center; justify-content: space-between; min-height: 44px; padding: .35rem .7rem; }
    .sp-act.is-pay .sp-pay-amount { flex: 1 1 auto; text-align: right; }
    .sp-pos .sp-act:not(.is-pay) { min-height: 38px; }
}

/* ===================================================================== 26. Stage 20.3 (all colours from tokens)
   Return sale + Temporary items join the tray (two rows; JS sets the column count from the visible actions), the Return Sale
   window, the scanned voucher card in the payment window and the approval money summary. */
.sp-pos .sp-act[hidden] { display: none !important; }
.sp-pos .sp-act.a-return { --acc: var(--sp-acc-return); } .sp-pos .sp-act.a-temp { --acc: var(--sp-acc-temp); }
.sp-pos .sp-act.a-temp .sp-act-count { background: var(--sp-danger); color: var(--sp-surface); }
.sp-ret-totals { border: 1px solid var(--sp-card-border); border-radius: 10px; padding: .6rem .75rem; background: var(--sp-surface-2); }
.sp-ret-row { display: flex; justify-content: space-between; gap: .75rem; padding: .12rem 0; font-variant-numeric: tabular-nums; }
.sp-ret-row.is-total { border-top: 1px solid var(--sp-border); margin-top: .2rem; padding-top: .3rem; font-weight: 700; }
.sp-ret-row.is-voucher { font-size: 1.05rem; font-weight: 800; color: color-mix(in srgb, var(--sp-acc-voucher) 85%, var(--sp-text)); }
.sp-voucher-card { border: 1px solid color-mix(in srgb, var(--sp-success) 40%, var(--sp-card-border)); background: color-mix(in srgb, var(--sp-success) 7%, var(--sp-surface));
    border-radius: 10px; padding: .45rem .6rem; color: var(--sp-text); }
.sp-vc-head { display: flex; align-items: baseline; gap: .35rem; } .sp-vc-head .bi { color: var(--sp-success); }
.sp-vc-grid { display: grid; grid-template-columns: auto 1fr; gap: .05rem .75rem; margin: .3rem 0; font-size: .85rem; font-variant-numeric: tabular-nums; }
.sp-vc-grid b { text-align: right; } .sp-vc-grid .is-applied { color: color-mix(in srgb, var(--sp-success) 75%, var(--sp-text)); }
.sp-appr-money { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.sp-appr-money > div { border: 1px solid var(--sp-card-border); border-radius: 10px; padding: .45rem .6rem; background: var(--sp-surface-2); display: flex; flex-direction: column; }
.sp-appr-money span { font-size: .75rem; color: var(--sp-text-muted); } .sp-appr-money b { font-size: 1.05rem; font-variant-numeric: tabular-nums; } .sp-appr-money small { color: var(--sp-text-muted); }
#appr-body tr.is-overdue > td:first-child { box-shadow: inset 3px 0 0 var(--sp-danger); }
.sp-label-preview { min-height: 220px; max-height: 70vh; overflow: auto; background: var(--sp-surface-2); border-radius: 8px; }
.sp-label-preview iframe { width: 100%; min-height: 420px; border: 0; background: var(--sp-surface); }
.sp-receipt-preview { border: 1px dashed var(--sp-border); border-radius: 8px; padding: .5rem .75rem; min-height: 2.5rem; text-align: center; white-space: pre-line;
    background: var(--sp-surface); color: var(--sp-text); font-family: "Courier New", monospace; font-size: .85rem; }
.sp-receipt-preview .sp-msg-tenant { font-weight: 700; } .sp-receipt-preview .sp-msg-platform { font-size: .8rem; color: var(--sp-text-muted); margin-top: .2rem; }
/* Stage 20.3 Reports Center: groups, subtotals, drill-down, print header + page numbers */
.table tr.sp-group-row > td { background: var(--sp-surface-2); font-weight: 800; }
.table tr.sp-subtotal-row > td { font-weight: 700; border-top: 1px solid var(--sp-table-row-border); background: color-mix(in srgb, var(--sp-primary) 4%, var(--sp-surface)); }
.table tr.sp-total-row > td { font-weight: 800; border-top: 2px solid var(--sp-table-row-border); }
.sp-drill { color: var(--sp-primary); text-decoration: none; font-weight: 600; } .sp-drill:hover { text-decoration: underline; }
.sp-report-print-head { display: none; }
@media print {
    .sp-report-print-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid black; padding-bottom: 2mm; margin-bottom: 3mm; color: black; }
    @page { margin: 12mm 10mm 14mm; @bottom-right { content: "Page " counter(page) " of " counter(pages); font-size: 9pt; } @bottom-left { content: "SalePoint365 report"; font-size: 9pt; } }
    .sp-drill { color: black; font-weight: 400; }
}
/* ===================================================================== 27. Stage 20.4 premium POS visual hierarchy (tokens only)
   Six recognisable work areas: CURRENT BILL (left) · search / scanner COMMAND band · HELD BILLS strip · RECENT ITEMS strip ·
   CATEGORIES strip · PRODUCTS grid. Royal-blue section headers with white text (--pos-section-header*), clean white panels,
   restrained borders, one coherent command dock with a dominant green Pay bar. Every colour is a --pos-* / --sp-* token, so each
   preset (Ocean, Midnight, …) keeps the same hierarchy. Rules are prefixed with body.sp-pos-page so they win over sections 14–26. */
body.sp-pos-page .app-main { background: var(--pos-canvas); }
body.sp-pos-page .sp-pos { grid-template-columns: minmax(400px, 40%) minmax(0, 1fr); gap: .6rem; }
@media (min-width: 1600px) { body.sp-pos-page .sp-pos { grid-template-columns: minmax(440px, 36%) minmax(0, 1fr); } }

/* ---- shared: blue zone header strip */
body.sp-pos-page .sp-zone-head { flex: 0 0 auto; display: flex; align-items: center; gap: .35rem .6rem; min-height: 40px; padding: .4rem .75rem; min-width: 0;
    background: linear-gradient(135deg, var(--pos-section-header), var(--pos-section-header-2)); color: var(--pos-section-header-text); }
body.sp-pos-page .sp-zone-title { display: inline-flex; align-items: center; gap: .45rem; font-weight: 800; font-size: .88rem; letter-spacing: .01em; white-space: nowrap; }
body.sp-pos-page .sp-zone-head .bi { color: inherit; }
body.sp-pos-page .sp-zone-info { margin-left: auto; font-size: .74rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ---- 1. CURRENT BILL panel */
body.sp-pos-page .sp-pos-panel.is-cart { background: var(--pos-panel-bg); border: 1px solid var(--pos-panel-border); border-radius: 12px; overflow: hidden; box-shadow: var(--sp-shadow); }
body.sp-pos-page .sp-zone-head.is-bill { flex-wrap: nowrap; }
body.sp-pos-page .sp-zone-head.is-bill .sp-cart-meta { flex-wrap: nowrap; overflow: hidden; }
body.sp-pos-page .sp-zone-head .sp-cart-meta .sp-order-no { flex: 0 0 auto; }
@media (max-width: 1599.98px) { body.sp-pos-page .sp-zone-head #pos-branch-wrap { display: none; } }   /* the branch is already in the page header */
body.sp-pos-page .sp-zone-head .sp-cart-meta { flex: 1 1 auto; justify-content: flex-end; gap: .2rem .6rem; font-size: .74rem; color: var(--pos-section-header-text); min-width: 0; }
body.sp-pos-page .sp-zone-head .sp-cart-meta > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
body.sp-pos-page .sp-zone-head .sp-cart-meta .is-open, body.sp-pos-page .sp-zone-head .sp-cart-meta .is-closed { color: inherit; }
body.sp-pos-page .sp-zone-head .sp-order-no { padding: .05rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 800; color: inherit;
    background: var(--pos-on-header-soft); border: 1px solid var(--pos-on-header-line); }
body.sp-pos-page .sp-zone-head .form-select { height: 26px; padding-top: 0; padding-bottom: 0; font-size: .74rem; }
body.sp-pos-page .sp-cart-head { padding: .5rem .6rem; gap: .4rem; background: var(--pos-cart-head-bg); border-bottom: 1px solid var(--pos-cart-line-border); }
body.sp-pos-page .sp-cart-head .form-control { height: 40px; border-color: var(--sp-border-strong); }
/* column captions, receipt style */
body.sp-pos-page .sp-lines-head { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 104px 86px; column-gap: .55rem; padding: .28rem .75rem;
    font-size: .64rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--sp-table-head-text); background: var(--sp-table-head-bg);
    border-bottom: 1px solid var(--pos-cart-line-border); }
body.sp-pos-page .sp-lines-head > span:nth-child(2) { text-align: center; } body.sp-pos-page .sp-lines-head > span:nth-child(3) { text-align: right; }
/* lines: one row per item, separated like a receipt (no floating cards) */
body.sp-pos-page .sp-cart-lines { padding: 0; background: var(--pos-panel-bg); }
body.sp-pos-page .sp-line { grid-template-columns: 44px minmax(0, 1fr) 104px 86px; grid-template-areas: "thumb name qty total" "thumb meta qty acts"; column-gap: .55rem; row-gap: .1rem;
    min-height: 58px; margin: 0; padding: .42rem .75rem; border: 0; border-bottom: 1px solid var(--pos-cart-line-border); border-radius: 0; background: var(--pos-panel-bg); box-shadow: none; }
body.sp-pos-page .sp-line + .sp-line { margin-top: 0; }
body.sp-pos-page .sp-line:hover { background: var(--pos-command-hover); }
body.sp-pos-page .sp-line.is-selected { background: var(--sp-primary-soft); box-shadow: inset 4px 0 0 var(--sp-primary); }
body.sp-pos-page .sp-line.is-latest, body.sp-pos-page .sp-line.is-latest.is-selected { background: var(--pos-latest-bg); box-shadow: inset 5px 0 0 var(--pos-latest-edge); }
body.sp-pos-page .sp-line:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: -3px; }
body.sp-pos-page .sp-line-thumb { width: 44px; height: 44px; border-radius: 8px; border-color: var(--pos-cart-line-border); }
body.sp-pos-page .sp-line-name { font-size: .9rem; font-weight: 800; color: var(--sp-text); }
body.sp-pos-page .sp-line-seq { padding: 0 .38rem; font-size: .66rem; background: var(--sp-tone-success); color: var(--sp-on-solid); }
body.sp-pos-page .sp-line-meta { font-size: .72rem; color: var(--sp-text-muted); gap: .1rem .55rem; }
body.sp-pos-page .sp-line-qty { justify-self: center; border: 1px solid var(--sp-border-strong); border-radius: 9px; background: var(--sp-surface-2); }
body.sp-pos-page .sp-line-qty button { width: 30px; height: 32px; color: var(--sp-text); }
body.sp-pos-page .sp-line-qty input { width: 40px; height: 32px; background: var(--sp-surface); font-size: .92rem; }
body.sp-pos-page .sp-line-total { font-size: .95rem; font-weight: 900; color: var(--sp-text); }
body.sp-pos-page .sp-line-acts button { width: 26px; height: 24px; }
/* restored held line that is no longer available: red always wins (pinned on top by the till) */
body.sp-pos-page .sp-line.is-conflict, body.sp-pos-page .sp-line.is-conflict.is-selected { margin: 5px 6px; border: 2px solid var(--pos-danger-edge); border-radius: 9px;
    background: var(--pos-danger-bg); box-shadow: inset 6px 0 0 var(--pos-danger-edge); }
body.sp-pos-page .sp-line.is-conflict .sp-line-name { color: var(--sp-stock-error-text); }
body.sp-pos-page .sp-line.is-conflict .sp-line-seq { background: var(--sp-tone-danger); }
/* totals: six labelled cells, then the grand total */
body.sp-pos-page .sp-cart-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0; padding: 0; font-size: .8rem;
    background: var(--pos-cart-line-border); border-top: 1px solid var(--pos-cart-line-border); border-bottom: 1px solid var(--pos-cart-line-border); }
body.sp-pos-page .sp-tot { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; min-width: 0; padding: .3rem .65rem; background: var(--pos-panel-bg); }
body.sp-pos-page .sp-tot dt { font-size: .68rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--sp-text-muted); white-space: nowrap; }
body.sp-pos-page .sp-tot dt button { font-weight: 700; text-transform: uppercase; color: color-mix(in srgb, var(--sp-primary) 80%, var(--sp-text)); }
body.sp-pos-page .sp-tot dd { font-size: .9rem; font-weight: 800; color: var(--sp-text); white-space: nowrap; }
body.sp-pos-page .sp-tot.is-disc dd { color: var(--pos-grand-text); }
body.sp-pos-page .sp-tot dd.is-due { color: var(--sp-danger-text); }
body.sp-pos-page .sp-grand { margin: .45rem .6rem 0; padding: .4rem .8rem; border-radius: 10px; background: var(--pos-grand-bg); color: var(--sp-text);
    border: 1px solid color-mix(in srgb, var(--sp-success) 40%, var(--pos-panel-border)); }
body.sp-pos-page .sp-grand span { color: var(--sp-text-muted); font-size: .74rem; letter-spacing: .08em; }
body.sp-pos-page .sp-grand strong { font-size: 1.5rem; color: var(--pos-grand-text); }
body.sp-pos-page .sp-pay-inline { margin: .35rem .6rem 0; }

/* ---- checkout block (owner-approved direction, 17 Nov): two-column summary, strong green Grand Total, a compact colourful 6 × 2 action
   grid (each action its own rich colour, outline icon, label, shortcut capsule) and a full-width deep-emerald Pay bar. Colours come only
   from the --pos-act-* / --pos-grand-* / --pos-pay-* tokens (light presets share the light map; Midnight has its own map). */
body.sp-pos-page .sp-cart-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, auto); grid-auto-flow: column; }
body.sp-pos-page .sp-tot { align-items: center; padding: .22rem .7rem; }
body.sp-pos-page .sp-tot dd { font-size: .92rem; }
body.sp-pos-page .sp-grand { margin: .45rem .6rem 0; padding: .38rem .85rem; border-radius: 7px; background: var(--pos-grand-solid); color: var(--pos-grand-solid-text);
    border: 1px solid var(--pos-grand-solid-edge); box-shadow: inset 0 1px 0 var(--pos-act-highlight), 0 3px 8px -5px var(--pos-grand-solid-edge); }
body.sp-pos-page .sp-grand span { color: inherit; opacity: .92; font-size: .76rem; letter-spacing: .09em; }
body.sp-pos-page .sp-grand strong { color: inherit; font-size: 1.45rem; }
body.sp-pos-page .sp-checkout { grid-template-columns: minmax(0, 1fr); gap: .4rem; margin: .45rem .6rem .6rem; padding: .4rem; border-radius: 8px;
    background: var(--pos-dock-bg); border: 1px solid var(--pos-dock-border); box-shadow: 0 1px 3px var(--sp-shade); }
body.sp-pos-page .sp-checkout .sp-actions { gap: 5px; }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay) { position: relative; flex-direction: column; justify-content: center; align-items: center; gap: 2px; min-height: 48px; padding: .35rem .2rem .3rem;
    border-radius: 6px; background: var(--act-bg, var(--pos-act-help-bg)); color: var(--act-fg, var(--pos-act-help-fg)); border: 1px solid var(--act-edge, var(--pos-act-edge));
    box-shadow: inset 0 1px 0 var(--pos-act-highlight), 0 1px 2px var(--sp-shade); font-size: .72rem; font-weight: 800; letter-spacing: .01em; filter: none;
    transition: transform .08s, box-shadow .12s, filter .12s; }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay) .bi { width: auto; height: 19px; display: grid; place-items: center; font-size: 1.12rem; line-height: 1; color: inherit; background: none; }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay) .sp-act-label { font-size: .72rem; line-height: 1.12; text-align: center; color: inherit; }
/* shortcut: a small translucent capsule, secondary to the label */
body.sp-pos-page .sp-pos .sp-act:not(.is-pay) kbd { display: inline-block; position: absolute; top: 3px; right: 3px; padding: 0 4px; font-size: .54rem; font-weight: 700; line-height: 1.5;
    border-radius: 999px; color: inherit; background: color-mix(in srgb, var(--act-fg, var(--pos-act-help-fg)) 20%, transparent);
    border: 1px solid color-mix(in srgb, var(--act-fg, var(--pos-act-help-fg)) 32%, transparent); box-shadow: none; opacity: .95; }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay):hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.07); box-shadow: inset 0 1px 0 var(--pos-act-highlight), 0 4px 8px -4px var(--sp-shade); }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay):active:not(:disabled) { transform: translateY(0); filter: brightness(.93); box-shadow: inset 0 2px 3px var(--pos-act-press); }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay):focus-visible { outline: 3px solid var(--pos-focus-strong); outline-offset: 2px; z-index: 2; }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay):disabled, body.sp-pos-page .sp-pos .sp-act:not(.is-pay)[aria-disabled="true"] { opacity: .45; filter: grayscale(.55); transform: none; box-shadow: none; cursor: not-allowed; }
/* counts (Hold, Temporary items) and the credit-applied tick (Voucher) */
body.sp-pos-page .sp-pos .sp-act .sp-act-count { position: absolute; top: -7px; left: -5px; z-index: 3; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
    font-size: .64rem; font-weight: 900; background: var(--pos-act-count-bg); color: var(--pos-act-count-fg); border: 2px solid var(--pos-dock-bg); box-shadow: 0 1px 3px var(--sp-shade); }
body.sp-pos-page .sp-pos .sp-act.a-voucher.is-applied::after { content: '✓ Applied'; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); z-index: 3; padding: 0 6px;
    border-radius: 999px; font-size: .56rem; font-weight: 900; line-height: 1.55; white-space: nowrap; background: var(--pos-act-count-bg); color: var(--pos-act-voucher-bg); border: 2px solid var(--pos-dock-bg); }
body.sp-pos-page .sp-pos .sp-act.a-voucher.is-applied { box-shadow: inset 0 1px 0 var(--pos-act-highlight), 0 0 0 2px var(--pos-dock-bg), 0 0 0 4px var(--pos-act-voucher-bg); }
/* one colour per action (bg / text pairs from the tokens) */
body.sp-pos-page .sp-pos .sp-act.a-hold { --act-bg: var(--pos-act-hold-bg); --act-fg: var(--pos-act-hold-fg); }
body.sp-pos-page .sp-pos .sp-act.a-recent { --act-bg: var(--pos-act-recent-bg); --act-fg: var(--pos-act-recent-fg); }
body.sp-pos-page .sp-pos .sp-act.a-return { --act-bg: var(--pos-act-return-bg); --act-fg: var(--pos-act-return-fg); }
body.sp-pos-page .sp-pos .sp-act.a-discount { --act-bg: var(--pos-act-discount-bg); --act-fg: var(--pos-act-discount-fg); }
body.sp-pos-page .sp-pos .sp-act.a-customer { --act-bg: var(--pos-act-customer-bg); --act-fg: var(--pos-act-customer-fg); }
body.sp-pos-page .sp-pos .sp-act.a-voucher { --act-bg: var(--pos-act-voucher-bg); --act-fg: var(--pos-act-voucher-fg); }
body.sp-pos-page .sp-pos .sp-act.a-temp { --act-bg: var(--pos-act-temp-bg); --act-fg: var(--pos-act-temp-fg); }
body.sp-pos-page .sp-pos .sp-act.a-review { --act-bg: var(--pos-act-review-bg); --act-fg: var(--pos-act-review-fg); }
body.sp-pos-page .sp-pos .sp-act.a-slip { --act-bg: var(--pos-act-slip-bg); --act-fg: var(--pos-act-slip-fg); }
body.sp-pos-page .sp-pos .sp-act.a-print { --act-bg: var(--pos-act-print-bg); --act-fg: var(--pos-act-print-fg); }
body.sp-pos-page .sp-pos .sp-act.a-clear { --act-bg: var(--pos-act-clear-bg); --act-fg: var(--pos-act-clear-fg); }
body.sp-pos-page .sp-pos .sp-act.a-help { --act-bg: var(--pos-act-help-bg); --act-fg: var(--pos-act-help-fg); }
/* Pay & complete: the strongest control — deep emerald, icon + label left, PKR amount + Ctrl+Enter right, a subtle top highlight, no gradient */
body.sp-pos-page .sp-checkout .sp-act.is-pay { grid-column: 1; grid-row: auto; flex-direction: row; align-items: center; justify-content: space-between; gap: .6rem;
    height: auto; min-height: 50px; margin: 0; padding: .35rem .9rem; border-radius: 7px; text-align: left; filter: none;
    background: var(--pos-pay-bg); color: var(--pos-pay-fg); border: 1px solid var(--pos-pay-edge); box-shadow: inset 0 1px 0 var(--pos-act-highlight), 0 4px 10px -6px var(--pos-pay-edge); }
body.sp-pos-page .sp-checkout .sp-act.is-pay .sp-pay-top { font-size: .9rem; letter-spacing: .05em; }
body.sp-pos-page .sp-checkout .sp-act.is-pay .sp-pay-top .bi { font-size: 1.35rem; }
body.sp-pos-page .sp-checkout .sp-act.is-pay .sp-pay-amount { flex: 1 1 auto; text-align: right; font-size: 1.5rem; }
body.sp-pos-page .sp-checkout .sp-act.is-pay kbd { border-radius: 999px; padding: 0 6px; background: color-mix(in srgb, var(--pos-pay-fg) 18%, transparent); border-color: color-mix(in srgb, var(--pos-pay-fg) 35%, transparent); }
body.sp-pos-page .sp-checkout .sp-act.is-pay:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
body.sp-pos-page .sp-checkout .sp-act.is-pay:active { transform: translateY(0); filter: brightness(.95); box-shadow: inset 0 2px 4px var(--pos-act-press); }
body.sp-pos-page .sp-checkout .sp-act.is-pay:focus-visible { outline: 3px solid var(--pos-focus-strong); outline-offset: 2px; }
body.sp-pos-page .sp-checkout .sp-act.is-pay.is-blocked { background: var(--pos-danger-bg); border: 2px dashed var(--pos-danger-edge); color: var(--sp-stock-error-text); box-shadow: none; filter: none; transform: none; }
/* 1024 px: still six columns, slightly smaller type; very narrow panels fall back to three columns (set by layoutActions) */
@media (max-width: 1279.98px) {
    body.sp-pos-page .sp-pos .sp-act:not(.is-pay) { padding-left: 1px; padding-right: 1px; }
    body.sp-pos-page .sp-pos .sp-act:not(.is-pay) .sp-act-label { font-size: .62rem; letter-spacing: 0; }
    body.sp-pos-page .sp-pos .sp-act.a-temp .sp-act-label { font-size: .56rem; }   /* 'Temporary' is the longest single word in the dock */
    body.sp-pos-page .sp-pos .sp-act:not(.is-pay) kbd { font-size: .5rem; padding: 0 3px; }
}
@media (max-height: 820px) and (min-width: 992px) {
    body.sp-pos-page .sp-pos .sp-act:not(.is-pay) { min-height: 46px; padding-top: .3rem; }
    body.sp-pos-page .sp-checkout .sp-act.is-pay { min-height: 46px; }
    body.sp-pos-page .sp-tot { padding: .16rem .7rem; }
    body.sp-pos-page .sp-grand { padding: .28rem .85rem; } body.sp-pos-page .sp-grand strong { font-size: 1.3rem; }
}

/* ---- 2. search / scanner COMMAND bar (owner, 17 Nov): ONE slim Facebook-blue row — short search field, Categories, Held, every tool
   and both speaker toggles side by side; icons with a small shortcut tag, the full name in the tooltip */
body.sp-pos-page .sp-catalog { gap: .45rem; }
body.sp-pos-page .sp-command { flex: 0 0 auto; flex-wrap: nowrap; align-items: center; gap: .3rem; padding: .35rem .45rem; border-radius: 12px; box-shadow: var(--sp-shadow);
    background: var(--pos-section-header); }
body.sp-pos-page .sp-command .sp-search { flex: 1 1 230px; min-width: 170px; }
body.sp-pos-page .sp-command .sp-search .form-control { height: 38px; border: 2px solid transparent; border-radius: 9px; font-size: .95rem; font-weight: 600;
    background: var(--sp-input-bg); color: var(--sp-text); box-shadow: none; }
body.sp-pos-page .sp-command .sp-search .form-control:focus { border-color: var(--pos-section-header-text); box-shadow: 0 0 0 3px var(--pos-on-header-line); }
body.sp-pos-page .sp-command .sp-search > .bi { color: var(--pos-section-header); }
body.sp-pos-page .sp-command .sp-tool { flex: 0 0 auto; height: 38px; min-width: 38px; padding: 0 .55rem; gap: .35rem; border-radius: 9px; font-size: .8rem;
    color: var(--pos-section-header-text); background: var(--pos-on-header-soft); border: 1px solid var(--pos-on-header-line); box-shadow: none; }
body.sp-pos-page .sp-command .sp-tool .bi { font-size: 1.02rem; color: inherit; }
body.sp-pos-page .sp-command .sp-tool kbd { color: inherit; background: transparent; border-color: var(--pos-on-header-line); }
body.sp-pos-page .sp-command .sp-tool:hover { background: color-mix(in srgb, var(--pos-section-header-text) 26%, transparent); }
body.sp-pos-page .sp-command .sp-tool:active { background: color-mix(in srgb, var(--pos-section-header-text) 34%, transparent); }
body.sp-pos-page .sp-command .sp-tool.is-on, body.sp-pos-page .sp-command .sp-tool.t-audio.is-on { background: var(--pos-section-header-text); color: var(--pos-section-header); border-color: var(--pos-section-header-text); }
body.sp-pos-page .sp-command .sp-tool:focus-visible { outline: 3px solid var(--pos-section-header-text); outline-offset: 2px; }
body.sp-pos-page .sp-command .sp-tool-count { background: var(--pos-act-hold-bg); color: var(--pos-act-hold-fg); }
/* small tools: icon only (label in the tooltip), the shortcut as a corner tag */
body.sp-pos-page .sp-command .sp-tool:not(.t-cats):not(.t-held) { width: 38px; padding: 0; justify-content: center; }
body.sp-pos-page .sp-command .sp-tool:not(.t-cats):not(.t-held) .sp-tool-label { display: none; }
body.sp-pos-page .sp-command .sp-tool:not(.t-cats):not(.t-held) kbd:not([hidden]) { position: absolute; top: -6px; right: -5px; padding: 0 3px; font-size: .52rem; line-height: 1.45;
    background: var(--sp-surface); color: var(--sp-text-muted); border: 1px solid var(--sp-border-strong); border-radius: 4px; }
body.sp-pos-page .sp-command .sp-tool.t-audio { width: 34px; min-width: 34px; }
body.sp-pos-page .sp-command .sp-tool.t-cats kbd, body.sp-pos-page .sp-command .sp-tool.t-held kbd { font-size: .55rem; padding: 0 3px; }
@media (max-width: 1599.98px) {   /* every tool an icon (Held keeps its count), so the search field gets the room */
    body.sp-pos-page .sp-command .sp-tool.t-cats .sp-tool-label, body.sp-pos-page .sp-command .sp-tool.t-held .sp-tool-label { display: none; }
    body.sp-pos-page .sp-command .sp-tool.t-cats kbd, body.sp-pos-page .sp-command .sp-tool.t-held kbd { position: absolute; top: -6px; right: -5px; padding: 0 3px; font-size: .52rem; line-height: 1.45;
        background: var(--sp-surface); color: var(--sp-text-muted); border: 1px solid var(--sp-border-strong); border-radius: 4px; }
    body.sp-pos-page .sp-command .sp-tool.t-cats { width: 38px; padding: 0; justify-content: center; }
    body.sp-pos-page .sp-command .sp-tool.t-held { padding: 0 .45rem; gap: .25rem; }
    body.sp-pos-page .sp-command .sp-search { flex: 1 1 260px; min-width: 220px; }
}
@media (max-width: 1199.98px) {
    body.sp-pos-page .sp-command { flex-wrap: wrap; row-gap: .3rem; }
    body.sp-pos-page .sp-command .sp-search { flex: 1 1 100%; }
    body.sp-pos-page .sp-command .sp-tool { height: 34px; }
}

/* ---- 3./4./5. HELD BILLS, RECENT ITEMS, CATEGORIES: labelled one-row strips, sideways scrolling only (never wrap) */
body.sp-pos-page .sp-strip { flex: 0 0 auto; display: flex; align-items: stretch; min-width: 0; overflow: hidden; border-radius: 10px;
    background: var(--pos-panel-bg); border: 1px solid var(--pos-panel-border); box-shadow: var(--sp-shadow-sm); }
/* owner (17 Nov): the three label blocks are identical — same width, same height (the strips share one height), one line, icon + text */
body.sp-pos-page .sp-strip { height: var(--pos-strip-h); }
body.sp-pos-page .sp-strip-head { flex: 0 0 var(--pos-strip-label-w); width: var(--pos-strip-label-w); height: 100%; display: flex; align-items: center; justify-content: flex-start; gap: .4rem;
    padding: 0 .7rem; font-size: .68rem; font-weight: 800; line-height: 1; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
    background: var(--pos-section-header); color: var(--pos-section-header-text); border-right: 1px solid var(--pos-panel-border); }
body.sp-pos-page .sp-strip-head .bi { flex: 0 0 16px; width: 16px; font-size: .95rem; text-align: center; }
body.sp-pos-page .sp-pos, body.sp-pos-page .sp-catalog { --pos-strip-h: 50px; --pos-strip-label-w: 132px; }
body.sp-pos-page .sp-strip > .sp-held-strip, body.sp-pos-page .sp-strip > .sp-recent-row, body.sp-pos-page .sp-strip > .sp-cat-tabs {
    flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: nowrap; align-items: center; gap: .4rem; overflow-x: auto; overflow-y: hidden; margin: 0;
    padding: .3rem .45rem; scrollbar-width: thin; scrollbar-color: var(--sp-border-strong) transparent; overscroll-behavior-x: contain; }
body.sp-pos-page .sp-strip > .sp-held-strip, body.sp-pos-page .sp-strip > .sp-recent-row, body.sp-pos-page .sp-strip > .sp-cat-tabs { height: 100%; padding-top: 0; padding-bottom: 0; }
body.sp-pos-page .sp-strip > .sp-held-strip { scroll-snap-type: none; }   /* rest at 0 like the other strips: the newest bill keeps its left spacing */
body.sp-pos-page .sp-held { height: calc(var(--pos-strip-h) - 14px); padding-top: 0; padding-bottom: 0; line-height: 1.2; }
body.sp-pos-page .sp-held > b, body.sp-pos-page .sp-held > small, body.sp-pos-page .sp-held .sp-held-amt { line-height: 1.2; }
body.sp-pos-page .sp-recent-chip, body.sp-pos-page .sp-cat-tab, body.sp-pos-page .sp-cat-find input { height: calc(var(--pos-strip-h) - 16px); }
body.sp-pos-page .sp-cat-find { flex: 0 0 178px; position: relative; display: flex; align-items: center; padding: 0 .1rem 0 .45rem; border-right: 1px solid var(--pos-cart-line-border); }
body.sp-pos-page .sp-cat-find .bi { position: absolute; left: .95rem; color: var(--pos-section-header); font-size: .85rem; pointer-events: none; }
body.sp-pos-page .sp-cat-find input { width: 100%; height: calc(var(--pos-strip-h) - 16px); padding: 0 .5rem 0 1.75rem; border-radius: 8px; font-size: .8rem; font-weight: 600;
    border: 1px solid var(--pos-tab-border); background: var(--sp-input-bg); color: var(--sp-text); }
body.sp-pos-page .sp-cat-find input:focus { outline: 0; border-color: var(--pos-section-header); box-shadow: var(--pos-focus-ring); }
body.sp-pos-page .sp-cat-tab.is-filtered-out { display: none; }
body.sp-pos-page .sp-cat-tabs.is-no-match::after { content: 'No category matches'; font-size: .76rem; font-style: italic; color: var(--sp-text-muted); white-space: nowrap; }
@media (max-width: 1199.98px) { body.sp-pos-page .sp-cat-find { flex-basis: 132px; } }
body.sp-pos-page .sp-strip > :empty { display: flex; }
body.sp-pos-page .sp-strip > :empty::before { content: attr(data-empty); font-size: .76rem; font-style: italic; color: var(--sp-text-muted); white-space: nowrap; }
/* held bill cards: hold no. + amount, customer · items; amber edge; the open one solid amber */
body.sp-pos-page .sp-held { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: center; column-gap: .55rem; row-gap: 0;
    width: 214px; min-width: 0; max-width: none; height: calc(var(--pos-strip-h) - 14px); padding: 0 .6rem; border-radius: 8px; text-align: left;
    background: color-mix(in srgb, var(--sp-warning) 7%, var(--pos-panel-bg)); border: 1px solid color-mix(in srgb, var(--sp-warning) 40%, var(--pos-panel-border));
    border-left: 4px solid var(--sp-acc-hold); color: var(--sp-text); }
body.sp-pos-page .sp-held > b { grid-area: 1 / 1; font-size: .78rem; min-width: 0; }
body.sp-pos-page .sp-held > small:nth-of-type(1) { grid-area: 2 / 1 / 3 / 3; font-size: .7rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
body.sp-pos-page .sp-held > small:nth-of-type(2) { display: none; }
body.sp-pos-page .sp-held .sp-held-amt { grid-area: 1 / 2; font-size: .8rem; color: var(--sp-text); }
body.sp-pos-page .sp-held:hover { background: color-mix(in srgb, var(--sp-warning) 15%, var(--pos-panel-bg)); }
body.sp-pos-page .sp-held.is-active { background: var(--sp-tone-warning); border-color: var(--sp-tone-warning); color: var(--sp-on-warning); }
body.sp-pos-page .sp-held.is-active small, body.sp-pos-page .sp-held.is-active .sp-held-amt { color: inherit; }
/* recent items: newest first, cart quantity badge */
body.sp-pos-page .sp-recent-chip { flex: 0 0 auto; max-width: 200px; height: calc(var(--pos-strip-h) - 16px); padding: 0 .65rem; border-radius: 8px; font-size: .76rem; font-weight: 700; text-transform: none;
    background: var(--pos-tab-inactive); color: var(--pos-tab-inactive-text); border: 1px solid var(--pos-tab-border); }
body.sp-pos-page .sp-recent-chip:hover { background: var(--pos-command-hover); border-color: var(--sp-primary); }
body.sp-pos-page .sp-recent-chip.is-in-cart { border: 2px solid var(--pos-latest-edge); background: var(--pos-latest-bg); }
/* category tabs: proper navigation tabs, the selected one royal blue */
body.sp-pos-page .sp-cat-tab { flex: 0 0 auto; min-width: 0; height: calc(var(--pos-strip-h) - 16px); padding: 0 .85rem; gap: .4rem; border-radius: 8px; font-size: .8rem; font-weight: 700; box-shadow: none;
    background: var(--pos-tab-inactive); color: var(--pos-tab-inactive-text); border: 1px solid var(--pos-tab-border); }
body.sp-pos-page .sp-cat-tab .bi { color: color-mix(in srgb, var(--sp-primary) 75%, var(--sp-text)); }
body.sp-pos-page .sp-cat-tab:hover { background: var(--pos-command-hover); border-color: var(--sp-primary); }
body.sp-pos-page .sp-cat-tab.is-active { background: var(--pos-tab-active); color: var(--pos-tab-active-text); border-color: var(--pos-tab-active); box-shadow: inset 0 -3px 0 var(--pos-on-header-line); }
body.sp-pos-page .sp-cat-tab.is-active .bi { color: inherit; }
body.sp-pos-page :is(.sp-held, .sp-recent-chip, .sp-cat-tab):focus-visible { outline: 3px solid var(--sp-focus); outline-offset: -3px; }

/* ---- 6. PRODUCTS: its own card with a header (active category + count) and a calm grid canvas */
body.sp-pos-page .sp-products { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 12px;
    background: var(--pos-panel-bg); border: 1px solid var(--pos-panel-border); box-shadow: var(--sp-shadow-sm); }
body.sp-pos-page .sp-products > .sp-zone-head { min-height: 36px; padding: .3rem .75rem; }
body.sp-pos-page .sp-products .sp-active-cat { height: 26px; padding: 0 .2rem 0 .6rem; font-size: .76rem; box-shadow: none; background: var(--pos-section-header-text); color: var(--pos-section-header); }
body.sp-pos-page .sp-products .sp-active-cat button { width: 20px; height: 20px; background: color-mix(in srgb, var(--pos-section-header) 14%, transparent); }
body.sp-pos-page .sp-products .sp-grid { flex: 1 1 auto; padding: .55rem; gap: .55rem; background: color-mix(in srgb, var(--sp-primary) 3%, var(--sp-surface-2)); }
body.sp-pos-page .sp-products .sp-grid-foot { min-height: 0; padding: .15rem .75rem; background: var(--pos-panel-bg); border-top: 1px solid var(--pos-cart-line-border); }
body.sp-pos-page .sp-products .sp-grid-foot:has(.sp-grid-end[hidden]) { display: none; }
/* product cards: picture | name | price + stock, each in its own band */
body.sp-pos-page .sp-tile { border-radius: 10px; border: 1px solid var(--pos-panel-border); background: var(--pos-panel-bg); box-shadow: var(--sp-shadow-sm); }
body.sp-pos-page .sp-tile:hover { border-color: var(--sp-primary); }
body.sp-pos-page .sp-tile-media { border-bottom: 1px solid var(--pos-cart-line-border); }
body.sp-pos-page .sp-tile-body { flex: 0 0 68px; height: 68px; padding: .3rem .5rem .35rem; gap: .15rem; border-top: 0; background: var(--pos-panel-bg); }
body.sp-pos-page .sp-tile-name { font-size: .8rem; font-weight: 800; color: var(--sp-text); }
body.sp-pos-page .sp-tile-foot { padding-top: .2rem; border-top: 1px dashed var(--pos-cart-line-border); }
body.sp-pos-page .sp-tile-price { font-size: .9rem; font-weight: 900; color: color-mix(in srgb, var(--sp-primary) 72%, var(--sp-text)); }
body.sp-pos-page .sp-tile:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: 2px; }
/* latest accepted product: green frame + "Last added" tag until the next add */
body.sp-pos-page .sp-tile.is-last { border: 2px solid var(--pos-latest-edge); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos-latest-edge) 22%, transparent); }
body.sp-pos-page .sp-tile.is-last::before { content: 'Last added'; position: absolute; top: 5px; right: 5px; z-index: 2; padding: 0 .4rem; border-radius: 999px;
    font-size: .6rem; font-weight: 800; letter-spacing: .03em; line-height: 1.6; background: var(--sp-tone-success); color: var(--sp-on-solid); }
/* out of stock: grey picture, red band, never mistaken for a sellable card */
body.sp-pos-page .sp-tile.is-out { opacity: 1; border-color: color-mix(in srgb, var(--sp-danger) 45%, var(--pos-panel-border)); }
body.sp-pos-page .sp-tile.is-out .sp-tile-media { filter: grayscale(1); opacity: .55; }
body.sp-pos-page .sp-tile.is-out .sp-tile-body { background: var(--pos-danger-bg); }
body.sp-pos-page .sp-tile.is-out .sp-tile-name, body.sp-pos-page .sp-tile.is-out .sp-tile-price { color: var(--sp-text-muted); }

/* ---- POS dialogs and drawers: the same blue header strip */
body.sp-pos-page .modal-header, body.sp-pos-page .offcanvas-header { background: linear-gradient(135deg, var(--pos-section-header), var(--pos-section-header-2));
    color: var(--pos-section-header-text); border-bottom: 0; }
body.sp-pos-page .modal-header .modal-title, body.sp-pos-page .offcanvas-header .offcanvas-title { color: inherit; font-weight: 800; }
body.sp-pos-page .modal-header .modal-title .bi, body.sp-pos-page .offcanvas-header .offcanvas-title .bi { color: inherit; background: var(--pos-on-header-soft); }
body.sp-pos-page .modal-header .btn-close, body.sp-pos-page .offcanvas-header .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: .9; }

/* ---- payment: seven clearly separated areas (summary · tender · amount · credit · notes · change · complete) */
body.sp-pos-page .sp-pay-grid { gap: .75rem; align-items: start; }
body.sp-pos-page .sp-pay-grid.has-denoms { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr) minmax(340px, 1.1fr); }
body.sp-pos-page .sp-pay-zone { min-width: 0; padding: 0 .75rem .75rem; border-radius: 12px; background: var(--pos-panel-bg); border: 1px solid var(--pos-panel-border); overflow: hidden; }
body.sp-pos-page .sp-pay-zone-head { display: flex; align-items: center; justify-content: flex-start; gap: .4rem; margin: 0 -.75rem .6rem; padding: .45rem .75rem;
    font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--sp-text);
    background: var(--pos-cart-head-bg); border-bottom: 1px solid var(--pos-cart-line-border); box-shadow: inset 4px 0 0 var(--pos-section-header); }
body.sp-pos-page .sp-pay-zone-head .bi { color: color-mix(in srgb, var(--sp-primary) 80%, var(--sp-text)); margin-right: .35rem; }
body.sp-pos-page .sp-pay-zone-head .btn-link { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 700; }
body.sp-pos-page .sp-pay-zone-head .bi { width: auto; height: auto; background: none; }
body.sp-pos-page .sp-pay-sum { padding: .2rem 0; border: 0; background: none; gap: 0; }
body.sp-pos-page .sp-pay-sum > div { padding: .28rem 0; border-bottom: 1px solid var(--pos-cart-line-border); }
body.sp-pos-page .sp-pay-sum > div:last-child { border-bottom: 0; }
body.sp-pos-page .sp-pay-sum .is-total { border-top: 0; font-size: 1.15rem; }
body.sp-pos-page .sp-pay-sum .is-due { color: var(--sp-danger-text); }
body.sp-pos-page .sp-change { background: var(--sp-tone-success); color: var(--sp-on-solid); border-radius: 12px; }
body.sp-pos-page .sp-change.is-due { background: var(--sp-tone-danger); }
body.sp-pos-page .sp-change.is-zero { background: var(--sp-secondary-soft); color: var(--sp-text); border: 1px solid var(--pos-panel-border); }
body.sp-pos-page .sp-tender label { min-height: 52px; justify-content: center; border: 1px solid var(--pos-tab-border); border-radius: 9px; background: var(--pos-tab-inactive); color: var(--pos-tab-inactive-text); }
body.sp-pos-page .sp-tender label .bi { color: color-mix(in srgb, var(--sp-primary) 75%, var(--sp-text)); }
body.sp-pos-page .sp-tender input:checked + label { background: var(--pos-tab-active); border-color: var(--pos-tab-active); color: var(--pos-tab-active-text); }
body.sp-pos-page .sp-tender input:checked + label .bi { color: inherit; }
body.sp-pos-page .sp-tender input:focus-visible + label { outline: 3px solid var(--sp-focus); outline-offset: 2px; box-shadow: none; }
body.sp-pos-page .sp-voucher-box { border: 1px dashed color-mix(in srgb, var(--sp-acc-voucher) 50%, var(--pos-panel-border)); background: color-mix(in srgb, var(--sp-acc-voucher) 5%, var(--pos-panel-bg)); }
/* cash notes: note | − count + | 5,000 × 3 = 15,000 */
body.sp-pos-page .sp-denoms.sp-pay-zone { display: flex; flex-direction: column; gap: .3rem; padding: 0 .6rem .6rem; }
body.sp-pos-page .sp-denoms.sp-pay-zone > .sp-denoms-head { margin: 0 -.6rem .3rem; padding: .45rem .6rem; }
body.sp-pos-page #pay-denom-rows { gap: .28rem; }
body.sp-pos-page .sp-denom { grid-template-columns: 58px auto minmax(max-content, 1fr); grid-template-areas: none; align-items: center; gap: .5rem; padding: .22rem .4rem;
    border-radius: 9px; background: var(--pos-panel-bg); border: 1px solid var(--pos-cart-line-border); }
body.sp-pos-page .sp-denom > *, body.sp-pos-page .sp-denom .is-minus, body.sp-pos-page .sp-denom .is-plus { grid-area: auto; }
body.sp-pos-page .sp-denom-note { padding: .2rem 0; border-radius: 6px; text-align: center; font-size: .95rem; font-weight: 900;
    background: color-mix(in srgb, var(--sp-success) 10%, var(--pos-panel-bg)); color: var(--pos-grand-text); border: 1px solid color-mix(in srgb, var(--sp-success) 30%, var(--pos-panel-border)); }
body.sp-pos-page .sp-denom-step { display: inline-flex; align-items: center; border: 1px solid var(--sp-border-strong); border-radius: 9px; overflow: hidden; background: var(--sp-surface-2); }
body.sp-pos-page .sp-denom-btn { width: 36px; height: 36px; border-radius: 0; font-size: 1.2rem; background: var(--sp-surface-2); color: var(--sp-text); }
body.sp-pos-page .sp-denom-btn.is-plus { background: var(--sp-tone-success); color: var(--sp-on-solid); }
body.sp-pos-page .sp-denom-btn:hover:not(:disabled) { filter: brightness(.95); }
body.sp-pos-page .sp-denom-btn:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: -3px; box-shadow: none; }
body.sp-pos-page .sp-denom-count { min-width: 36px; padding: 0 .25rem; text-align: center; font-size: 1rem; font-weight: 900; color: var(--sp-text);
    border-left: 1px solid var(--sp-border-strong); border-right: 1px solid var(--sp-border-strong); line-height: 36px; background: var(--pos-panel-bg); }
body.sp-pos-page .sp-denom-sub { justify-self: end; font-size: .78rem; font-weight: 600; color: var(--sp-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
body.sp-pos-page .sp-denom-sub b { font-size: .92rem; font-weight: 900; color: var(--sp-text); }
body.sp-pos-page .sp-denom.is-on { background: var(--pos-latest-bg); border-color: var(--pos-latest-edge); }
body.sp-pos-page .sp-denoms-total { margin-top: .2rem; padding: .45rem .55rem; border-radius: 9px; border: 1px solid var(--pos-panel-border); background: var(--pos-cart-head-bg); }

/* ---- short desktop screens (1366 × 768): same hierarchy, tighter rhythm */
@media (max-height: 820px) and (min-width: 992px) {
    body.sp-pos-page .sp-zone-head { min-height: 34px; padding: .25rem .7rem; }
    body.sp-pos-page .sp-cart-head { padding: .4rem .55rem; }
    body.sp-pos-page .sp-cart-head .form-control { height: 36px; }
    body.sp-pos-page .sp-line { min-height: 52px; padding: .32rem .7rem; }
    body.sp-pos-page .sp-checkout { margin-top: .35rem; padding: .35rem; gap: .35rem; }
    body.sp-pos-page .sp-command { padding: .3rem .4rem; } body.sp-pos-page .sp-command .sp-search .form-control, body.sp-pos-page .sp-command .sp-tool { height: 36px; }
    body.sp-pos-page .sp-pos, body.sp-pos-page .sp-catalog { --pos-strip-h: 46px; }
    body.sp-pos-page .sp-catalog { gap: .4rem; }
    body.sp-pos-page .sp-pos { --sp-tile-h: 150px; }
    body.sp-pos-page .sp-tile-body { flex-basis: 62px; height: 62px; }
}
@media (max-width: 1279.98px) {
    body.sp-pos-page .sp-line { grid-template-columns: 38px minmax(0, 1fr) 98px 78px; grid-template-areas: "thumb name qty total" "thumb meta qty acts"; }
    body.sp-pos-page .sp-lines-head { grid-template-columns: minmax(0, 1fr) 98px 78px; }
    body.sp-pos-page .sp-line-thumb { width: 38px; height: 38px; }
    body.sp-pos-page .sp-line-qty button { width: 28px; } body.sp-pos-page .sp-line-qty input { width: 38px; }
    body.sp-pos-page .sp-cart-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* on-screen keyboard open: subtotal cells and column captions give way, Pay stays above the keyboard */
body.sp-osk-open.sp-pos-page .sp-cart-totals, body.sp-osk-open.sp-pos-page .sp-lines-head { display: none; }

/* ===================================================================== 28. Stage 20.5 POS corrections (tokens only)
   1. The twelve checkout actions share ONE hover / pressed / focus / disabled language: hover and pressed turn the button into a
      light tint of its own colour with a black icon, label and shortcut (an older section-25 rule left a pale background under
      white text, so some buttons looked blank). Keyboard focus is a ring + halo with no colour change, so it never looks like hover.
   2. Quantity feedback: a red circle with the real quantity on the changed cart row.
   3. Several categories: removable chips in the Products header + one clear-all control.
   4. Order discount: Amount / Percentage segmented choice and live preview.
   5. Price & stock check: pink / red band with a white product card. */
body.sp-pos-page .sp-pos .sp-act:not(.is-pay):hover:not(:disabled):not([aria-disabled="true"]) {
    background: color-mix(in srgb, var(--act-bg, var(--pos-act-help-bg)) var(--pos-act-hover-mix), var(--pos-act-hover-tint));
    border-color: var(--act-bg, var(--pos-act-help-bg)); color: var(--pos-act-hover-fg); filter: none; transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px var(--act-bg, var(--pos-act-help-bg)), 0 4px 8px -4px var(--sp-shade); }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay):active:not(:disabled):not([aria-disabled="true"]) {
    background: color-mix(in srgb, var(--act-bg, var(--pos-act-help-bg)) var(--pos-act-press-mix), var(--pos-act-hover-tint));
    border-color: var(--act-bg, var(--pos-act-help-bg)); color: var(--pos-act-hover-fg); filter: none; transform: translateY(0); box-shadow: inset 0 2px 4px var(--pos-act-press); }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay):is(:hover, :active):not(:disabled):not([aria-disabled="true"]) :is(.bi, .sp-act-label, kbd) { color: var(--pos-act-hover-fg); opacity: 1; }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay):is(:hover, :active):not(:disabled):not([aria-disabled="true"]) kbd {
    background: color-mix(in srgb, var(--pos-act-hover-fg) 8%, transparent); border-color: color-mix(in srgb, var(--pos-act-hover-fg) 45%, transparent); }
body.sp-pos-page .sp-pos .sp-act:not(.is-pay):focus-visible { outline: 3px solid var(--pos-focus-strong); outline-offset: 2px; box-shadow: 0 0 0 6px var(--pos-focus-ring); z-index: 2; }

body.sp-pos-page .sp-line-qty { position: relative; overflow: visible; }
body.sp-pos-page .sp-qty-pulse { position: absolute; left: 50%; top: 50%; z-index: 4; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
    display: grid; place-items: center; pointer-events: none; background: var(--pos-qty-pulse-bg); color: var(--pos-qty-pulse-fg);
    font-size: 1.15rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 3px var(--pos-qty-pulse-ring), 0 6px 14px -4px var(--sp-shade); animation: sp-row-pulse 1.1s var(--sp-ease) forwards; }
@keyframes sp-row-pulse { 0% { transform: scale(.4); opacity: 0; } 15% { transform: scale(1.14); opacity: 1; } 30% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(.96); } }
@keyframes sp-row-fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { body.sp-pos-page .sp-qty-pulse { animation: sp-row-fade 1.1s linear forwards; } }
body.sp-pos-page .sp-line.is-qty-changed { box-shadow: inset 4px 0 0 var(--pos-qty-pulse-bg); }

body.sp-pos-page .sp-products .sp-cat-chips { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; max-width: 62%; overflow-x: auto; scrollbar-width: none; }
body.sp-pos-page .sp-products .sp-cat-chips[hidden] { display: none; }
body.sp-pos-page .sp-cat-chip-list { display: inline-flex; gap: .3rem; }
body.sp-pos-page .sp-cat-chip { display: inline-flex; align-items: center; gap: .3rem; height: 26px; padding: 0 .15rem 0 .55rem; border-radius: 999px; white-space: nowrap;
    font-size: .74rem; font-weight: 800; background: var(--pos-section-header-text); color: var(--pos-section-header); }
body.sp-pos-page .sp-cat-chip .bi-tag-fill { font-size: .7rem; }
body.sp-pos-page .sp-cat-chip button { width: 20px; height: 20px; border: 0; border-radius: 50%; display: grid; place-items: center; font-size: .6rem;
    background: color-mix(in srgb, var(--pos-section-header) 14%, transparent); color: inherit; }
body.sp-pos-page .sp-cat-chip button:hover { background: color-mix(in srgb, var(--pos-section-header) 30%, transparent); }
body.sp-pos-page .sp-cat-clear-all { flex: 0 0 auto; width: 26px; height: 26px; border: 0; border-radius: 50%; display: grid; place-items: center;
    background: transparent; color: var(--pos-section-header-text); font-size: 1.05rem; }
body.sp-pos-page .sp-cat-clear-all:hover { background: color-mix(in srgb, var(--pos-section-header-text) 20%, transparent); }
body.sp-pos-page :is(.sp-cat-chip button, .sp-cat-clear-all):focus-visible { outline: 2px solid var(--pos-section-header-text); outline-offset: 1px; }

body.sp-pos-page .sp-seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--sp-border-strong); border-radius: 10px; overflow: hidden; }
body.sp-pos-page .sp-seg-opt { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 46px; border: 0;
    background: var(--sp-surface); color: var(--sp-text); font-weight: 800; }
body.sp-pos-page .sp-seg-opt + .sp-seg-opt { border-left: 1px solid var(--sp-border-strong); }
body.sp-pos-page .sp-seg-opt:hover { background: var(--sp-hover); }
body.sp-pos-page .sp-seg-opt[aria-checked="true"] { background: var(--sp-primary); color: var(--sp-primary-contrast); }
body.sp-pos-page .sp-seg-opt:focus-visible { position: relative; z-index: 1; outline: 3px solid var(--sp-focus); outline-offset: -4px; box-shadow: inset 0 0 0 6px var(--sp-surface); }
body.sp-pos-page .sp-disc-preview { margin-top: .75rem; min-height: 3.4rem; padding: .55rem .8rem; border-radius: 10px; background: var(--sp-surface-2); }
body.sp-pos-page .sp-disc-amt { font-size: 1.05rem; }
body.sp-pos-page .sp-disc-new { margin-top: .1rem; font-size: 1.25rem; font-weight: 800; }

body.sp-pos-page .sp-price-top { flex: 1 1 0; }
body.sp-pos-page .sp-price-detail { flex: 1.3 1 0; min-height: 220px; display: block; padding-top: 0; border-top: 0; }
body.sp-pos-page .sp-pc-empty { height: 100%; display: flex; align-items: center; justify-content: center; gap: .6rem; border: 2px dashed var(--sp-border-strong);
    border-radius: 14px; color: var(--sp-text-muted); font-size: 1.05rem; font-weight: 700; }
body.sp-pos-page .sp-pc-band { height: 100%; display: flex; flex-direction: column; gap: .55rem; padding: .8rem; border-radius: 14px;
    background: linear-gradient(135deg, var(--pos-pc-band), var(--pos-pc-band-2)); }
body.sp-pos-page .sp-pc-card { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .8rem 1.4rem;
    padding: 1rem 1.25rem; border-radius: 12px; background: var(--pos-pc-card); color: var(--pos-pc-text); box-shadow: 0 8px 22px -12px var(--sp-shade); }
body.sp-pos-page .sp-pc-card.is-miss { grid-template-columns: auto minmax(0, 1fr); font-size: 1.15rem; font-weight: 800; }
body.sp-pos-page .sp-pc-card.is-miss .bi { font-size: 2rem; color: var(--pos-pc-price); }
body.sp-pos-page .sp-pc-media { width: clamp(84px, 11vw, 150px); aspect-ratio: 1; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
    background: var(--pos-pc-media); color: var(--pos-pc-muted); font-size: 2rem; font-weight: 900; }
body.sp-pos-page .sp-pc-media img { width: 100%; height: 100%; object-fit: contain; }
body.sp-pos-page .sp-pc-media:not(.is-noimg) span { display: none; }
body.sp-pos-page .sp-pc-name { font-size: clamp(1.35rem, 2.9vw, 2.5rem); font-weight: 900; line-height: 1.1; overflow-wrap: anywhere; color: var(--pos-pc-text); }
body.sp-pos-page .sp-pc-meta { margin-top: .3rem; color: var(--pos-pc-muted); font-weight: 600; font-size: .95rem; }
body.sp-pos-page .sp-pc-status { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
body.sp-pos-page .sp-pc-avail { font-size: .85rem; font-weight: 700; color: var(--pos-pc-muted); }
body.sp-pos-page .sp-pc-price { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; text-align: right; }
body.sp-pos-page .sp-pc-price b { font-size: clamp(2rem, 4.6vw, 3.6rem); font-weight: 900; line-height: 1; color: var(--pos-pc-price); font-variant-numeric: tabular-nums; }
body.sp-pos-page .sp-pc-price small { font-size: .8rem; font-weight: 700; color: var(--pos-pc-muted); }
body.sp-pos-page .sp-pc-was { font-size: 1.15rem; font-weight: 700; color: var(--pos-pc-muted); }
body.sp-pos-page .sp-pc-save { margin-top: .35rem; padding: .2rem .65rem; border-radius: 999px; background: var(--pos-pc-save-bg); color: var(--pos-pc-save-fg); font-size: .95rem; font-weight: 900; }
body.sp-pos-page .sp-pc-next { display: flex; align-items: center; justify-content: center; gap: .5rem; color: var(--pos-pc-band-text); font-size: 1rem; font-weight: 800; }
@media (max-width: 1279.98px) {
    body.sp-pos-page .sp-pc-card { grid-template-columns: auto minmax(0, 1fr); }
    body.sp-pos-page .sp-pc-price { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: .2rem .8rem; }
}

/* ===================================================================== 29. Stage 20.6 (tokens only)
   rich-text footer editor + previews, automatic Card / Bank amount, one-line Current-bill header, compact category search */
.sp-rt-editor { border: 1px solid var(--sp-border-strong); border-radius: 10px; overflow: hidden; background: var(--sp-surface); }
.sp-rt-bar { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; padding: .35rem; border-bottom: 1px solid var(--sp-border); background: var(--sp-surface-2); }
.sp-rt-area { min-height: 6.5rem; border: 0; border-radius: 0; text-align: center; white-space: normal; }
.sp-rt-area:focus { box-shadow: inset 0 0 0 3px var(--sp-focus); }
.sp-rt .al-l, .sp-rt [align="left"] { text-align: left; } .sp-rt .al-c { text-align: center; } .sp-rt .al-r, .sp-rt [align="right"] { text-align: right; }
.sp-rt .fs-s { font-size: .82em; } .sp-rt .fs-l { font-size: 1.3em; }
.sp-receipt-preview .sp-rt + .sp-rt { margin-top: .35rem; }
body.sp-pos-page .sp-auto-pay { display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border-radius: 10px; background: var(--sp-surface-2); border: 1px solid var(--sp-border); font-size: .95rem; }
body.sp-pos-page .sp-auto-pay b { font-size: 1.1rem; }
body.sp-pos-page .sp-zone-head.is-bill .sp-cart-meta { flex-wrap: nowrap; min-width: 0; overflow: hidden; white-space: nowrap; }
body.sp-pos-page .sp-zone-head.is-bill .sp-cart-meta > span { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.sp-pos-page .sp-zone-head.is-bill .sp-cart-meta > #pos-branch-wrap { flex: 0 1 auto; max-width: 14em; }
body.sp-pos-page .sp-zone-head.is-bill .sp-cart-meta > .sp-order-no { flex: 0 0 auto; }
body.sp-pos-page .sp-strip .sp-cat-find { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .25rem; width: auto; min-width: 0; padding: 0; border: 0; background: none; }
body.sp-pos-page .sp-cat-find-btn { width: calc(var(--pos-strip-h) - 16px); height: calc(var(--pos-strip-h) - 16px); flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px;
    border: 1px solid var(--sp-border-strong); background: var(--sp-surface); color: var(--sp-text); }
body.sp-pos-page .sp-cat-find-btn:hover { background: var(--pos-command-hover); border-color: var(--sp-primary); }
body.sp-pos-page .sp-cat-find-btn:focus-visible { outline: 3px solid var(--sp-focus); outline-offset: 1px; }
body.sp-pos-page .sp-cat-find input { display: none; width: 11.5rem; padding-left: .6rem; }
body.sp-pos-page .sp-cat-find.is-open input { display: block; }
body.sp-pos-page .sp-cat-find.is-open .sp-cat-find-btn { background: var(--pos-tab-active); color: var(--pos-tab-active-text); border-color: var(--pos-tab-active); }
body.sp-pos-page .sp-cat-find .sp-cat-find-btn .bi { position: static; left: auto; color: inherit; font-size: .95rem; pointer-events: none; }
body.sp-pos-page .sp-zone-head.is-bill { min-width: 0; }
body.sp-pos-page .sp-zone-head.is-bill .sp-zone-title { flex: 0 0 auto; }
body.sp-pos-page .sp-zone-head.is-bill .sp-cart-meta { flex: 1 1 auto; justify-content: flex-end; }
body.sp-pos-page .sp-zone-head.is-bill .sp-cart-meta > #pos-branch-wrap { display: inline-block; flex: 0 1 auto; max-width: 16em; }
