/* ══════════════════════════════════════════════════════════════════════════════
   Design System
   A styling layer on top of Bootstrap 5.3. Everything here is token-driven:
   change a token in :root and the whole product follows. The brand tokens are
   re-declared per request from config/branding.php (or the white-label partner
   serving the request), so this file never names a brand.

   No webfonts / no CDN — the app must stay fully usable offline, so typography
   uses the platform UI font stack (Segoe UI Variable on Win 11, SF on macOS).
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────────────────────────────────────── */
:root {
    /* Ink — app chrome, headings, dark surfaces */
    --ink-950: #070C16;
    --ink-900: #0B1220;
    --ink-800: #141D33;
    --ink-700: #263352;
    --ink-600: #3A4868;

    /* Neutrals */
    --n-600: #475569;
    --n-500: #64748B;
    --n-400: #94A3B8;
    --n-300: #CBD5E1;
    --n-200: #E6EAF0;
    --n-150: #EDF1F6;
    --n-100: #F1F4F9;
    --n-50:  #F7F9FC;

    /* Brand — emerald. Single accent, used for "money in" / confirm. */
    --brand-700: #047857;
    --brand-600: #059669;
    --brand-500: #10B981;
    --brand-100: #D1FAE5;
    --brand-50:  #ECFDF5;
    --brand-ring: rgba(5, 150, 105, .16);
    /* Translucent washes, overridden per brand in partials/brand-head. */
    --brand-glow:  rgba(5, 150, 105, .7);
    --brand-wash:  rgba(5, 150, 105, .1);
    --brand-bloom: rgba(16, 185, 129, .26);
    --ink-wash:    rgba(20, 29, 51, .07);
    --brand-on:    #FFFFFF;

    /* Semantic */
    --amber-800: #92400E;
    --amber-700: #B45309;
    --amber-600: #D97706;
    --amber-500: #F59E0B;
    --amber-200: #FDE68A;
    --amber-100: #FEF3C7;
    --amber-50:  #FFFBEB;
    --rose-700:  #BE123C;
    --rose-600:  #E11D48;
    --rose-200:  #FECDD3;
    --rose-50:   #FFF1F2;
    --sky-600:   #0284C7;
    --sky-50:    #F0F9FF;

    /* Return / refund mode - "money out". Kept distinct from amber warnings. */
    --orange-700: #C2410C;
    --orange-600: #EA580C;
    --orange-500: #F97316;
    --orange-100: #FFEDD5;
    --orange-50:  #FFF7ED;

    /* Geometry */
    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;

    /* Elevation — tight, low-opacity, ink-tinted. No grey mush. */
    --sh-xs: 0 1px 2px rgba(11, 18, 32, .05);
    --sh-sm: 0 1px 2px rgba(11, 18, 32, .04), 0 2px 6px -2px rgba(11, 18, 32, .08);
    --sh-md: 0 1px 2px rgba(11, 18, 32, .04), 0 8px 24px -10px rgba(11, 18, 32, .16);
    --sh-lg: 0 2px 4px rgba(11, 18, 32, .04), 0 20px 48px -16px rgba(11, 18, 32, .24);
    --sh-ring: 0 0 0 3px var(--brand-ring);

    /* -- Type scale ---------------------------------------------------------
       Six steps, nothing between them. Sizes are rem against the root, so the
       density switch rescales the whole product by moving one number.
       --fs-2xs is the floor: nothing may be smaller, because below ~11px a
       50-year-old reading a counter screen at arm length is guessing rather
       than reading. */
    --fs-2xs: 0.6875rem;  /* 11px - badges, eyebrows, meta */
    --fs-xs:  0.8125rem;  /* 13px - secondary text, nav, buttons */
    --fs-sm:  0.9375rem;  /* 15px - body, inputs, table cells */
    --fs-md:  1.0625rem;  /* 17px - card titles, sub-totals */
    --fs-lg:  1.3125rem;  /* 21px - section headings */
    --fs-xl:  1.75rem;    /* 28px - totals, page titles */

    /* Minimum hit area for anything tapped on a touchscreen. */
    --tap: 44px;

    --navbar-h: 3.5rem;

    --font-ui: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont,
               "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* ── Bootstrap overrides ─────────────────────────────────────────────── */
    --bs-body-font-family: var(--font-ui);
    --bs-body-font-size: var(--fs-sm);
    --bs-body-color: #1E293B;
    --bs-body-bg: var(--n-50);
    --bs-border-color: var(--n-200);
    --bs-border-radius: var(--r-md);
    --bs-border-radius-sm: var(--r-sm);
    --bs-border-radius-lg: var(--r-lg);
    --bs-border-radius-xl: var(--r-xl);
    --bs-secondary-color: var(--n-500);
    --bs-link-color: var(--brand-700);
    --bs-link-hover-color: var(--brand-600);

    --bs-primary: #141D33;
    --bs-primary-rgb: 20, 29, 51;
    --bs-success: #059669;
    --bs-success-rgb: 5, 150, 105;
    --bs-danger: #E11D48;
    --bs-danger-rgb: 225, 29, 72;
    --bs-warning: #D97706;
    --bs-warning-rgb: 217, 119, 6;
    --bs-info: #0284C7;
    --bs-info-rgb: 2, 132, 199;
    --bs-secondary: #64748B;
    --bs-secondary-rgb: 100, 116, 139;
    --bs-dark: #0B1220;
    --bs-dark-rgb: 11, 18, 32;
}

