/*
 * Blue POS — admin theme
 * Layered on top of Bootstrap 5. All colour comes from CSS custom properties
 * so a buyer can rebrand the whole panel by overriding :root.
 */

:root {
    --bp-primary: #2563eb;
    --bp-primary-dark: #1d4ed8;
    --bp-primary-soft: #eff6ff;
    --bp-sidebar-bg: #0f172a;
    --bp-sidebar-fg: #94a3b8;
    --bp-sidebar-fg-active: #ffffff;
    --bp-sidebar-hover: #1e293b;
    --bp-sidebar-width: 264px;
    --bp-topbar-h: 60px;
    --bp-body-bg: #f1f5f9;
    --bp-card-bg: #ffffff;
    --bp-border: #e2e8f0;
    --bp-text: #0f172a;
    /* #64748b was 4.3:1 on the grey page; this passes on page, card and tint. */
    --bp-text-muted: #5b6b80;
    --bp-radius: 10px;
}

[data-bp-theme="dark"] {
    --bp-body-bg: #0b1220;
    --bp-card-bg: #111c30;
    --bp-border: #1e293b;
    --bp-text: #e2e8f0;
    --bp-text-muted: #94a3b8;
    --bp-primary-soft: #16243d;
}

body {
    background: var(--bp-body-bg);
    color: var(--bp-text);
    font-size: 14px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Layout ---------- */

.bp-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--bp-sidebar-width);
    background: var(--bp-sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .2s ease;
}

.bp-sidebar__brand {
    height: var(--bp-topbar-h);
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: 0 1.125rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.0625rem;
    letter-spacing: -.01em;
    flex: 0 0 auto;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.bp-sidebar__brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--bp-primary);
    display: grid;
    place-items: center;
    font-size: .9rem;
}

.bp-sidebar__nav {
    overflow-y: auto;
    padding: .75rem 0 1.5rem;
    flex: 1 1 auto;
    scrollbar-width: thin;
}

.bp-sidebar__group-label {
    padding: 1rem 1.125rem .375rem;
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    /* 2.4:1 against the sidebar before; this reads at about 6:1. */
    color: #94a3b8;
}

.bp-nav-link {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .5rem 1.125rem;
    color: var(--bp-sidebar-fg);
    text-decoration: none;
    font-size: .8125rem;
    border-left: 3px solid transparent;
}

.bp-nav-link:hover {
    background: var(--bp-sidebar-hover);
    color: var(--bp-sidebar-fg-active);
}

.bp-nav-link.active {
    background: var(--bp-sidebar-hover);
    color: var(--bp-sidebar-fg-active);
    border-left-color: var(--bp-primary);
    font-weight: 500;
}

.bp-nav-link i {
    font-size: 1rem;
    width: 1.125rem;
    text-align: center;
}

.bp-nav-toggle {
    background: none;
    border: 0;
    width: 100%;
    justify-content: space-between;
}

.bp-nav-toggle .bi-chevron-down {
    font-size: .7rem;
    transition: transform .18s ease;
}

.bp-nav-toggle[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.bp-nav-sub .bp-nav-link {
    padding-left: 3rem;
    font-size: .8125rem;
}

.bp-main {
    margin-left: var(--bp-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.bp-topbar {
    height: var(--bp-topbar-h);
    background: var(--bp-card-bg);
    border-bottom: 1px solid var(--bp-border);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.bp-content {
    padding: 1.25rem;
    flex: 1 1 auto;
}

/* ---------- Components ---------- */

.bp-card {
    background: var(--bp-card-bg);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
}

.bp-card__header {
    padding: .875rem 1.125rem;
    border-bottom: 1px solid var(--bp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.bp-card__title {
    font-size: .9375rem;
    font-weight: 600;
    margin: 0;
}

.bp-card__body {
    padding: 1.125rem;
}

.bp-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.125rem;
}

.bp-page-head h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.bp-page-head .breadcrumb {
    margin: .1875rem 0 0;
    font-size: .78125rem;
}

.bp-stat {
    display: flex;
    align-items: center;
    gap: .875rem;
}

.bp-stat__icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    background: var(--bp-primary-soft);
    color: var(--bp-primary);
    flex: 0 0 auto;
}

.bp-stat__value {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.15;
}

.bp-stat__label {
    font-size: .78125rem;
    color: var(--bp-text-muted);
}

.bp-module-card {
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    background: var(--bp-card-bg);
    padding: 1rem;
    height: 100%;
    display: flex;
    gap: .875rem;
}

.bp-module-card--off { opacity: .62; }

.bp-module-card__icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--bp-primary-soft);
    color: var(--bp-primary);
    flex: 0 0 auto;
}

.bp-perm-group {
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    margin-bottom: .875rem;
    overflow: hidden;
}

.bp-perm-group__head {
    padding: .625rem .875rem;
    background: var(--bp-primary-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    font-weight: 600;
    font-size: .8125rem;
}

.bp-perm-group__body {
    padding: .875rem;
}

.form-label { font-size: .8125rem; font-weight: 500; margin-bottom: .3125rem; }
.form-control, .form-select { font-size: .8125rem; }
.table { font-size: .8125rem; --bs-table-bg: transparent; }
.table > thead th {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bp-text-muted);
    font-weight: 600;
    border-bottom-width: 1px;
}
.btn { font-size: .8125rem; }
.btn-primary { --bs-btn-bg: var(--bp-primary); --bs-btn-border-color: var(--bp-primary); --bs-btn-hover-bg: var(--bp-primary-dark); --bs-btn-hover-border-color: var(--bp-primary-dark); }
.badge { font-weight: 500; }

/* ---------- Auth ---------- */

.bp-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
}

.bp-auth__card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(2, 6, 23, .28);
}

