/*
 * Boutigi design system — layered on AdminLTE 3 / Bootstrap 4.
 * Brand colors come from the business settings (--brand-sidebar, --brand-navbar).
 * Dark mode: <body class="dark-mode"> (AdminLTE) + the overrides at the end.
 */

:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    --c-primary: #0b6bcb;
    --c-primary-soft: #e7f1fc;
    --c-success: #1a8754;
    --c-success-soft: #e6f4ec;
    --c-warning: #b7791f;
    --c-warning-soft: #fdf3e1;
    --c-danger: #c53030;
    --c-danger-soft: #fdecec;
    --c-info: #0e7490;
    --c-info-soft: #e3f4f8;

    --c-bg: #f4f6fa;
    --c-surface: #ffffff;
    --c-surface-2: #f8fafc;
    --c-border: #e3e8ef;
    --c-text: #1f2937;
    --c-muted: #6b7280;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
}

/* ---------- Base ---------- */

body,
.btn,
.form-control,
.popover,
.tooltip {
    font-family: var(--font-sans);
}

body {
    color: var(--c-text);
    font-size: .95rem;
}

.content-wrapper {
    background: var(--c-bg);
}

a {
    color: var(--c-primary);
}

.text-monospace,
code {
    font-family: var(--font-mono);
}

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

.brand-sidebar {
    background-color: var(--brand-sidebar, #075e98) !important;
}

.brand-navbar {
    background-color: var(--brand-navbar, #ffffff) !important;
    border-bottom: 1px solid var(--c-border);
}

.main-sidebar .nav-header {
    font-size: .68rem;
    letter-spacing: .08em;
    opacity: .65;
    padding-top: 1rem;
}

.main-sidebar .nav-sidebar .nav-link {
    border-radius: var(--radius-sm);
}

.main-sidebar .nav-sidebar .nav-link .badge {
    font-size: .68rem;
}

.content-header {
    padding: 1.25rem .5rem .5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 650;
    letter-spacing: -.01em;
    margin: 0;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.page-actions form {
    display: inline-flex;
}

.breadcrumb-slim {
    font-size: .8rem;
    color: var(--c-muted);
    margin-bottom: .25rem;
}

.breadcrumb-slim a {
    color: var(--c-muted);
}

/* ---------- Cards ---------- */

.card {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card > .card-header {
    background: transparent;
    border-bottom: 1px solid var(--c-border);
    padding: .85rem 1.1rem;
}

.card-title {
    font-weight: 600;
    font-size: 1rem;
}

.card-footer {
    background: var(--c-surface-2);
    border-top: 1px solid var(--c-border);
}

/* ---------- KPI tiles ---------- */

.stat-box {
    border: 1px solid var(--c-border) !important;
    border-left-width: 4px !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm);
    background: var(--c-surface) !important;
}

.stat-box .inner h4 {
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}

.stat-box .icon {
    opacity: .18;
}

.stat-box .small-box-footer {
    border-radius: 0 0 var(--radius) var(--radius);
}

.stat-trend {
    font-size: .78rem;
    font-weight: 600;
}

.stat-trend.up {
    color: var(--c-success);
}

.stat-trend.down {
    color: var(--c-danger);
}

/* ---------- Tables ---------- */

.table {
    color: var(--c-text);
}

.table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--c-border);
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--c-muted);
    background: var(--c-surface-2);
    white-space: nowrap;
}

.table td,
.table th {
    vertical-align: middle;
    border-top-color: var(--c-border);
}

.table-hover tbody tr:hover {
    background: var(--c-primary-soft);
}

.table-money,
.text-money {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Long tables keep their header visible */
.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* ---------- Forms & buttons ---------- */

.form-control,
.custom-select,
.select2-container--bootstrap4 .select2-selection {
    border-radius: var(--radius-sm);
    border-color: #d5dbe3;
}

.form-control:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 .2rem rgba(11, 107, 203, .15);
}