/* ── Density ──────────────────────────────────────────────────────────────────
   Two reading distances, one number. Every size in the product is rem against
   the root, so moving the root font-size rescales type, chrome and spacing
   together instead of only making the text bigger inside fixed-height boxes.

   Standard (16px root)    : 15px body. The default.
   Comfortable (18px root) : ~17px body. For older eyes, bright counters, and
                             screens read standing up at arm length.
   Compact (15px root)     : ~14px body. For power users on big screens who
                             want more rows per page.

   Set by the density switch in the account menu; persisted in localStorage and
   applied before first paint so there is no flash of the wrong size.
   ──────────────────────────────────────────────────────────────────────────── */
html { font-size: 16px; }
html[data-density="comfortable"] { font-size: 18px; }
html[data-density="compact"]     { font-size: 15px; }

/* ── Base ─────────────────────────────────────────────────────────────────── */
* { -webkit-tap-highlight-color: transparent; }

/* Sticky-footer shell: navbar, a growing main, then the footer. Keeps the
   footer pinned to the bottom of the window on short pages without ever
   overlapping content on long ones. */
body {
    font-family: var(--font-ui);
    font-size: var(--fs-sm);
    line-height: 1.55;
    color: var(--bs-body-color);
    background: var(--n-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
/* dvh accounts for mobile browser chrome that shows and hides on scroll */
@supports (min-height: 100dvh) {
    body { min-height: 100dvh; }
}
.app-main { flex: 1 0 auto; }

::selection { background: var(--brand-100); color: var(--brand-700); }

:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }

/* Numerals line up in columns everywhere money or counts appear. */
.table td, .table th,
.text-end, .td-total, .sb-total, input[type="number"],
.badge, .fs-6 {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--ink-900);
    font-weight: 650;
    letter-spacing: -.012em;
    line-height: 1.25;
}
h4, .h4 { font-size: var(--fs-lg); }
h5, .h5 { font-size: var(--fs-md); }
h6, .h6 { font-size: var(--fs-sm); }

/* Page headings pick up a muted accent icon automatically. */
.container-fluid > h4 > i:first-child,
.container-fluid > .d-flex h4 > i:first-child,
.container-fluid > .row h4 > i:first-child {
    color: var(--n-400);
    margin-right: .15rem;
}

.text-muted { color: var(--n-500) !important; }
small, .small { font-size: var(--fs-xs); }

/* Reusable eyebrow / section label */
.eyebrow {
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--n-600);
}

code {
    background: var(--n-100);
    border: 1px solid var(--n-200);
    border-radius: var(--r-xs);
    padding: .08rem .3rem;
    font-size: .8em;
    color: var(--ink-700);
}