/* ---------- Responsive ---------- */

@media (max-width: 991.98px) {
    .bp-sidebar { transform: translateX(-100%); }
    .bp-sidebar.is-open { transform: translateX(0); }
    .bp-main { margin-left: 0; }
    .bp-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, .45);
        z-index: 1035;
    }
}

/* ---------- RTL ---------- */

[dir="rtl"] .bp-sidebar { inset: 0 0 0 auto; }
[dir="rtl"] .bp-main { margin-left: 0; margin-right: var(--bp-sidebar-width); }
[dir="rtl"] .bp-nav-link { border-left: 0; border-right: 3px solid transparent; }
[dir="rtl"] .bp-nav-link.active { border-right-color: var(--bp-primary); }
[dir="rtl"] .bp-nav-sub .bp-nav-link { padding-left: 1.125rem; padding-right: 3rem; }

@media (max-width: 991.98px) {
    [dir="rtl"] .bp-sidebar { transform: translateX(100%); }
    [dir="rtl"] .bp-sidebar.is-open { transform: translateX(0); }
    [dir="rtl"] .bp-main { margin-right: 0; }
}

/* ---------- Point of sale register ---------- */

.bp-pos {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 400px;
    background: var(--bp-body-bg);
    overflow: hidden;
}

.bp-pos__catalogue { display: flex; flex-direction: column; min-width: 0; }

.bp-pos__bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .625rem .875rem;
    background: var(--bp-card-bg);
    border-bottom: 1px solid var(--bp-border);
}

.bp-pos__cats {
    display: flex;
    gap: .375rem;
    padding: .5rem .875rem;
    overflow-x: auto;
    background: var(--bp-card-bg);
    border-bottom: 1px solid var(--bp-border);
    scrollbar-width: thin;
}

.bp-pos__cat {
    flex: 0 0 auto;
    padding: .3125rem .75rem;
    border-radius: 999px;
    border: 1px solid var(--bp-border);
    background: transparent;
    font-size: .75rem;
    color: var(--bp-text);
    white-space: nowrap;
}
.bp-pos__cat.is-active { background: var(--bp-primary); border-color: var(--bp-primary); color: #fff; }

.bp-pos__grid {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: .75rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: .5rem;
    align-content: start;
}

.bp-tile {
    background: var(--bp-card-bg);
    border: 1px solid var(--bp-border);
    border-radius: 10px;
    padding: .5rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    cursor: pointer;
    min-height: 96px;
}
.bp-tile:active { transform: scale(.98); }
.bp-tile__name { font-size: .78125rem; font-weight: 600; line-height: 1.2; }
.bp-tile__meta { font-size: .68rem; color: var(--bp-text-muted); margin-top: auto; }
.bp-tile__price { font-size: .875rem; font-weight: 700; color: var(--bp-primary); }
.bp-tile--out { opacity: .5; }

.bp-pos__cart {
    background: var(--bp-card-bg);
    border-left: 1px solid var(--bp-border);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bp-pos__lines { flex: 1 1 auto; overflow-y: auto; }

.bp-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .25rem .5rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--bp-border);
    font-size: .8125rem;
}
.bp-line__qty { display: flex; align-items: center; gap: .25rem; }
.bp-line__qty input { width: 54px; text-align: center; }