label {
    font-weight: 600;
    font-size: .88rem;
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.btn-primary {
    background: var(--c-primary);
    border-color: var(--c-primary);
}

.btn-light {
    background: var(--c-surface-2);
    border-color: var(--c-border);
}

.form-actions-sticky {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    padding: .75rem 1rem;
    margin: 0 -1rem;
}

/* ---------- Badges (soft) ---------- */

.badge {
    font-weight: 600;
    border-radius: 999px;
    padding: .3em .65em;
}

.badge-success { background: var(--c-success-soft); color: var(--c-success); }
.badge-warning { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-info { background: var(--c-info-soft); color: var(--c-info); }
.badge-primary { background: var(--c-primary-soft); color: var(--c-primary); }
.badge-secondary { background: #eef0f3; color: #4b5563; }
.badge-light { background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-border); }
.badge-dark { background: #1f2937; color: #fff; }

.navbar-badge {
    font-size: .6rem;
}

.navbar-badge.badge-danger {
    background: var(--c-danger);
    color: #fff;
}

/* ---------- Alerts & toasts ---------- */

.alert {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.toast-stack {
    position: fixed;
    top: 4.25rem;
    right: 1rem;
    z-index: 1080;
    width: min(380px, calc(100vw - 2rem));
}

.toast-stack .toast {
    max-width: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 0;
    border-left: 4px solid var(--c-primary);
    background: var(--c-surface);
    opacity: 1;
}

.toast-stack .toast.toast-success { border-left-color: var(--c-success); }
.toast-stack .toast.toast-error { border-left-color: var(--c-danger); }
.toast-stack .toast.toast-warning { border-left-color: var(--c-warning); }

/* ---------- Empty states ---------- */

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--c-muted);
}

.empty-state i {
    font-size: 2rem;
    opacity: .5;
    margin-bottom: .5rem;
    display: block;
}

/* ---------- Filters ---------- */

.filter-bar {
    background: var(--c-surface);
}

.filter-bar label {
    font-weight: 600;
    color: var(--c-muted);
}

/* ---------- Product pictures ---------- */

.product-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border);
    background-color: var(--c-surface-2);
    color: #a0aec0;
    vertical-align: middle;
    flex-shrink: 0;
}

.product-thumb-sm { width: 40px; height: 40px; font-size: 16px; }
.product-thumb-md { width: 64px; height: 64px; font-size: 24px; }
.product-thumb-lg { width: 180px; height: 180px; font-size: 56px; }

.product-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- Global search (Ctrl+K) ---------- */

.search-results .list-group-item {
    border-left: 0;
    border-right: 0;
}

.search-results .list-group-item.active {
    background: var(--c-primary-soft);
    color: var(--c-text);
    border-color: var(--c-border);
}

.kbd,
kbd {
    font-family: var(--font-mono);
    font-size: .72rem;
    padding: .1rem .35rem;
    border-radius: 4px;
    background: #eef0f3;
    color: #374151;
    border: 1px solid #d5dbe3;
    box-shadow: inset 0 -1px 0 #d5dbe3;
}

/* ---------- Location picker ---------- */

.location-card {
    transition: transform .1s ease, box-shadow .1s ease;
    border-radius: var(--radius) !important;
}

.location-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg) !important;
}

/* ---------- Mobile bottom bar (cashiers) ---------- */

.bottom-nav {
    display: none;
}

@media (max-width: 767.98px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1040;
        background: var(--c-surface);
        border-top: 1px solid var(--c-border);
        box-shadow: 0 -4px 12px rgba(16, 24, 40, .06);
    }

    .bottom-nav a {
        flex: 1;
        text-align: center;
        padding: .45rem 0 .55rem;
        font-size: .7rem;
        color: var(--c-muted);
    }

    .bottom-nav a i {
        display: block;
        font-size: 1.15rem;
        margin-bottom: .1rem;
    }

    .bottom-nav a.active {
        color: var(--c-primary);
    }

    body.has-bottom-nav .content-wrapper {
        padding-bottom: 4rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    /* First column stays visible while scrolling wide tables */
    .table-responsive td:first-child,
    .table-responsive th:first-child {
        position: sticky;
        left: 0;
        background: var(--c-surface);
        z-index: 1;
    }
}