/* ══ APP BAR ═══════════════════════════════════════════════════════════════ */
/* Height is locked to --navbar-h: the POS shell is positioned against it. */
.navbar {
    position: relative;
    z-index: 1031;
    min-height: var(--navbar-h);
    padding: 0 !important;
    background: linear-gradient(180deg, var(--ink-900) 0%, var(--ink-950) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    box-shadow: 0 1px 0 rgba(11, 18, 32, .5), 0 4px 16px -8px rgba(11, 18, 32, .6);
}
.navbar > .container-fluid { min-height: calc(var(--navbar-h) - 1px); }

/* Brand lockup */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .98rem;
    font-weight: 650;
    letter-spacing: -.01em;
    color: #fff !important;
    padding: .5rem 0;
    margin-right: 1rem;
    max-width: 260px;
}
.brand-mark {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: .92rem;
    color: #fff;
    background: linear-gradient(145deg, var(--brand-500), var(--brand-700));
    box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset,
                0 4px 12px -4px var(--brand-glow);
}

/* The built-in SVG mark sits where .brand-mark would, with its own geometry. */
.brand-mark-svg {
    border-radius: 8px;
    box-shadow: 0 4px 12px -4px var(--brand-glow);
}
.brand-text {
    overflow: hidden;
    line-height: 1.15;
}
.brand-name, .brand-sub {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.brand-sub {
    font-size: var(--fs-2xs);
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .38);
}

/* Nav items as quiet pills */
.navbar-nav { gap: 1px; align-items: center; }
.navbar .nav-link {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .42rem .7rem !important;
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    font-weight: 550;
    color: rgba(255, 255, 255, .62) !important;
    transition: color .13s ease, background .13s ease;
    white-space: nowrap;
}
.navbar .nav-link i { font-size: .95rem; opacity: .85; }
.navbar .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, .07);
}
.navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, .1);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset;
}
.navbar .nav-link.active i { opacity: 1; color: var(--brand-500); }

/* Grouped nav items. The group menu reuses the account menu's dark chrome so
   the bar reads as one piece of furniture rather than two styling systems. */
.navbar .nav-group .dropdown-toggle::after {
    margin-left: .1rem;
    border-top-color: currentColor;
    opacity: .45;
    vertical-align: .18em;
}
.navbar .nav-group .dropdown-toggle[aria-expanded="true"] {
    color: #fff !important;
    background: rgba(255, 255, 255, .1);
}
.navbar-group-menu {
    min-width: 212px;
    margin-top: .4rem;
    padding: .35rem;
    background: var(--ink-900);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--r-md);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7);
}
.navbar-group-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .6rem;
    font-size: var(--fs-xs);
    font-weight: 550;
    color: rgba(255, 255, 255, .72);
    border-radius: var(--r-xs);
}
.navbar-group-menu .dropdown-item i { font-size: .95rem; opacity: .8; width: 1rem; }
.navbar-group-menu .dropdown-item:hover,
.navbar-group-menu .dropdown-item:focus {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}
.navbar-group-menu .dropdown-item.active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}
.navbar-group-menu .dropdown-item.active i { color: var(--brand-500); opacity: 1; }

/* Density switch — a segmented control inside the account menu */
.density-header { padding: .35rem .6rem .15rem !important; }
.density-switch {
    display: flex;
    gap: 2px;
    padding: .15rem .6rem .35rem;
}
.density-btn {
    flex: 1;
    min-height: 34px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .04);
    color: rgba(255, 255, 255, .72);
    font-size: var(--fs-xs);
    font-weight: 700;
    border-radius: var(--r-xs);
    cursor: pointer;
    transition: background .13s ease, color .13s ease, border-color .13s ease;
}
.density-btn:first-child { border-radius: var(--r-sm) var(--r-xs) var(--r-xs) var(--r-sm); }
.density-btn:last-child  { border-radius: var(--r-xs) var(--r-sm) var(--r-sm) var(--r-xs); }
.density-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.density-btn[aria-pressed="true"] {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

/* Right-hand utility cluster */
.navbar-util {
    display: flex;
    align-items: center;
    gap: .5rem;
}
/* Connection chip */
#onlineIndicator {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .7rem !important;
    font-weight: 600;
    letter-spacing: .01em;
    padding: .3rem .6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .07) !important;
    color: rgba(255, 255, 255, .72) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset;
}
#onlineIndicator.bg-success {
    background: rgba(5, 150, 105, .16) !important;
    color: #6EE7B7 !important;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, .3) inset;
}
#onlineIndicator.bg-secondary {
    background: rgba(148, 163, 184, .14) !important;
    color: var(--n-300) !important;
}