.bp-pos__totals { padding: .75rem; border-top: 1px solid var(--bp-border); }
.bp-pos__grand { font-size: 1.5rem; font-weight: 700; }

@media (max-width: 991.98px) {
    .bp-pos { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
    /*
     * The cart's own controls are taller than half a phone screen, so a
     * flexible lines area was squeezed to nothing and the cashier could not
     * see what was being sold. Here the cart scrolls as one, the lines keep
     * their height and the pay button stays in reach.
     */
    .bp-pos__cart { border-left: 0; border-top: 1px solid var(--bp-border); max-height: 52vh; overflow-y: auto; }
    .bp-pos__lines { flex: 0 0 auto; overflow: visible; }
    #posPay { position: sticky; bottom: .5rem; z-index: 2; box-shadow: 0 -.5rem 1rem var(--bp-card-bg); }
}

/*
 * ---------------------------------------------------------------------------
 * Right to left
 * ---------------------------------------------------------------------------
 *
 * Bootstrap ships a separate RTL stylesheet, but swapping stylesheets means
 * shipping and cache-busting two builds. These rules flip the handful of
 * places Blue POS sets a side explicitly; everything else is already
 * direction-agnostic because it uses flexbox rather than floats.
 */

[dir="rtl"] .bp-sidebar { left: auto; right: 0; }
[dir="rtl"] .bp-main { margin-left: 0; margin-right: var(--bp-sidebar-width); }
[dir="rtl"] .bp-sidebar__link { text-align: right; }
[dir="rtl"] .bp-sidebar__link i { margin-right: 0; margin-left: .625rem; }
[dir="rtl"] .me-1, [dir="rtl"] .me-2, [dir="rtl"] .me-3 { margin-right: 0 !important; }
[dir="rtl"] .me-1 { margin-left: .25rem !important; }
[dir="rtl"] .me-2 { margin-left: .5rem !important; }
[dir="rtl"] .me-3 { margin-left: 1rem !important; }
[dir="rtl"] .ms-1, [dir="rtl"] .ms-2, [dir="rtl"] .ms-3 { margin-left: 0 !important; }
[dir="rtl"] .ms-1 { margin-right: .25rem !important; }
[dir="rtl"] .ms-2 { margin-right: .5rem !important; }
[dir="rtl"] .ms-3 { margin-right: 1rem !important; }
[dir="rtl"] .ms-auto { margin-left: 0 !important; margin-right: auto !important; }
[dir="rtl"] .text-end { text-align: left !important; }
[dir="rtl"] .text-start { text-align: right !important; }
[dir="rtl"] .dropdown-menu-end { --bs-position: start; right: auto; left: 0; }
[dir="rtl"] .border-start { border-left: 0 !important; border-right: var(--bs-border-width) solid var(--bs-border-color) !important; }
[dir="rtl"] .input-group > :first-child { border-radius: 0 var(--bp-radius) var(--bp-radius) 0; }
[dir="rtl"] .input-group > :last-child { border-radius: var(--bp-radius) 0 0 var(--bp-radius); }

@media (max-width: 991.98px) {
    [dir="rtl"] .bp-main { margin-right: 0; }
    [dir="rtl"] .bp-sidebar { transform: translateX(100%); }
    [dir="rtl"] .bp-sidebar.is-open { transform: translateX(0); }
}

/*
 * ---------------------------------------------------------------------------
 * Receipts
 * ---------------------------------------------------------------------------
 *
 * A receipt is printed on white paper by a thermal printer that knows nothing
 * about dark mode, so the printed copy is forced black on white whatever the
 * interface theme — getting this wrong wastes a roll of paper printing a
 * black rectangle. On screen, the preview follows the theme (see "Dark
 * theme" below) so it does not glare out of a dark panel.
 */

.bp-receipt {
    background: #fff !important;
    color: #000 !important;
    font-family: "Courier New", ui-monospace, monospace;
    font-size: 12px;
    line-height: 1.35;
}

.bp-receipt[dir="rtl"] { text-align: right; }
.bp-receipt--58 { width: 58mm; max-width: 58mm; }
.bp-receipt--80 { width: 80mm; max-width: 80mm; }

@media print {
    body { background: #fff !important; }
    .no-print, .bp-sidebar, .bp-topbar { display: none !important; }
    .bp-main { margin: 0 !important; }
    .bp-receipt { width: auto; max-width: none; }
    @page { margin: 3mm; }
}

/*
 * ---------------------------------------------------------------------------
 * Interface preferences
 * ---------------------------------------------------------------------------
 */

[data-bp-density="compact"] .table > :not(caption) > * > * { padding: .3rem .5rem; }
[data-bp-density="roomy"] .table > :not(caption) > * > * { padding: .85rem .75rem; }

[data-bp-font="system"] { --bp-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[data-bp-font="serif"] { --bp-font: Georgia, "Times New Roman", serif; }
[data-bp-font="mono"] { --bp-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
[data-bp-font] body, [data-bp-font] .table { font-family: var(--bp-font); }

[data-bp-sidebar="compact"] { --bp-sidebar-width: 76px; }
[data-bp-sidebar="compact"] .bp-sidebar__link span,
[data-bp-sidebar="compact"] .bp-sidebar__group-label { display: none; }
[data-bp-sidebar="compact"] .bp-sidebar__link { justify-content: center; }
[data-bp-sidebar="hidden"] { --bp-sidebar-width: 0px; }
[data-bp-sidebar="hidden"] .bp-sidebar { transform: translateX(-100%); }

/*
 * ---------------------------------------------------------------------------
 * Register tile sizes
 * ---------------------------------------------------------------------------
 *
 * The cashier picks this, not the shop: somebody working a busy counter wants
 * big targets, somebody with a two-thousand-line catalogue wants the list.
 */

[data-bp-tiles="small"] .bp-pos__grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
[data-bp-tiles="medium"] .bp-pos__grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
[data-bp-tiles="large"] .bp-pos__grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

[data-bp-tiles="list"] .bp-pos__grid { grid-template-columns: 1fr; }
[data-bp-tiles="list"] .bp-tile {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    text-align: start;
    min-height: 0;
    padding: .5rem .75rem;
}
[data-bp-tiles="list"] .bp-tile__name { flex: 1 1 auto; }
[data-bp-tiles="list"] .bp-tile__price { order: 3; font-weight: 600; }
[data-bp-tiles="list"] .bp-tile__meta { order: 2; }

.bp-pos__line {
    display: flex;
    gap: .75rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--bp-border);
    cursor: pointer;
}
.bp-pos__line:hover { background: var(--bp-primary-soft); }
.bp-pos__line-name { font-weight: 600; font-size: .85rem; }
.bp-pos__line-meta { font-size: .75rem; color: var(--bp-text-muted); }
.bp-pos__line-total { font-weight: 600; white-space: nowrap; }

#posSecondaryFilters { gap: .5rem; }

/* ---------------- Restaurant floor plan ---------------- */

.bp-plan {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background:
        linear-gradient(var(--bp-border) 1px, transparent 1px) 0 0 / 5% 8%,
        linear-gradient(90deg, var(--bp-border) 1px, transparent 1px) 0 0 / 5% 8%,
        var(--bp-card-bg);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    overflow: hidden;
    touch-action: none;
}

.bp-plan__table {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 10px;
    border: 2px solid transparent;
    font-size: .8rem;
    line-height: 1.2;
    padding: 2px;
    cursor: pointer;
    user-select: none;
    color: #0f172a;
    overflow: hidden;
}

.bp-plan__table--round { border-radius: 50%; }
.bp-plan__table strong { font-size: 1rem; }
.bp-plan__table small { opacity: .8; }
.bp-plan__table--free { background: #dcfce7; border-color: #22c55e; }
.bp-plan__table--occupied { background: #fee2e2; border-color: #ef4444; }
.bp-plan__table--reserved { background: #fef9c3; border-color: #eab308; }
.bp-plan__table--cleaning { background: #e2e8f0; border-color: #94a3b8; border-style: dashed; }
.bp-plan__table--ready { box-shadow: 0 0 0 3px #2563eb; }
.bp-plan__table.is-dragging { opacity: .75; z-index: 5; }

.bp-plan__resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 14px;
    height: 14px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(15, 23, 42, .5) 50%);
}

.bp-plan--edit .bp-plan__table { cursor: move; }

.bp-plan-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--bp-text-muted); }
.bp-plan-legend span::before { content: ''; display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-inline-end: .3rem; vertical-align: -1px; }
.bp-plan-legend .is-free::before { background: #22c55e; }
.bp-plan-legend .is-reserved::before { background: #eab308; }
.bp-plan-legend .is-occupied::before { background: #ef4444; }
.bp-plan-legend .is-cleaning::before { background: #94a3b8; }

@media (max-width: 575.98px) {
    .bp-plan { aspect-ratio: 3 / 4; }
    .bp-plan__table { font-size: .65rem; }
    .bp-plan__table strong { font-size: .8rem; }
}

/*
 * ---------------------------------------------------------------------------
 * Dark theme
 * ---------------------------------------------------------------------------
 *
 * theme-boot.js sets data-bp-theme and Bootstrap's own data-bs-theme on
 * <html> before the first paint, so Bootstrap's tables, forms, modals,
 * dropdowns, list groups and nav tabs turn dark by themselves. What follows
 * covers the rest: Blue POS's own components, the vendor widgets that carry
 * hard-coded colours (Select2, DataTables, SweetAlert, toastr), and the
 * Bootstrap utilities that are not theme-aware (.btn-light, .bg-white).
 */

[data-bp-theme="dark"] {
    color-scheme: dark;
    --bp-sidebar-bg: #070d19;
    --bp-sidebar-hover: #15203a;
    --bp-input-bg: #0e1729;
    --bp-hover: #16223a;
    --bs-body-bg: var(--bp-body-bg);
    --bs-body-color: var(--bp-text);
    --bs-secondary-color: var(--bp-text-muted);
    --bs-border-color: var(--bp-border);
    --bs-tertiary-bg: #15203a;
    --bs-secondary-bg: #15203a;
    --bs-emphasis-color: #f8fafc;
    --bs-link-color: #60a5fa;
    --bs-link-hover-color: #93c5fd;
    --bs-link-color-rgb: 96, 165, 250;
}

[data-bp-theme="dark"] .bp-topbar,
[data-bp-theme="dark"] .modal-content,
[data-bp-theme="dark"] .dropdown-menu,
[data-bp-theme="dark"] .offcanvas,
[data-bp-theme="dark"] .card,
[data-bp-theme="dark"] .list-group-item,
[data-bp-theme="dark"] .popover,
[data-bp-theme="dark"] .accordion-item {
    background-color: var(--bp-card-bg);
    color: var(--bp-text);
    border-color: var(--bp-border);
}

[data-bp-theme="dark"] .popover { --bs-popover-bg: var(--bp-card-bg); --bs-popover-body-color: var(--bp-text); --bs-popover-header-bg: var(--bs-tertiary-bg); }
[data-bp-theme="dark"] .dropdown-item { color: var(--bp-text); }
[data-bp-theme="dark"] .dropdown-item:hover,
[data-bp-theme="dark"] .dropdown-item:focus { background: var(--bp-hover); color: #fff; }

/* Tables */
[data-bp-theme="dark"] .table { --bs-table-color: var(--bp-text); --bs-table-border-color: var(--bp-border); --bs-table-striped-bg: rgba(255, 255, 255, .03); --bs-table-hover-bg: var(--bp-hover); --bs-table-hover-color: var(--bp-text); }
[data-bp-theme="dark"] .table-light,
[data-bp-theme="dark"] .table > thead.table-light > tr > th { --bs-table-bg: #15203a; --bs-table-color: var(--bp-text-muted); --bs-table-border-color: var(--bp-border); }
[data-bp-theme="dark"] .sticky-top.bg-body,
[data-bp-theme="dark"] thead.bg-white { background-color: var(--bp-card-bg) !important; }

/* Forms */
[data-bp-theme="dark"] .form-control,
[data-bp-theme="dark"] .form-select,
[data-bp-theme="dark"] .input-group-text {
    background-color: var(--bp-input-bg);
    color: var(--bp-text);
    border-color: #26334d;
}
[data-bp-theme="dark"] .form-control:disabled,
[data-bp-theme="dark"] .form-control[readonly] { background-color: #121c2f; color: var(--bp-text-muted); }
[data-bp-theme="dark"] .form-control::placeholder { color: #64748b; }
[data-bp-theme="dark"] .form-check-input:not(:checked) { background-color: var(--bp-input-bg); border-color: #334155; }

/* Buttons and utilities that Bootstrap leaves light */
[data-bp-theme="dark"] .btn-light {
    --bs-btn-bg: #15203a; --bs-btn-color: var(--bp-text); --bs-btn-border-color: #26334d;
    --bs-btn-hover-bg: #1c2944; --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #334155;
    --bs-btn-active-bg: #22304f; --bs-btn-active-color: #fff; --bs-btn-active-border-color: #334155;
}
[data-bp-theme="dark"] .btn-outline-secondary { --bs-btn-color: var(--bp-text-muted); --bs-btn-border-color: #334155; }
[data-bp-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-bp-theme="dark"] .bg-white,
[data-bp-theme="dark"] .bg-light { background-color: var(--bp-card-bg) !important; }
[data-bp-theme="dark"] .text-dark { color: var(--bp-text) !important; }
[data-bp-theme="dark"] .text-muted { color: var(--bp-text-muted) !important; }
[data-bp-theme="dark"] .border,
[data-bp-theme="dark"] .border-top,
[data-bp-theme="dark"] .border-bottom,
[data-bp-theme="dark"] .border-start,
[data-bp-theme="dark"] .border-end { border-color: var(--bp-border) !important; }
[data-bp-theme="dark"] .breadcrumb-item.active { color: var(--bp-text-muted); }
[data-bp-theme="dark"] .nav-tabs { --bs-nav-tabs-border-color: var(--bp-border); --bs-nav-tabs-link-active-bg: var(--bp-card-bg); --bs-nav-tabs-link-active-border-color: var(--bp-border) var(--bp-border) var(--bp-card-bg); }
[data-bp-theme="dark"] .alert-light { --bs-alert-bg: #15203a; --bs-alert-color: var(--bp-text); --bs-alert-border-color: var(--bp-border); }
[data-bp-theme="dark"] .progress { --bs-progress-bg: #1e293b; }
[data-bp-theme="dark"] .bp-auth__card { background: var(--bp-card-bg); color: var(--bp-text); }

/* Select2 */
[data-bp-theme="dark"] .select2-container--bootstrap-5 .select2-selection { background-color: var(--bp-input-bg); border-color: #26334d; color: var(--bp-text); }
[data-bp-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { color: var(--bp-text); }
[data-bp-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown { background-color: var(--bp-card-bg); border-color: #26334d; color: var(--bp-text); }
[data-bp-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field { background-color: var(--bp-input-bg); color: var(--bp-text); border-color: #26334d; }
[data-bp-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background-color: var(--bp-hover); color: #fff; }
[data-bp-theme="dark"] .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice { color: var(--bp-text); border-color: #334155; }

/* DataTables */
[data-bp-theme="dark"] div.dt-container .dt-paging .dt-paging-button,
[data-bp-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button { color: var(--bp-text) !important; }
[data-bp-theme="dark"] div.dt-container .dt-input,
[data-bp-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-bp-theme="dark"] .dataTables_wrapper .dataTables_length select { background-color: var(--bp-input-bg); color: var(--bp-text); border-color: #26334d; }
[data-bp-theme="dark"] table.dataTable > tbody > tr.selected > * { box-shadow: inset 0 0 0 9999px rgba(37, 99, 235, .35); color: #fff; }

/* SweetAlert and toasts */
/*
 * Every dialog in the shop's own colours. SweetAlert falls back to its own
 * purple whenever a call does not pass a colour (park a basket, guests at a
 * table, approvals); a colour passed in a call still wins.
 */
.swal2-styled.swal2-confirm { background-color: var(--bp-primary); }
.swal2-styled.swal2-cancel { background-color: #64748b; }
.swal2-styled.swal2-deny { background-color: #dc2626; }

[data-bp-theme="dark"] .swal2-popup { background: var(--bp-card-bg); color: var(--bp-text); }
[data-bp-theme="dark"] .swal2-title,
[data-bp-theme="dark"] .swal2-html-container { color: var(--bp-text); }
[data-bp-theme="dark"] .swal2-input,
[data-bp-theme="dark"] .swal2-textarea { background: var(--bp-input-bg); color: var(--bp-text); border-color: #26334d; }

/* Register */
[data-bp-theme="dark"] .bp-tile { color: var(--bp-text); }
[data-bp-theme="dark"] .bp-tile:hover { border-color: var(--bp-primary); }
[data-bp-theme="dark"] .bp-pos__cat { background: var(--bp-card-bg); }
[data-bp-theme="dark"] .bp-tile__price { color: #60a5fa; }

/* Floor plan tables keep their status colours but lose the glare */
[data-bp-theme="dark"] .bp-plan__table--free { background: #14532d; border-color: #22c55e; color: #dcfce7; }
[data-bp-theme="dark"] .bp-plan__table--occupied { background: #7f1d1d; border-color: #ef4444; color: #fee2e2; }
[data-bp-theme="dark"] .bp-plan__table--reserved { background: #713f12; border-color: #eab308; color: #fef9c3; }
[data-bp-theme="dark"] .bp-plan__table--cleaning { background: #1e293b; border-color: #94a3b8; color: #e2e8f0; }

/* Charts sit on the card; the canvas itself is recoloured by app.js. */
[data-bp-theme="dark"] canvas { color-scheme: dark; }

/* Receipt previews follow the theme on screen only. */
@media screen {
    [data-bp-theme="dark"] .bp-receipt {
        background: #0e1729 !important;
        color: #e2e8f0 !important;
        border-color: var(--bp-border) !important;
    }
}

@media print {
    [data-bp-theme="dark"] body,
    [data-bp-theme="dark"] .bp-receipt,
    [data-bp-theme="dark"] .bp-card {
        background: #fff !important;
        color: #000 !important;
    }
}

/*
 * ---------------------------------------------------------------------------
 * Data table text size
 * ---------------------------------------------------------------------------
 *
 * Per person, like density: a warehouse terminal read from arm's length
 * wants large, a laptop full of columns wants small.
 */

[data-bp-table-size="small"] .table { font-size: .75rem; }
[data-bp-table-size="small"] .table > thead th { font-size: .625rem; }
[data-bp-table-size="large"] .table { font-size: .9375rem; }
[data-bp-table-size="large"] .table > thead th { font-size: .75rem; }

/*
 * ---------------------------------------------------------------------------
 * Page help
 * ---------------------------------------------------------------------------
 */

.bp-help {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin: -.375rem 0 1.125rem;
    padding: .75rem 1rem;
    border: 1px solid var(--bp-border);
    border-inline-start: 3px solid var(--bp-primary);
    border-radius: var(--bp-radius);
    background: var(--bp-primary-soft);
    font-size: .8125rem;
}
.bp-help__icon { color: var(--bp-primary); font-size: 1.1rem; line-height: 1.2; }
.bp-help__body { flex: 1 1 auto; }
.bp-help__title { font-weight: 600; margin-bottom: .125rem; }
.bp-help__dismiss { white-space: nowrap; text-decoration: none; }
.bp-page-head h1 .bp-help-icon { font-size: .95rem; vertical-align: .1em; }

/* ---------- Contrast (WCAG AA, 4.5:1 for small text) ---------- */

/* Bootstrap's amber is 1.6:1 on white; the darker amber reads. */
.text-warning { color: #b45309 !important; }

/* Links on tinted panels sit a shade darker than the accent itself,
   whichever accent the shop chose. */
.bp-page-head .breadcrumb a,
.bp-help__dismiss { color: color-mix(in srgb, var(--bp-primary) 78%, #000); }

[data-bp-theme="dark"] .text-danger { color: #f87171 !important; }
[data-bp-theme="dark"] .text-success { color: #4ade80 !important; }
[data-bp-theme="dark"] .text-warning { color: #fbbf24 !important; }
[data-bp-theme="dark"] .bp-page-head .breadcrumb a,
[data-bp-theme="dark"] .bp-help__dismiss { color: #93c5fd; }
[data-bp-theme="dark"] .select2-container .select2-selection__placeholder { color: #94a3b8 !important; }
[data-bp-theme="dark"] .btn-outline-danger { --bs-btn-color: #f87171; --bs-btn-border-color: #f87171; }
[data-bp-theme="dark"] .btn-outline-primary { --bs-btn-color: #93c5fd; --bs-btn-border-color: #60a5fa; }
/* Tabs and red outline buttons on the light grey page sat just under 4.5:1. */
[data-bp-theme="light"] .nav-tabs .nav-link:not(.active),
[data-bp-theme="light"] .nav-pills .nav-link:not(.active) { color: color-mix(in srgb, var(--bp-primary) 80%, #000); }
[data-bp-theme="light"] .btn-outline-danger { --bs-btn-color: #b91c1c; --bs-btn-border-color: #b91c1c; }

/* Skip-link target: focus moves here, no ring needed on the whole page. */
#bp-main:focus { outline: none; }