/* ---------- Till (POS) ---------- */

body.pos-body {
    background: var(--c-bg);
    overflow: hidden;
}

.pos-topbar {
    height: 56px;
    background: #111827;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: .75rem;
}

.pos-topbar a,
.pos-topbar .btn-link {
    color: #e5e7eb;
}

.pos-topbar .brand {
    font-weight: 700;
    letter-spacing: -.01em;
}

/* Solid colors on the dark bar (soft badges are made for light backgrounds) */
.pos-topbar .badge-primary { background: #2563eb; color: #fff; }
.pos-topbar .badge-success { background: #16a34a; color: #fff; }
.pos-topbar .badge-warning { background: #f59e0b; color: #111827; }
.pos-topbar .badge-light { background: #374151; color: #f9fafb; border: 0; }

.pos-topbar kbd {
    background: #374151;
    color: #f3f4f6;
    border-color: #4b5563;
    box-shadow: none;
}

.pos-topbar .text-muted {
    color: #9ca3af !important;
}

.pos-main {
    display: flex;
    height: calc(100vh - 56px);
}

.pos-catalog {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1rem;
}

.pos-cart-panel {
    width: 420px;
    flex: 0 0 420px;
    background: var(--c-surface);
    border-left: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
}

.pos-search {
    font-size: 1.1rem;
    height: 3rem;
    border-radius: var(--radius);
}

.pos-chips {
    display: flex;
    gap: .4rem;
    overflow-x: auto;
    padding: .6rem 0;
    scrollbar-width: thin;
}

.pos-chip {
    white-space: nowrap;
    border-radius: 999px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    padding: .3rem .85rem;
    font-size: .85rem;
    cursor: pointer;
}

.pos-chip.active {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
}

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

.pos-product {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: .6rem;
    cursor: pointer;
    text-align: left;
    transition: border-color .1s ease, box-shadow .1s ease, transform .05s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pos-product:hover,
.pos-product:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(11, 107, 203, .12);
    outline: none;
}

.pos-product:active {
    transform: scale(.98);
}

.pos-product.out {
    opacity: .5;
    cursor: not-allowed;
}

.pos-product .thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-sm);
    background: var(--c-surface-2);
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 1.8rem;
    margin-bottom: .45rem;
}

.pos-product .name {
    font-weight: 600;
    font-size: .88rem;
    line-height: 1.2;
    margin-bottom: .25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pos-product .price {
    font-weight: 700;
    color: var(--c-primary);
    margin-top: auto;
}

.pos-product .stock {
    position: absolute;
    top: .9rem;
    right: .9rem;
}

.pos-product .pack-btn {
    font-size: .72rem;
    padding: .1rem .4rem;
    margin-top: .3rem;
}

.pos-cart-lines {
    flex: 1 1 auto;
    overflow-y: auto;
}

.pos-line {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--c-border);
}

.pos-line .info {
    flex: 1;
    min-width: 0;
}

.pos-line .info strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-qty {
    display: flex;
    align-items: center;
}

.pos-qty button {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
}

.pos-qty input {
    width: 54px;
    text-align: center;
    border: 0;
    background: transparent;
    font-weight: 600;
}

.pos-cart-footer {
    border-top: 1px solid var(--c-border);
    padding: 1rem;
    background: var(--c-surface-2);
}

.pos-total {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.pos-pay-btn {
    height: 3.5rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .4rem;
}

.numpad button {
    height: 3rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.quick-cash {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.payment-line + .payment-line {
    border-top: 1px dashed var(--c-border);
    padding-top: .5rem;
    margin-top: .5rem;
}

@media (max-width: 991.98px) {
    body.pos-body {
        overflow: auto;
    }

    .pos-main {
        flex-direction: column;
        height: auto;
    }

    .pos-cart-panel {
        width: 100%;
        flex: 1 1 auto;
        border-left: 0;
        border-top: 1px solid var(--c-border);
    }

    .pos-grid {
        max-height: 55vh;
    }
}

/* ---------- Print ---------- */

@media print {
    .main-sidebar,
    .main-header,
    .main-footer,
    .page-actions,
    .filter-bar,
    .bottom-nav,
    .toast-stack,
    .btn {
        display: none !important;
    }

    .content-wrapper {
        margin-left: 0 !important;
        background: #fff !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ---------- Dark mode ---------- */

body.dark-mode {
    --c-bg: #0f172a;
    --c-surface: #111827;
    --c-surface-2: #1f2937;
    --c-border: #2b3646;
    --c-text: #e5e7eb;
    --c-muted: #9ca3af;
    --c-primary: #4f9be8;
    --c-primary-soft: rgba(79, 155, 232, .14);
    --c-success-soft: rgba(26, 135, 84, .2);
    --c-warning-soft: rgba(183, 121, 31, .22);
    --c-danger-soft: rgba(197, 48, 48, .22);
    --c-info-soft: rgba(14, 116, 144, .25);
}

body.dark-mode .content-wrapper,
body.dark-mode.pos-body {
    background: var(--c-bg) !important;
    color: var(--c-text);
}

body.dark-mode .card,
body.dark-mode .stat-box,
body.dark-mode .modal-content,
body.dark-mode .dropdown-menu,
body.dark-mode .pos-product,
body.dark-mode .pos-cart-panel,
body.dark-mode .pos-chip,
body.dark-mode .list-group-item,
body.dark-mode .filter-bar,
body.dark-mode .toast-stack .toast,
body.dark-mode .bottom-nav {
    background: var(--c-surface) !important;
    color: var(--c-text);
    border-color: var(--c-border) !important;
}

/* KPI tiles carry .bg-white, whose AdminLTE text colour is !important */
body.dark-mode .stat-box {
    color: var(--c-text) !important;
}

body.dark-mode .brand-navbar {
    background-color: #111827 !important;
    border-color: var(--c-border);
}

body.dark-mode .brand-navbar .nav-link,
body.dark-mode .brand-navbar .btn-link {
    color: #e5e7eb !important;
}

body.dark-mode .table,
body.dark-mode .table td {
    color: var(--c-text);
}

body.dark-mode .form-control,
body.dark-mode .custom-select,
body.dark-mode .select2-container--bootstrap4 .select2-selection,
body.dark-mode .select2-dropdown {
    background: var(--c-surface-2);
    border-color: var(--c-border);
    color: var(--c-text);
}

body.dark-mode .btn-light,
body.dark-mode .pos-cart-footer,
body.dark-mode .card-footer,
body.dark-mode .table thead th {
    background: var(--c-surface-2) !important;
    color: var(--c-text);
    border-color: var(--c-border);
}

body.dark-mode .text-muted {
    color: var(--c-muted) !important;
}

body.dark-mode .table-warning,
body.dark-mode .table-warning td { background: rgba(183, 121, 31, .18) !important; }
body.dark-mode .table-danger,
body.dark-mode .table-danger td { background: rgba(197, 48, 48, .18) !important; }
body.dark-mode .table-success,
body.dark-mode .table-success td { background: rgba(26, 135, 84, .18) !important; }

body.dark-mode .kbd,
body.dark-mode kbd {
    background: #1f2937;
    color: #e5e7eb;
    border-color: #374151;
}

/* ---------- Interaction states (hover / focus / active) ----------
 * Bootstrap and AdminLTE hard-code dark hover text (#212529, #16181b, #1f2d3d, #0056b3).
 * On our dark surfaces (dark mode, till top bar, brand-coloured bars) that text vanishes.
 * Every interactive element below keeps a readable text colour in both themes.
 */
:root {
    --c-primary-hover: #0957a6;
    --c-hover-bg: #eef2f7;
    --c-hover-text: #111827;
    --focus-ring: 0 0 0 .2rem rgba(11, 107, 203, .3);
}

body.dark-mode {
    --c-primary-hover: #8bbcf0;
    --c-hover-bg: #253247;
    --c-hover-text: #ffffff;
    --focus-ring: 0 0 0 .2rem rgba(79, 155, 232, .45);
}

a:hover,
a:focus {
    color: var(--c-primary-hover);
}

/* Links that look like text keep their colour, only gain an underline */
a.text-reset:hover,
a.text-body:hover,
a.text-dark:hover {
    color: inherit !important;
}

/* Neutral buttons */
.btn-light:hover,
.btn-light:focus,
.btn-light.focus,
.btn-light:not(:disabled):not(.disabled):active,
.btn-light:not(:disabled):not(.disabled).active,
.show > .btn-light.dropdown-toggle {
    background: var(--c-hover-bg) !important;
    border-color: var(--c-border) !important;
    color: var(--c-hover-text) !important;
}

.btn-link:hover,
.btn-link:focus {
    color: var(--c-primary-hover);
}

/* Solid colour buttons: white text stays white whatever Bootstrap computes */
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-success:hover, .btn-success:focus, .btn-success:active,
.btn-danger:hover, .btn-danger:focus, .btn-danger:active,
.btn-info:hover, .btn-info:focus, .btn-info:active,
.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active,
.btn-dark:hover, .btn-dark:focus, .btn-dark:active {
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--c-primary-hover);
    border-color: var(--c-primary-hover);
}

.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active {
    color: #111827 !important;
}

/* Outline buttons fill with their colour on hover: text becomes white (dark text on yellow / light) */
.btn-outline-primary:hover, .btn-outline-success:hover, .btn-outline-danger:hover,
.btn-outline-info:hover, .btn-outline-secondary:hover, .btn-outline-dark:hover {
    color: #fff !important;
}

.btn-outline-warning:hover,
.btn-outline-light:hover {
    color: #111827 !important;
}

.btn:focus,
.btn.focus,
.form-control:focus,
.custom-select:focus {
    box-shadow: var(--focus-ring);
}

/* Menus */
.dropdown-item {
    color: var(--c-text);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--c-hover-bg);
    color: var(--c-hover-text);
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--c-primary);
    color: #fff !important;
}

/* Table rows: Bootstrap darkens the text to #212529 on hover */
.table-hover tbody tr:hover,
.table-hover tbody tr:hover td {
    color: var(--c-text);
}

/* Pagination */
.page-link {
    background: var(--c-surface);
    border-color: var(--c-border);
    color: var(--c-primary);
}

.page-link:hover,
.page-link:focus {
    background: var(--c-hover-bg);
    border-color: var(--c-border);
    color: var(--c-primary-hover);
}

.page-item.active .page-link {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
}

.page-item.disabled .page-link {
    background: var(--c-surface);
    border-color: var(--c-border);
    color: var(--c-muted);
}

/* Dark bars: till top bar, dark-mode navbar */
.pos-topbar a:hover,
.pos-topbar a:focus,
.pos-topbar .btn-link:hover,
.pos-topbar .btn-link:focus {
    color: #ffffff;
    text-decoration: none;
}

.pos-topbar .btn-link:hover,
.pos-topbar a.ml-3:hover {
    background: rgba(255, 255, 255, .08);
    border-radius: var(--radius-sm);
}

.pos-topbar .badge:hover {
    filter: brightness(1.1);
}

body.dark-mode .brand-navbar .nav-link:hover,
body.dark-mode .brand-navbar .btn-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, .06);
    border-radius: var(--radius-sm);
}

/* Dark mode: everything Bootstrap paints light-grey on hover */
body.dark-mode .btn-outline-secondary {
    color: #cbd5e1;
    border-color: #475569;
}

body.dark-mode .btn-outline-secondary:hover {
    background: #475569;
    border-color: #475569;
}

body.dark-mode .btn-outline-primary {
    color: var(--c-primary);
    border-color: var(--c-primary);
}

body.dark-mode .btn-outline-primary:hover,
body.dark-mode .btn-outline-primary.active,
body.dark-mode .btn-group-toggle .btn-outline-primary.active {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #0b1220 !important;
}

body.dark-mode .list-group-item-action:hover,
body.dark-mode .list-group-item-action:focus {
    background: var(--c-hover-bg) !important;
    color: var(--c-hover-text);
}

body.dark-mode .pos-chip:hover {
    background: var(--c-hover-bg) !important;
    color: var(--c-hover-text);
}

body.dark-mode .close {
    color: #e5e7eb;
    text-shadow: none;
}

body.dark-mode .close:hover {
    color: #ffffff;
}

/* Keyboard users see where they are */
a:focus-visible,
.btn:focus-visible,
.dropdown-item:focus-visible,
.pos-product:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
}

/* Reports hub */
.report-link { transition: box-shadow .15s, transform .15s; }
.report-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md, 0 6px 18px rgba(0,0,0,.08)); }
.report-icon { width: 2.5rem; height: 2.5rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }

/* select2 inside a Bootstrap input-group (e.g. till customer + "new customer" button) */
.input-group > .select2-container--bootstrap4 {
    flex: 1 1 auto;
    width: 1% !important;
    min-width: 0;
}

.input-group > .select2-container--bootstrap4:not(:last-child) .select2-selection {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Dark mode: AdminLTE's own hover colours (grey menu items, light green buttons) */
body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus {
    background: var(--c-hover-bg) !important;
    color: var(--c-hover-text) !important;
}

body.dark-mode .dropdown-item.text-danger,
body.dark-mode .dropdown-item.text-danger:hover,
body.dark-mode .dropdown-item.text-danger:focus {
    color: #fca5a5 !important;
}

body.dark-mode .btn-success,
body.dark-mode .btn-success:hover,
body.dark-mode .btn-success:focus,
body.dark-mode .btn-success:active {
    background: #15803d !important;
    border-color: #15803d !important;
    color: #fff !important;
}

body.dark-mode .btn-success:hover {
    background: #166534 !important;
    border-color: #166534 !important;
}

/* Placeholder lines in menus are not clickable */
.dropdown-item-text {
    color: var(--c-muted);
}

/* Tabs / pills: the active one stays white on its colour, AdminLTE's dark link hover must not recolour it */
.nav-pills .nav-link.active,
.nav-pills .nav-link.active:hover,
.nav-pills .nav-link.active:focus,
.nav-pills .show > .nav-link {
    background: var(--c-primary);
    color: #fff !important;
}

body.dark-mode .nav-pills .nav-link:not(.active) {
    color: var(--c-text);
}

body.dark-mode .nav-pills .nav-link:not(.active):hover {
    background: var(--c-hover-bg);
    color: var(--c-hover-text) !important;
}

body.dark-mode .nav-pills .nav-link.active,
body.dark-mode .nav-pills .nav-link.active:hover {
    color: #0b1220 !important;
}

/* Dark mode outline buttons: lighter tones readable on dark rows, solid fill + white/dark text on hover */
body.dark-mode .btn-outline-danger { color: #f87171; border-color: #f87171; }
body.dark-mode .btn-outline-success { color: #4ade80; border-color: #4ade80; }
body.dark-mode .btn-outline-warning { color: #fbbf24; border-color: #fbbf24; }

body.dark-mode .btn-outline-danger:hover,
body.dark-mode .btn-outline-danger:focus,
body.dark-mode .btn-outline-danger:active {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #fff !important;
}

body.dark-mode .btn-outline-success:hover,
body.dark-mode .btn-outline-success:focus,
body.dark-mode .btn-outline-success:active {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #fff !important;
}

body.dark-mode .btn-outline-warning:hover,
body.dark-mode .btn-outline-warning:focus,
body.dark-mode .btn-outline-warning:active {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #111827 !important;
}

body.dark-mode .btn-outline-secondary:hover,
body.dark-mode .btn-outline-secondary:focus {
    color: #fff !important;
}