/* Account menu trigger */
.navbar-account { position: relative; }
.navbar-user {
    display: flex;
    align-items: center;
    gap: .45rem;
    max-width: 180px;
    font-size: .78rem;
    color: rgba(255, 255, 255, .65);
}
/* Only the menu trigger gets the pill chrome; the admin bar keeps a plain block. */
button.navbar-user {
    padding: .2rem .45rem .2rem .25rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: rgba(255, 255, 255, .04);
    transition: background .13s ease, border-color .13s ease;
}
button.navbar-user:hover,
button.navbar-user[aria-expanded="true"] {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .16);
    color: #fff;
}
.user-avatar {
    position: relative;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
    background: linear-gradient(145deg, var(--ink-600), var(--ink-800));
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .14) inset;
}
/* Pending-sync marker, shown while the menu is closed */
.user-avatar .sync-dot {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bs-warning, #F59E0B);
    box-shadow: 0 0 0 2px var(--ink-900);
}
.navbar-user .user-meta {
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
    text-align: left;
}
.navbar-user .user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 550;
    color: rgba(255, 255, 255, .8);
}
.navbar-user .user-role {
    font-size: var(--fs-2xs);
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .34);
}
.navbar-user .user-caret {
    font-size: var(--fs-2xs);
    opacity: .5;
    transition: transform .13s ease;
}
.navbar-user[aria-expanded="true"] .user-caret { transform: rotate(180deg); }

/* Account menu */
.navbar-account-menu {
    --bs-dropdown-link-color: rgba(255, 255, 255, .72);
    --bs-dropdown-link-hover-color: #fff;
    min-width: 232px;
    margin-top: .4rem;
    padding: .35rem;
    background: var(--ink-900);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7);
}
.navbar-account-menu .dropdown-header {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .4rem .6rem .5rem;
}
.navbar-account-menu .acct-name {
    font-size: .82rem;
    font-weight: 650;
    color: #fff;
}
.navbar-account-menu .acct-role {
    font-size: var(--fs-2xs);
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .34);
}
.navbar-account-menu .dropdown-divider {
    border-top-color: rgba(255, 255, 255, .09);
    opacity: 1;
    margin: .25rem .3rem;
}
.navbar-account-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    padding: .5rem .6rem;
    font-size: .82rem;
    font-weight: 550;
    color: rgba(255, 255, 255, .72);
    background: transparent;
    border: 0;
}
.navbar-account-menu .dropdown-item i { font-size: .95rem; opacity: .8; width: 1rem; }
.navbar-account-menu .dropdown-item:hover,
.navbar-account-menu .dropdown-item:focus {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}
.navbar-account-menu .dropdown-item.active {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}
.navbar-account-menu .dropdown-item.active i { color: var(--brand-500); opacity: 1; }
.navbar-account-menu .dropdown-item.disabled,
.navbar-account-menu .dropdown-item:disabled {
    opacity: .4;
    pointer-events: none;
}
.navbar-account-menu .dropdown-item-danger { color: #FDA4AF; }
.navbar-account-menu .dropdown-item-danger:hover,
.navbar-account-menu .dropdown-item-danger:focus {
    background: rgba(225, 29, 72, .16);
    color: #FECDD3;
}
.navbar-account-menu .spinner-border-sm { width: .95rem; height: .95rem; border-width: .15em; }

.btn-logout {
    border: 1px solid rgba(255, 255, 255, .14);
    background: transparent;
    color: rgba(255, 255, 255, .6);
    border-radius: var(--r-sm);
    width: 32px;
    height: 32px;
    min-height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    transition: all .13s ease;
}
.btn-logout:hover {
    border-color: rgba(225, 29, 72, .5);
    background: rgba(225, 29, 72, .14);
    color: #FDA4AF;
}

.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: var(--r-sm);
    padding: .3rem .5rem;
    margin: .5rem 0;
}
.navbar-toggler:focus { box-shadow: none; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    --bs-btn-border-radius: var(--r-md);
    min-height: 38px;
    font-weight: 600;
    font-size: var(--fs-xs);
    letter-spacing: .005em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    transition: background-color .14s ease, border-color .14s ease,
                box-shadow .14s ease, transform .1s ease, color .14s ease;
}
.btn-lg { min-height: 46px; font-size: var(--fs-sm); padding: .55rem 1.2rem; }
.btn-sm { min-height: 34px; font-size: var(--fs-xs); padding: .32rem .7rem; --bs-btn-border-radius: var(--r-sm); }
.btn:focus-visible { box-shadow: var(--sh-ring); outline: none; }
.btn:active { transform: translateY(0); }

.btn-primary, .btn-success, .btn-danger, .btn-dark, .btn-warning {
    border-color: transparent;
    box-shadow: var(--sh-xs), 0 1px 0 rgba(255, 255, 255, .12) inset;
}
.btn-primary:hover, .btn-success:hover, .btn-danger:hover,
.btn-dark:hover, .btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: var(--sh-sm), 0 1px 0 rgba(255, 255, 255, .12) inset;
}
.btn-primary  { background: var(--ink-800); }
.btn-primary:hover { background: var(--ink-700); }
.btn-success  { background: var(--brand-600); }
.btn-success:hover { background: var(--brand-700); }
.btn-danger   { background: var(--rose-600); }
.btn-danger:hover { background: #BE123C; }
.btn-warning  { background: #B45309; color: #fff; }
.btn-warning:hover { background: #92400E; color: #fff; }
.btn-dark     { background: var(--ink-900); }
.btn-dark:hover { background: var(--ink-800); }

/* Secondary is a quiet surface button, not a grey slab */
.btn-secondary {
    background: #fff;
    color: var(--n-600);
    border: 1px solid var(--n-200);
    box-shadow: var(--sh-xs);
}
.btn-secondary:hover {
    background: var(--n-100);
    color: var(--ink-900);
    border-color: var(--n-300);
}

/* Outline buttons: hairline, not heavy */
.btn-outline-secondary {
    --bs-btn-color: var(--n-600);
    --bs-btn-border-color: var(--n-200);
    --bs-btn-hover-color: var(--ink-900);
    --bs-btn-hover-bg: var(--n-100);
    --bs-btn-hover-border-color: var(--n-300);
    background: #fff;
}
.btn-outline-primary {
    --bs-btn-color: var(--ink-800);
    --bs-btn-border-color: var(--n-200);
    --bs-btn-hover-bg: var(--ink-800);
    --bs-btn-hover-border-color: var(--ink-800);
    background: #fff;
}
.btn-outline-success {
    --bs-btn-color: var(--brand-700);
    --bs-btn-border-color: var(--brand-100);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    background: #fff;
}
.btn-outline-danger {
    --bs-btn-color: var(--rose-600);
    --bs-btn-border-color: #FECDD3;
    --bs-btn-hover-bg: var(--rose-600);
    --bs-btn-hover-border-color: var(--rose-600);
    background: #fff;
}
.btn-outline-warning {
    --bs-btn-color: #B45309;
    --bs-btn-border-color: #FDE68A;
    --bs-btn-hover-bg: var(--amber-600);
    --bs-btn-hover-border-color: var(--amber-600);
    --bs-btn-hover-color: #fff;
    background: #fff;
}
.btn-link { text-decoration: none; font-weight: 600; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    --bs-card-border-color: var(--n-200);
    --bs-card-border-radius: var(--r-lg);
    --bs-card-inner-border-radius: calc(var(--r-lg) - 1px);
    background: #fff;
    box-shadow: var(--sh-sm);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--n-150);
    padding: .75rem 1.1rem;
    font-size: var(--fs-sm);
    font-weight: 650;
    letter-spacing: -.005em;
    color: var(--ink-900);
}
.card-header i { color: var(--n-400); }
.card-body { padding: 1.1rem; }
.card-footer { background: var(--n-50); border-top: 1px solid var(--n-150); }
.card.border-0 { box-shadow: var(--sh-sm); }
.card.shadow-sm { box-shadow: var(--sh-sm) !important; }

/* Stat / KPI card */
.stat-card {
    background: #fff;
    border: 1px solid var(--n-200);
    border-radius: var(--r-lg);
    padding: .95rem 1.05rem;
    box-shadow: var(--sh-sm);
}
.stat-card .stat-label {
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--n-600);
}
.stat-card .stat-value {
    font-size: var(--fs-xl);
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--n-600);
    margin-bottom: .32rem;
    letter-spacing: .005em;
}
.form-control, .form-select {
    border-radius: var(--r-md);
    border: 1px solid var(--n-200);
    background-color: #fff;
    padding: .46rem .7rem;
    font-size: var(--fs-sm);
    color: var(--ink-900);
    box-shadow: var(--sh-xs);
    transition: border-color .13s ease, box-shadow .13s ease;
}
.form-control-lg, .form-select-lg { padding: .6rem .85rem; font-size: var(--fs-md); border-radius: var(--r-md); }
.form-control-sm, .form-select-sm { padding: .32rem .55rem; font-size: var(--fs-xs); border-radius: var(--r-sm); min-height: 34px; }
.form-control:hover, .form-select:hover { border-color: var(--n-300); }
.form-control:focus, .form-select:focus {
    border-color: var(--brand-500);
    box-shadow: var(--sh-ring);
}
.form-control::placeholder { color: var(--n-500); }
.form-control:disabled, .form-control[readonly] { background: var(--n-100); color: var(--n-500); }
.form-text { font-size: var(--fs-2xs); color: var(--n-500); }

.input-group-text {
    background: var(--n-50);
    border-color: var(--n-200);
    color: var(--n-500);
    font-size: .82rem;
}
.form-check-input {
    border-color: var(--n-300);
    box-shadow: var(--sh-xs);
}
.form-check-input:checked {
    background-color: var(--brand-600);
    border-color: var(--brand-600);
}
.form-check-input:focus { border-color: var(--brand-500); box-shadow: var(--sh-ring); }
.form-switch .form-check-input { width: 2.1em; height: 1.1em; }
.form-check-label { font-size: var(--fs-sm); }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table {
    --bs-table-border-color: var(--n-150);
    --bs-table-hover-bg: var(--n-50);
    margin-bottom: 0;
    font-size: var(--fs-sm);
    color: var(--bs-body-color);
}
.table > thead > tr > th {
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding: .6rem .8rem;
    white-space: nowrap;
    vertical-align: middle;
}
.table > tbody > tr > td { padding: .55rem .8rem; vertical-align: middle; }
.table > tbody > tr:last-child > td { border-bottom-color: transparent; }

/* Dark header rows read as heavy black bands. Swap for a quiet tinted band. */
.table > thead.table-dark,
.table > thead.table-dark > tr > th {
    --bs-table-bg: var(--n-100);
    --bs-table-color: var(--n-600);
    background: var(--n-100) !important;
    color: var(--n-600) !important;
    border-bottom: 1px solid var(--n-200);
    box-shadow: none;
}

/* Tables wrapped for scroll get the card treatment */
.table-responsive {
    background: #fff;
    border: 1px solid var(--n-200);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
    overflow: auto;
}
.table-responsive::-webkit-scrollbar { height: 8px; width: 8px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--n-300); border-radius: 8px; }
.card .table-responsive { border: none; box-shadow: none; border-radius: 0; }

.table-hover > tbody > tr { transition: background-color .1s ease; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
/* Soft, tinted pills instead of saturated blocks. */
.badge {
    font-weight: 650;
    font-size: var(--fs-2xs);
    letter-spacing: .01em;
    padding: .3em .6em;
    border-radius: var(--r-xs);
    line-height: 1.4;
}
.badge.rounded-pill { padding: .32em .7em; }
.badge.fs-6 { font-size: var(--fs-sm) !important; padding: .4em .75em; }

.badge.bg-secondary { background: var(--n-100) !important; color: var(--n-600) !important; box-shadow: 0 0 0 1px var(--n-200) inset; }
.badge.bg-success   { background: var(--brand-50) !important; color: var(--brand-700) !important; box-shadow: 0 0 0 1px var(--brand-100) inset; }
.badge.bg-danger    { background: var(--rose-50) !important;  color: #BE123C !important; box-shadow: 0 0 0 1px #FECDD3 inset; }
.badge.bg-warning   { background: var(--amber-50) !important; color: #B45309 !important; box-shadow: 0 0 0 1px #FDE68A inset; }
.badge.bg-info      { background: var(--sky-50) !important;   color: #0369A1 !important; box-shadow: 0 0 0 1px #BAE6FD inset; }
.badge.bg-primary   { background: var(--n-100) !important;    color: var(--ink-800) !important; box-shadow: 0 0 0 1px var(--n-200) inset; }
.badge.bg-dark      { background: var(--ink-800) !important;  color: #fff !important; }
.badge.text-dark    { color: #B45309 !important; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
    border-radius: var(--r-md);
    border: 1px solid transparent;
    padding: .7rem .9rem;
    font-size: var(--fs-sm);
    box-shadow: var(--sh-xs);
}
.alert-success { background: var(--brand-50); border-color: var(--brand-100); color: #065F46; }
.alert-danger  { background: var(--rose-50);  border-color: #FECDD3; color: #9F1239; }
.alert-warning { background: var(--amber-50); border-color: #FDE68A; color: #92400E; }
.alert-info    { background: var(--sky-50);   border-color: #BAE6FD; color: #075985; }
.alert-secondary { background: var(--n-50); border-color: var(--n-200); color: var(--n-600); }

/* ── Nav tabs ─────────────────────────────────────────────────────────────── */
.nav-tabs {
    --bs-nav-tabs-border-color: transparent;
    border-bottom: none;
    gap: .25rem;
}
.nav-tabs .nav-link {
    border: none;
    border-radius: var(--r-sm);
    padding: .4rem .8rem;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--n-600);
    background: transparent;
    transition: all .13s ease;
}
.nav-tabs .nav-link:hover { color: var(--ink-900); background: var(--n-100); }
.nav-tabs .nav-link.active {
    color: var(--ink-900);
    background: var(--n-100);
    box-shadow: 0 0 0 1px var(--n-200) inset;
}
.card-header-tabs { margin-bottom: -.25rem; }

/* ── Modals ───────────────────────────────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: var(--r-xl);
    box-shadow: var(--sh-lg);
    overflow: hidden;
}
.modal-header {
    border-bottom: 1px solid var(--n-150);
    padding: .95rem 1.25rem;
    background: #fff;
}
.modal-title { font-size: var(--fs-md); font-weight: 650; }
.modal-title i { color: var(--n-400); }
/* Coloured headers (bg-* text-white): the heading colour above would make the title unreadable. */
.modal-header.text-white .modal-title,
.modal-header.text-white .modal-title i { color: #fff; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--n-150); padding: .85rem 1.25rem; background: var(--n-50); }
.modal-backdrop.show { opacity: .4; }
.btn-close { --bs-btn-close-opacity: .4; }
.btn-close:hover { --bs-btn-close-opacity: .8; }

/* ── Dropdowns / tooltips / pagination ───────────────────────────────────── */
.dropdown-menu {
    border: 1px solid var(--n-200);
    border-radius: var(--r-md);
    box-shadow: var(--sh-md);
    padding: .3rem;
    font-size: var(--fs-sm);
}
.dropdown-item { border-radius: var(--r-xs); padding: .42rem .6rem; }
.dropdown-item:hover { background: var(--n-100); }

.tooltip-inner {
    background: var(--ink-900);
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    padding: .35rem .6rem;
    box-shadow: var(--sh-md);
    max-width: 230px;
}
.tooltip.show { opacity: 1; }
.tooltip .tooltip-arrow::before { border-top-color: var(--ink-900); border-bottom-color: var(--ink-900); }

.pagination {
    --bs-pagination-border-color: var(--n-200);
    --bs-pagination-color: var(--n-600);
    --bs-pagination-hover-bg: var(--n-100);
    --bs-pagination-hover-color: var(--ink-900);
    --bs-pagination-active-bg: var(--ink-800);
    --bs-pagination-active-border-color: var(--ink-800);
    --bs-pagination-border-radius: var(--r-sm);
    font-size: var(--fs-xs);
}
.page-link { font-weight: 600; box-shadow: var(--sh-xs); }
.page-link:focus { box-shadow: var(--sh-ring); }

.progress { border-radius: 999px; background: var(--n-150); height: .5rem; }
.progress-bar { background: var(--brand-600); }

hr { border-color: var(--n-200); opacity: 1; }

/* ── Scrollbars (desktop) ─────────────────────────────────────────────────── */
@media (min-width: 992px) {
    ::-webkit-scrollbar { width: 9px; height: 9px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--n-300); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
    ::-webkit-scrollbar-thumb:hover { background: var(--n-400); background-clip: content-box; }
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.app-footer {
    flex-shrink: 0;
    text-align: center;
    padding: .85rem 1rem;
    font-size: var(--fs-2xs);
    color: var(--n-500);
    letter-spacing: .01em;
    border-top: 1px solid var(--n-150);
    background: #fff;
}
.app-footer a { color: var(--n-500); text-decoration: none; font-weight: 600; }
.app-footer a:hover { color: var(--brand-700); }

/* ── Responsive app bar ───────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--ink-950);
        margin: 0 -1rem;
        padding: .5rem 1rem 1rem;
        border-top: 1px solid rgba(255, 255, 255, .07);
        box-shadow: 0 16px 32px -12px rgba(0, 0, 0, .6);
    }
    .navbar-nav { gap: 2px; align-items: stretch; }
    .navbar .nav-link { padding: .55rem .75rem !important; font-size: .85rem; }
    .navbar-util {
        justify-content: space-between;
        border-top: 1px solid rgba(255, 255, 255, .08);
        padding-top: .65rem;
        margin-top: .5rem;
    }
    .navbar-user { max-width: none; }
    .navbar-user .user-meta { display: flex !important; }
    .navbar-account-menu { min-width: 260px; }
    /* Groups expand in place on mobile — no floating panel over a scrolling sheet */
    .navbar-group-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin: 2px 0 2px .9rem;
        background: transparent;
        border: none;
        border-left: 1px solid rgba(255, 255, 255, .12);
        border-radius: 0;
        box-shadow: none;
        padding: 0 0 0 .4rem;
    }
    .navbar-group-menu .dropdown-item { padding: .55rem .6rem; font-size: var(--fs-sm); }
}
@media (max-width: 575.98px) {
    .navbar-brand { max-width: 170px; font-size: .9rem; }
    .brand-sub { display: none; }
}

/* ── Print ────────────────────────────────────────────────────────────────── */
@media print {
    .navbar, .btn, button, nav, .card-header .btn, #printBtn, .app-footer {
        display: none !important;
    }
    body { background: #fff; }
    .card, .table-responsive { border: none !important; box-shadow: none !important; }
    .table > thead.table-dark > tr > th { background: #fff !important; color: #000 !important; }
}

/* ── Touch targets ────────────────────────────────────────────────────────────
   WCAG 2.5.5 and both platform guidelines want 44px. On a coarse pointer the
   small icon buttons are promoted to the full tap target without changing how
   they look: the glyph stays its drawn size, the hit area grows around it.

   Only ISOLATED controls get the invisible overlay. A 44px overlay on a
   control that sits a few px from its neighbour would overlap it and steal
   the tap, and a mis-tap on a till is worse than a small target — so tightly
   packed pairs (the discount ok/cancel, the custom-row actions) are given
   real size instead, and the steppers are already 44px in their own right. */
@media (pointer: coarse) {
    .btn, .btn-sm, .form-control, .form-select,
    .form-control-sm, .form-select-sm { min-height: var(--tap); }

    .rm-btn, .tc2-rm, .mcp-rm, .cs-close, .btn-logout, .pos-mic-btn {
        position: relative;
    }
    .rm-btn::after, .tc2-rm::after, .mcp-rm::after,
    .cs-close::after, .btn-logout::after, .pos-mic-btn::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: var(--tap);
        height: var(--tap);
        transform: translate(-50%, -50%);
    }

    /* Packed controls: grow the control itself, no overlay. */
    .save-inv-btn,
    .tc2-disc-ok,
    .tc2-disc-cancel { min-width: 36px; min-height: 36px; }

    .form-check-input { width: 1.25em; height: 1.25em; }
}

/* ── Motion preference ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
