/* ============================================
   MODERN THEME - Clean 2026 SaaS Design
   No Gradients, Minimal, Sleek
   ============================================ */

/* Inter font loaded by header_jwt.php — no @import needed here */

:root {
    /* Primary Colors - Resman Red (from logo). Module override via header_jwt.php */
    --primary-color: #EB4135;
    --primary-dark: #d43629;
    --primary-light: #ef5e52;
    --primary-rgb: 235, 65, 53;
    --sidebar-logo-text: #1f2937;

    /* Layout dimensions */
    --topbar-height: 64px;
    --topbar-height-mobile: 56px;
    --footer-height: 52px;
    --bottom-nav-height: 64px;
    --shell-gutter: clamp(1rem, 2.2vw, 1.5rem);

    /* Neutral Colors - Clean & Minimal */
    --bg-main: #f8f9fa;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;

    /* Extended palette — used by inline-style JS/PHP templates */
    --bg-subtle: #f9fafb;       /* detail cards, stat blocks */
    --bg-hover: #f3f4f6;        /* hover rows, separators */
    --text-heading: #111827;    /* heading / strong text */
    --text-body: #374151;       /* normal body text */
    --text-label: #6b7280;      /* labels, secondary info */
    --text-placeholder: #9ca3af;/* placeholders, view-only */
    --border-mid: #d1d5db;      /* mid-weight borders */

    /* Semantic tinted backgrounds (light mode) */
    --bg-info: #eff6ff;         --text-info: #3b82f6;
    --bg-warning: #fef3c7;      --text-warning: #d97706;  --text-warning-dark: #92400e;
    --bg-danger-light: #fef2f2; --text-danger: #dc2626;
    --bg-success-light: #f0fdf4;--text-success: #16a34a;  --border-success: #bbf7d0;
    --bg-note: #fefce8;         --text-note: #a16207;     --text-note-dark: #713f12;
    --bg-deleted: #fffbeb;      --border-deleted: #facc15; --text-deleted: #78350f;
    --bg-discount: #fef9c3;     --text-discount: #854d0e;
    
    /* Status Colors - Flat, No Gradients */
    --color-success: #10b981;
    --color-info: #3b82f6;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-primary: var(--primary-color);
    --color-secondary: #6c757d;
    
    /* Shadows - Website-matched layered */
    --shadow-sm: 0 1px 3px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.03);
    --shadow-md: 0 1px 3px rgba(15,23,42,.04), 0 6px 16px rgba(15,23,42,.05);
    --shadow-lg: 0 8px 28px rgba(15,23,42,.09);

    /* Spacing - Compact */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;

    /* Border Radius - Website-matched */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    /* Sidebar: expanded follows content; collapsed icon-only */
    --sidebar-width: 13rem;
    --sidebar-collapsed-width: 4.75rem;

    /* Transitions - Website-matched easing */
    --transition: all 0.18s cubic-bezier(.22,1,.36,1);
    --ease: cubic-bezier(.22,1,.36,1);
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
/* Font size: controlled by class on html (set from Settings → General). Body uses 1rem so it scales. */
html.resman-fs-small { font-size: 13px; }
html.resman-fs-medium { font-size: 14px; }
html.resman-fs-large { font-size: 16px; }
html:not([class*="resman-fs-"]) { font-size: 14px; }

html {
    background-color: var(--bg-main);
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.5;
}

/* Remove all animations */
* {
    animation: none !important;
}

/* Remove dotted/dashed focus outlines on click; keep for keyboard nav */
button:focus, .btn:focus, [role="button"]:focus, a:focus {
    outline: none;
}
button:focus-visible, .btn:focus-visible, [role="button"]:focus-visible, a:focus-visible {
    outline: 2px solid rgba(var(--primary-rgb), 0.4);
    outline-offset: 2px;
}

/* ============================================
   SIDEBAR - Clean & Minimal
   ============================================ */
.sidebar {
    background: var(--bg-sidebar) !important;
    box-shadow: 1px 0 0 rgba(15,23,42,.06);
    border-right: none;
    overflow-x: hidden;
    min-height: 100dvh;
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width) !important;
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    flex-direction: column;
    z-index: 1020;
    transition: width 0.25s var(--ease), min-width 0.25s var(--ease), max-width 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.sidebar::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* Ensure nav items stay within the fixed sidebar rail */
.sidebar.navbar-nav {
    width: var(--sidebar-width);
    max-width: var(--sidebar-width);
}

/* Sidebar Brand */
.sidebar .sidebar-brand {
    min-height: 64px;
    padding: 1rem 1rem;
    border-bottom: 1px solid rgba(15,23,42,.05);
    background: var(--bg-sidebar);
    justify-content: center !important;
    gap: 0;
    position: sticky;
    top: 0;
    z-index: 2;
    transition: var(--transition);
}

.sidebar .sidebar-brand:hover {
    background-color: var(--bg-sidebar);
}

.sidebar .sidebar-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar .sidebar-brand-icon i {
    color: white;
    font-size: 1.25rem;
}

.sidebar .sidebar-brand-icon img.sidebar-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
}

/* Main logo in sidebar (replaces icon + text) */
.sidebar .sidebar-brand .sidebar-main-logo {
    display: block;
    width: 100%;
    max-width: 128px;
    max-height: 34px;
    height: auto;
    object-fit: contain;
    transition: opacity 0.2s ease;
    flex: 0 0 auto;
}

.sidebar-brand-icon-only {
    display: none;
    width: 36px;
    height: 36px;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.sidebar .sidebar-brand-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary) !important;
    margin-left: var(--spacing-md);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar Divider */
.sidebar .sidebar-divider {
    border-top: 1px solid var(--border-light);
    margin: 0.55rem 0.75rem;
    transition: margin 0.2s ease;
}

/* Sidebar Heading */
.sidebar .sidebar-heading {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.45rem 0.9rem 0.3rem;
    transition: opacity 0.15s ease;
}

/* Nav Items - NO HOVER ANIMATIONS */
.sidebar .nav-item {
    margin: 0.125rem 0.5rem;
}

.sidebar .nav-item .nav-link {
    min-height: 42px;
    padding: 0.45rem 0.65rem;
    border-radius: 12px;
    color: var(--text-body);
    font-weight: 500;
    font-size: 0.84rem;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease), padding 0.2s var(--ease);
    display: flex;
    align-items: center;
    gap: 0.55rem;
    line-height: 1.4;
    width: 100%;
}

.sidebar .nav-item .nav-link i {
    width: 1.75rem;
    min-width: 1.75rem;
    height: 1.75rem;
    margin-right: 0;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(15,23,42,.04);
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: margin-right 0.2s ease, font-size 0.2s ease, background 0.18s ease;
    flex-shrink: 0;
}

.sidebar .nav-item .nav-link span {
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    opacity: 1;
    transition: opacity 0.15s ease;
}

/* Active State - Clean */
.sidebar .nav-item.active .nav-link,
.sidebar .nav-item .nav-link.active {
    background: var(--primary-color);
    color: white !important;
}

.sidebar .nav-item.active .nav-link i,
.sidebar .nav-item .nav-link.active i {
    color: white !important;
}

/* Parent nav-item active when child collapse item is active */
.sidebar .nav-item.active > .nav-link[data-toggle="collapse"] {
    background: var(--primary-color);
    color: white !important;
}

.sidebar .nav-item.active > .nav-link[data-toggle="collapse"] i {
    color: white !important;
}

/* Hover State - NO TRANSFORM */
.sidebar .nav-item:hover .nav-link {
    background-color: rgba(var(--primary-rgb), 0.08);
    color: var(--text-primary);
}

.sidebar .nav-item:hover .nav-link i {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary-color);
}

.sidebar .nav-item.active:hover .nav-link {
    background: var(--primary-color);
    color: white !important;
}

.sidebar .nav-item.active:hover .nav-link i {
    color: white !important;
}

/* Collapse Items */
.sidebar .collapse-inner {
    background: transparent;
    padding: 0.2rem 0 0.35rem 0.4rem;
    margin-left: 0.6rem;
    border-left: 1px solid var(--border-light);
}

.sidebar .collapse-item {
    min-height: 38px;
    padding: 0.4rem 0.75rem;
    margin: 0.1rem 0.4rem 0.1rem 0.65rem;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    line-height: 1.4;
}

.sidebar .collapse-item i {
    font-size: 0.875rem;
    min-width: 18px;
    text-align: center;
    margin-right: 0.5rem;
    color: var(--text-secondary);
}

.sidebar .collapse-item:hover {
    background-color: rgba(var(--primary-rgb), 0.08);
    color: var(--text-primary);
}

.sidebar .collapse-item:hover i {
    color: var(--primary-color);
}

.sidebar .collapse-item.active {
    background-color: rgba(255, 107, 53, 0.1);
    color: var(--primary-color) !important;
    font-weight: 600;
    border-left: none;
    padding-left: 0.85rem;
}

.sidebar .collapse-item.active i {
    color: var(--primary-color) !important;
}

/* Sidebar Toggle Button Container */
.sidebar .text-center {
    padding: 1rem 0;
    border-top: 1px solid var(--border-light);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-sidebar);
}

/* Sidebar Toggle Button */
.sidebar #sidebarToggle {
    width: 45px;
    height: 45px;
    background-color: var(--bg-sidebar) !important;
    transition: var(--transition);
    border: 1px solid var(--border-color) !important;
    outline: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
    border-radius: 50%;
}

.sidebar #sidebarToggle:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.sidebar #sidebarToggle::after {
    color: var(--text-secondary);
    content: '\00AB';
    font-weight: bold;
    font-size: 1.5rem;
    line-height: 1;
}

.sidebar #sidebarToggle:hover::after {
    color: white;
}

.sidebar #sidebarToggle:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

/* Collapsed Sidebar - slim icon-only, respects main body */
.sidebar.sidebar-collapsed,
body.sidebar-collapsed-load .sidebar {
    width: var(--sidebar-collapsed-width) !important;
    min-width: var(--sidebar-collapsed-width) !important;
    max-width: var(--sidebar-collapsed-width) !important;
    overflow-x: hidden;
    min-height: 100dvh;
    height: 100%;
}

.sidebar.sidebar-collapsed .sidebar-brand-text,
.sidebar.sidebar-collapsed .nav-item .nav-link span,
.sidebar.sidebar-collapsed .sidebar-heading,
.sidebar.sidebar-collapsed .collapse-inner,
body.sidebar-collapsed-load .sidebar .sidebar-brand-text,
body.sidebar-collapsed-load .sidebar .nav-item .nav-link span,
body.sidebar-collapsed-load .sidebar .sidebar-heading,
body.sidebar-collapsed-load .sidebar .collapse-inner {
    display: none;
}

/* Content wrapper: match sidebar width so main body gets full remaining space */
.sidebar.sidebar-collapsed ~ #content-wrapper,
body.sidebar-collapsed-load #content-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* ============================================
   TOPBAR - Clean Header
   ============================================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1010;
    background: rgba(255,255,255,.92) !important;
    border-bottom: 1px solid rgba(15,23,42,.06);
    box-shadow: 0 1px 3px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.03);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    height: var(--topbar-height) !important;
    min-height: var(--topbar-height) !important;
    padding: 0 var(--shell-gutter) !important;
}

/* Page Greeting */
.topbar h1,
.topbar .h5,
.topbar .h6 {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.topbar h1.h5 {
    font-size: 1.125rem;
}

.topbar h1.h6 {
    font-size: 1rem;
}

.topbar .small {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Topbar Toggle Button */
.topbar #sidebarToggleTop {
    display: inline-block !important;
    width: 40px;
    height: 40px;
    background-color: transparent !important;
    border: none !important;
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
}

.topbar #sidebarToggleTop:hover {
    background-color: var(--border-light) !important;
    color: var(--text-primary);
}

.topbar #sidebarToggleTop:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.topbar #sidebarToggleTop i {
    font-size: 1.25rem;
}

/* Topbar Nav Items */
.topbar .nav-item {
    margin: 0;
}

.topbar .nav-link {
    padding: 0.4rem 0.65rem;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: var(--radius-md);
    position: relative;
}

.topbar .nav-link:hover {
    background-color: var(--border-light);
    color: var(--text-primary);
}

.topbar .nav-link i {
    font-size: 1rem;
    color: var(--text-secondary);
}

.topbar .nav-link:hover i {
    color: var(--text-primary);
}

/* Notification Badge - Flat */
.topbar .badge-counter {
    position: absolute;
    top: 4px;
    right: 2px;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 4px;
    min-width: 16px;
    text-align: center;
    border-radius: 10px;
    background: var(--color-danger);
    border: 2px solid white;
    line-height: 1.3;
    box-sizing: border-box;
}

/* Dropdown Menus */
.topbar .dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: 0.5rem 0;
    margin-top: 0.75rem;
    min-width: 280px;
}

.topbar .dropdown-header {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.75rem 1rem 0.5rem;
    background: transparent;
}

.topbar .dropdown-item {
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    margin: 2px 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar .dropdown-item i {
    font-size: 0.875rem;
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.topbar .dropdown-item:hover {
    background-color: var(--border-light);
    color: var(--text-primary);
    text-decoration: none;
}

.topbar .dropdown-item:hover i {
    color: var(--text-primary);
}

.topbar .dropdown-divider {
    border-top: 1px solid var(--border-light);
    margin: 0.5rem 0;
}

/* Dropdown Item Link Color Override */
.topbar .dropdown-item.text-center {
    justify-content: center;
    font-weight: 500;
}

.topbar .dropdown-item.text-primary {
    color: var(--primary-color) !important;
}

.topbar .dropdown-item.text-primary:hover {
    color: var(--primary-dark) !important;
    background-color: rgba(255, 107, 53, 0.08);
}

/* Branch Selector */
.topbar #centerDropdown {
    background-color: var(--border-light);
    border-radius: var(--radius-md);
    padding: 8px 12px;
}

.topbar #centerDropdown:hover {
    background-color: var(--border-color);
}

.branch-dropdown {
    min-width: 240px !important;
}

.center-button {
    transition: var(--transition);
    border: none;
    background: transparent;
    cursor: pointer;
}

.center-button:hover {
    background-color: var(--border-light) !important;
    color: var(--text-primary) !important;
}

.center-button.active {
    background: rgba(255, 107, 53, 0.05) !important;
    font-weight: 500;
}

/* Branch Color Dots */
.branch-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.branch-dot-primary {
    background-color: #3b82f6;
}

.branch-dot-success {
    background-color: #10b981;
}

.branch-dot-danger {
    background-color: #ef4444;
}

.branch-dot-warning {
    background-color: #f59e0b;
}

.branch-dot-info {
    background-color: #06b6d4;
}

.branch-dot-secondary {
    background-color: #6b7280;
}

.branch-name {
    flex: 1;
}

.center-button .fa-check {
    font-size: 0.875rem;
    color: #10b981 !important;
}

/* Notifications Dropdown */
.topbar .notifications-dropdown {
    min-width: 350px;
    max-width: 400px;
}

.topbar .notifications-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.topbar .notifications-content::-webkit-scrollbar {
    width: 6px;
}

.topbar .notifications-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* Topbar Divider */
.topbar-divider {
    width: 1px;
    height: 2.5rem;
    background-color: var(--border-color);
    margin: 0 1rem;
}

/* User Profile Dropdown */
.topbar .user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    margin: 0 0.5rem;
}

.topbar .user-dropdown:hover {
    background-color: var(--border-light);
    border-color: var(--primary-color);
    text-decoration: none;
}

.topbar .user-dropdown img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    object-fit: cover;
    flex-shrink: 0;
}

.topbar .user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
}

.topbar .user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.topbar .user-role {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.topbar .user-dropdown i.fa-chevron-down {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

/* ============================================
   CONTENT AREA
   ============================================ */
#wrapper {
    display: flex;
    min-height: 100dvh;
    background: var(--bg-main);
}

#content-wrapper {
    background-color: transparent;
    width: 100%;
    min-width: 0;
    height: 100dvh;
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.25s var(--ease);
    overflow-y: auto;
    overflow-x: hidden;
}

/* When sidebar is collapsed (desktop), content uses same slim margin */
@media (min-width: 768px) {
    .sidebar.sidebar-collapsed ~ #content-wrapper,
    body.sidebar-collapsed-load #content-wrapper {
        margin-left: var(--sidebar-collapsed-width) !important;
    }
}

#content {
    padding-top: 0;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.container-fluid {
    padding: var(--shell-gutter);
}

/* Remove margin from first element after topbar */
.topbar + * {
    margin-top: 0 !important;
}

/* Page Content Wrapper */
.container-fluid {
    padding: var(--shell-gutter);
}

/* Page Headers - Compact */
.page-header h1,
.page-header h2,
.page-header h3,
h1, h2, h3 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.25rem;
}

h3 {
    font-size: 1.125rem;
}

h4 {
    font-size: 1rem;
    font-weight: 600;
}

h5 {
    font-size: 0.925rem;
    font-weight: 600;
}

.page-header .text-muted {
    color: var(--text-secondary) !important;
    font-size: 0.875rem;
}

/* Section Titles */
.d-flex.justify-content-between h3,
.d-flex.justify-content-between h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0;
}

/* ============================================
   TABLES - Neutral Bold Headers, No Dropdown Icons
   ============================================ */
table thead th {
    font-weight: 700 !important;
    background: white !important;
    border-bottom: 2px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

table thead.thead-light th {
    background: white !important;
    color: var(--text-primary) !important;
}

/* Remove dropdown icon from action buttons */
.btn.dropdown-toggle::after {
    display: none !important;
}

/* ============================================
   CARDS - Minimal, NO HOVER LIFT
   ============================================ */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
    /* NO TRANSFORM ON HOVER */
}

.card:hover {
    /* Remove transform */
    box-shadow: var(--shadow-sm);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-lg) var(--spacing-xl);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.card-body {
    padding: var(--spacing-xl);
}

/* Metric Cards - Flat Design */
.metric-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    position: relative;
    /* NO HOVER EFFECT */
}

.metric-card:hover {
    /* NO TRANSFORM */
    box-shadow: var(--shadow-sm);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.metric-card.border-left-primary::before {
    background: var(--primary-color);
}

.metric-card.border-left-success::before {
    background: var(--color-success);
}

.metric-card.border-left-info::before {
    background: var(--color-info);
}

.metric-card.border-left-warning::before {
    background: var(--color-warning);
}

.metric-card.border-left-danger::before {
    background: var(--color-danger);
}

.metric-card .text-xs {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-card .h5 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   BUTTONS - Flat, Clean
   ============================================ */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    padding: 0.55rem 1rem;
    transition: var(--transition);
    font-size: 0.875rem;
    /* NO TRANSFORM */
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    /* NO TRANSFORM */
}

.btn-success {
    background: var(--color-success);
    border: none;
}

.btn-info {
    background: var(--color-info);
    border: none;
}

.btn-warning {
    background: var(--color-warning);
    border: none;
}

.btn-danger {
    background: var(--color-danger);
    border: none;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn-circle {
    border-radius: 50%;
    width: 36px;
    height: 36px;
}

/* ============================================
   FORMS - Clean Input Fields
   ============================================ */
.form-control,
.form-control-sm {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.875rem;
    font-size: 0.875rem;
    transition: var(--transition);
    color: var(--text-primary);
    background-color: var(--bg-card);
    height: auto;
}

.form-control-sm {
    padding: 0.45rem 0.75rem;
    font-size: 0.8125rem;
}

.form-control:focus,
.form-control-sm:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
    background-color: var(--bg-card);
}

.custom-select,
select.form-control {
    border-radius: var(--radius-md);
    border-color: var(--border-color);
    padding: 0.6rem 2rem 0.6rem 0.875rem;
    font-size: 0.875rem;
    height: auto;
    background-color: var(--bg-card);
}

.custom-select:focus,
select.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Form Labels */
label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

/* Input Groups */
.input-group-text {
    border-color: var(--border-color);
    background-color: var(--border-light);
    font-size: 0.875rem;
    border-radius: var(--radius-md);
}

/* ============================================
   TABLES - COMPACT, MINIMAL SPACING
   ============================================ */
.table {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.table thead th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding: 0.65rem 0.75rem; /* COMPACT PADDING */
    background-color: var(--bg-main);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--border-light);
}

.table td {
    padding: 0.65rem 0.75rem; /* COMPACT PADDING */
    vertical-align: middle;
    border-top: 1px solid var(--border-light);
}

/* Even more compact for data tables */
.table-sm td,
.table-sm th {
    padding: 0.5rem 0.75rem;
}

/* ============================================
   BADGES - Flat
   ============================================ */
.badge {
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
}

.badge-primary {
    background: var(--primary-color);
}

.badge-success {
    background: var(--color-success);
}

.badge-warning {
    background: var(--color-warning);
}

.badge-danger {
    background: var(--color-danger);
}

.badge-info {
    background: var(--color-info);
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */
.pending-order-item,
.low-stock-item {
    transition: var(--transition);
    border-radius: var(--radius-md);
    margin: 2px var(--spacing-sm);
}

.pending-order-item:hover,
.low-stock-item:hover {
    background-color: var(--border-light) !important;
}

.icon-circle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.urgent-order {
    border-left: 3px solid var(--color-danger) !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

/* Stock Items */
.stock-item {
    padding: 0.75rem; /* COMPACT */
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
    border-radius: var(--radius-sm);
    margin: 2px 0;
}

.stock-item:hover {
    background-color: var(--border-light);
}

.stock-item.low-stock {
    border-left: 3px solid var(--color-danger);
    background: rgba(239, 68, 68, 0.05);
}

/* ============================================
   MOBILE NAVIGATION — website-matched glass vibe
   ============================================ */
#mobileBottomNav {
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-top: 1px solid rgba(15,23,42,.06);
    box-shadow: 0 -1px 16px rgba(15,23,42,.06);
}

.bottom-nav-item {
    color: #5f6d8c;
    transition: color 0.18s cubic-bezier(.22,1,.36,1), background 0.18s cubic-bezier(.22,1,.36,1);
}

.bottom-nav-item:hover {
    color: #0f172a;
}

.bottom-nav-item.active {
    color: var(--primary-color, var(--primary-color));
    background: none;
}

#mobileMoreMenu {
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
}

.more-menu-item {
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: var(--radius-md);
    margin: 2px var(--spacing-md);
}

.more-menu-item:hover {
    background-color: var(--border-light);
    color: var(--text-primary);
}

/* ============================================
   SCROLLBAR - Minimal
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   LOADING - Minimal
   ============================================ */
#globalLoader {
    background: transparent;
}

.loader-bar {
    background: var(--primary-color);
    height: 2px;
}

/* Branch Switch Notification */
.branch-notification {
    position: fixed;
    top: 90px;
    right: -400px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 4px solid;
    transition: right 0.3s ease;
    max-width: 350px;
}

.branch-notification.show {
    right: 20px;
}

.branch-notification-success {
    border-left-color: var(--color-success);
    color: var(--color-success);
}

.branch-notification-error {
    border-left-color: var(--color-danger);
    color: var(--color-danger);
}

.branch-notification-info {
    border-left-color: var(--color-info);
    color: var(--color-info);
}

/* ============================================
   PAGE HEADERS - Consistent Design
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Compact page header - smaller icon, title, less vertical space (Sales, Dashboard, etc.) */
.compact-page-header {
    margin-bottom: 0.75rem !important;
    padding: 0.25rem 0;
}
.compact-page-header .page-header-content {
    gap: 0.5rem;
}
.compact-page-header .page-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1rem;
}
.compact-page-header h1,
.compact-page-header .page-title-wrapper h1 {
    font-size: 1.25rem !important;
    margin: 0;
}
.compact-page-header .page-title-wrapper p {
    display: none;
}
.compact-page-header .dashboard-subtitle,
.compact-page-header .dashboard-range {
    display: none;
}

/* Compact dashboard header (Dashboard page) */
.compact-dashboard-header {
    margin-bottom: 0.75rem !important;
}
.compact-dashboard-header .dashboard-title {
    font-size: 1.25rem !important;
}
.compact-dashboard-header .dashboard-subtitle,
.compact-dashboard-header .dashboard-range {
    display: none !important;
}

/* Compact settings header */
.compact-settings-header h1 {
    font-size: 1.25rem !important;
    margin-bottom: 0 !important;
}
.compact-settings-header p {
    display: none !important;
}
.compact-settings-header {
    margin-bottom: 1rem !important;
}

.page-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.page-icon.primary { background: rgba(255, 107, 53, 0.1); color: var(--primary-color); }
.page-icon.success { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.page-icon.info { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.page-icon.warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.page-title-wrapper h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-title-wrapper p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0 0;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Modern Card */
.card-modern {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: none;
    margin-bottom: 1.5rem;
}

.card-modern .card-body {
    padding: 1.5rem;
}

/* Modern Buttons */
.btn-modern {
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-modern:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-modern.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-modern.btn-success {
    background: #10b981;
    color: white;
}

.btn-modern.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-modern.btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-gradient {
    color: var(--primary-color);
}

.text-primary-orange {
    color: var(--primary-color) !important;
}

.bg-gradient-primary,
.bg-primary-orange {
    background: var(--primary-color);
}

.shadow-soft {
    box-shadow: var(--shadow-md);
}

.rounded-modern {
    border-radius: var(--radius-lg);
}

.font-weight-600 {
    font-weight: 600;
}

.font-weight-500 {
    font-weight: 500;
}

/* Spacing Utilities */
.mb-0 {
    margin-bottom: 0 !important;
}

.py-0 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Text Sizes */
.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

/* Content Container Spacing */
.container-fluid > .row:first-child {
    margin-top: 0;
}

/* ============================================
   STANDARDIZED SPACING & SIZING SYSTEM
   ============================================ */

/* Standard Page Layout */
.container-fluid {
    padding: 1.5rem; /* 24px - consistent main container padding */
}

/* Standard Card Spacing */
.card {
    margin-bottom: 1.5rem; /* 24px between cards */
}

.card-body {
    padding: 1.5rem; /* 24px inside cards */
}

.card-header {
    padding: 1rem 1.5rem; /* 16px top/bottom, 24px sides */
}

/* Standard Form Elements */
.form-group {
    margin-bottom: 1rem; /* 16px between form groups */
}

label {
    font-size: 0.8125rem; /* 13px */
    margin-bottom: 0.5rem; /* 8px */
}

.form-control,
select.form-control,
textarea.form-control {
    font-size: 0.875rem; /* 14px */
    padding: 0.625rem 0.875rem; /* 10px 14px */
    height: auto;
    min-height: 38px;
}

/* Standard Button Sizing */
.btn {
    font-size: 0.875rem; /* 14px */
    padding: 0.5rem 1rem; /* 8px 16px */
    min-height: 38px;
}

.btn-sm {
    font-size: 0.8125rem; /* 13px */
    padding: 0.375rem 0.75rem; /* 6px 12px */
    min-height: 32px;
}

.btn-lg {
    font-size: 1rem; /* 16px */
    padding: 0.75rem 1.5rem; /* 12px 24px */
    min-height: 44px;
}

/* Standard Table Spacing */
.table thead th {
    padding: 0.75rem; /* 12px */
    font-size: 0.75rem; /* 12px */
}

.table tbody td {
    padding: 0.75rem; /* 12px */
    font-size: 0.875rem; /* 14px */
}

.table-sm thead th,
.table-sm tbody td {
    padding: 0.5rem 0.75rem; /* 8px 12px */
}

/* Standard Typography */
body {
    font-size: 0.875rem; /* 14px - base font size */
    line-height: 1.5;
}

h1 { font-size: 1.75rem; } /* 28px */
h2 { font-size: 1.5rem; }  /* 24px */
h3 { font-size: 1.25rem; } /* 20px */
h4 { font-size: 1.125rem; } /* 18px */
h5 { font-size: 1rem; }    /* 16px */
h6 { font-size: 0.875rem; } /* 14px */

.text-xs { font-size: 0.75rem; }   /* 12px */
.text-sm { font-size: 0.8125rem; } /* 13px */
.text-base { font-size: 0.875rem; } /* 14px */
.text-lg { font-size: 1rem; }      /* 16px */

/* Standard Section Spacing */
.mb-section { margin-bottom: 1.5rem; } /* 24px between sections */
.mb-card { margin-bottom: 1.5rem; }    /* 24px between cards */
.mb-form { margin-bottom: 1rem; }      /* 16px between form elements */

/* Standard Filter Bar */
.filter-bar,
.search-bar {
    padding: 1rem 1.5rem; /* 16px 24px */
    margin-bottom: 1.5rem; /* 24px */
}

/* Standard Stat Cards */
.stat-card,
.metric-card {
    margin-bottom: 1.5rem; /* 24px */
}

.stat-card .card-body,
.metric-card .card-body {
    padding: 1.25rem; /* 20px */
}

/* Modal backdrop blur */
.modal-backdrop.show {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* Standard Modal Spacing */
.modal-header {
    padding: 1.25rem 1.5rem; /* 20px 24px */
}

.modal-body {
    padding: 1.5rem; /* 24px */
}

.modal-footer {
    padding: 1rem 1.5rem; /* 16px 24px */
}

/* Standard Badge Sizing */
.badge {
    font-size: 0.75rem; /* 12px */
    padding: 0.25rem 0.5rem; /* 4px 8px */
}

.badge-sm {
    font-size: 0.65rem; /* 10.4px */
    padding: 0.2rem 0.4rem; /* 3.2px 6.4px */
}

/* Standard Icon Sizes */
.icon-sm { font-size: 0.875rem; } /* 14px */
.icon-base { font-size: 1rem; }   /* 16px */
.icon-lg { font-size: 1.25rem; }  /* 20px */
.icon-xl { font-size: 1.5rem; }   /* 24px */

/* Standard Dropdown Sizing */
.dropdown-menu {
    font-size: 0.875rem; /* 14px */
    padding: 0.5rem 0; /* 8px 0 */
}

.dropdown-item {
    padding: 0.5rem 1rem; /* 8px 16px */
    font-size: 0.875rem; /* 14px */
}

/* Standard Input Group */
.input-group-text {
    font-size: 0.875rem; /* 14px */
    padding: 0.625rem 0.875rem; /* 10px 14px */
}

/* ============================================
   MOBILE RESPONSIVE STANDARDS
   ============================================ */

/* Phone only: keep normal document scroll.
   The previous fixed-body shell caused nested-scroll conflicts on mobile pages. */
@media (max-width: 767px) {
    html {
        min-height: 100%;
        min-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
    }
    body {
        min-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
        position: relative;
        width: 100%;
        box-sizing: border-box;
    }
    #wrapper {
        min-height: 100dvh;
        display: flex;
    }
    #content-wrapper {
        flex: 1 1 auto;
        min-height: 100dvh;
        overflow: visible;
        display: flex;
        flex-direction: column;
    }
    #content {
        flex: 1 1 auto;
        min-height: auto;
        display: flex;
        flex-direction: column;
        overflow: visible;
    }
    #content > * {
        flex-shrink: 0;
    }
    #content > .container-fluid {
        flex: 1 1 auto;
        flex-shrink: 0;
        min-height: auto;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        overflow: visible;
        box-sizing: border-box;
    }
}

@media (max-width: 768px) {
    /* Mobile Container */
    .container-fluid {
        padding: 1rem; /* 16px on mobile */
    }
    
    /* Mobile Cards */
    .card {
        margin-bottom: 1rem; /* 16px between cards on mobile */
    }
    
    .card-body {
        padding: 1rem; /* 16px inside cards on mobile */
    }
    
    .card-header {
        padding: 0.75rem 1rem; /* 12px 16px on mobile */
    }
    
    /* Mobile Typography */
    body {
        font-size: 0.875rem; /* Keep 14px on mobile */
    }
    
    h1 { font-size: 1.5rem; }   /* 24px on mobile */
    h2 { font-size: 1.25rem; }  /* 20px on mobile */
    h3 { font-size: 1.125rem; } /* 18px on mobile */
    h4 { font-size: 1rem; }     /* 16px on mobile */
    h5 { font-size: 0.9375rem; } /* 15px on mobile */
    h6 { font-size: 0.875rem; }  /* 14px on mobile */
    
    /* Mobile Buttons */
    .btn {
        font-size: 0.875rem; /* 14px - keep same */
        padding: 0.5rem 1rem; /* 8px 16px - keep same */
        min-height: 38px;
    }
    
    .btn-sm {
        font-size: 0.8125rem; /* 13px */
        padding: 0.375rem 0.75rem; /* 6px 12px */
        min-height: 32px;
    }
    
    /* Mobile Forms — font-size: 16px prevents iOS Safari auto-zoom on focus */
    .form-control,
    select.form-control,
    textarea.form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="search"],
    input[type="url"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px !important;
        padding: 0.5rem 0.75rem !important; /* 8px 12px — consistent across all inputs */
        min-height: 40px !important;
        box-sizing: border-box;
    }
    
    label {
        font-size: 0.8125rem; /* 13px */
        margin-bottom: 0.375rem; /* 6px on mobile */
    }
    
    .form-group {
        margin-bottom: 0.875rem; /* 14px on mobile */
    }
    
    /* Mobile Tables */
    .table thead th {
        padding: 0.5rem; /* 8px on mobile */
        font-size: 0.7rem; /* 11.2px on mobile */
    }
    
    .table tbody td {
        padding: 0.5rem; /* 8px on mobile */
        font-size: 0.8125rem; /* 13px on mobile */
    }
    
    /* Mobile Stat Cards */
    .stat-card .card-body,
    .metric-card .card-body {
        padding: 0.875rem; /* 14px on mobile */
    }
    
    .stat-card .text-xs,
    .metric-card .text-xs {
        font-size: 0.65rem; /* 10.4px on mobile */
    }
    
    .stat-card .h5,
    .metric-card .h5 {
        font-size: 1.25rem; /* 20px on mobile */
    }
    
    /* Mobile Modals */
    .modal-header {
        padding: 1rem 1.25rem; /* 16px 20px on mobile */
    }
    
    .modal-body {
        padding: 1.25rem; /* 20px on mobile */
    }
    
    .modal-footer {
        padding: 0.875rem 1.25rem; /* 14px 20px on mobile */
    }
    
    /* Mobile Badges */
    .badge {
        font-size: 0.7rem; /* 11.2px on mobile */
        padding: 0.2rem 0.4rem; /* 3.2px 6.4px on mobile */
    }
    
    /* Mobile Topbar: compact branch selector; gap from logo so it never touches */
    .topbar {
        height: 56px;
        padding: 0 0.5rem 0 0.75rem;
        flex-wrap: nowrap;
    }
    .topbar .navbar-nav.ml-auto {
        flex: 1;
        justify-content: flex-end;
        min-width: 0;
        gap: 0;
        margin-left: 8px;
    }
    .topbar .navbar-nav.ml-auto .nav-item {
        margin: 0;
    }
    .topbar-left {
        flex-shrink: 0;
        max-width: 120px;
    }
    .topbar .branch-selector-pill {
        width: max-content;
        max-width: 165px;
        min-width: 0;
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
        gap: 6px;
        box-sizing: border-box;
        overflow: hidden;
    }
    .topbar .branch-selector-pill .branch-pill-dot {
        display: none !important;
    }
    .topbar .branch-selector-pill {
        border-width: 2px !important;
        border-color: #e5e7eb !important;
    }
    .topbar .branch-selector-pill .branch-name-line {
        display: flex;
        align-items: center;
        gap: 5px;
        min-width: 0;
    }
    .topbar .branch-selector-pill .branch-selector-compact-inner .branch-selector-company {
        max-width: 100%;
        min-width: 0;
    }
    .topbar .branch-selector-pill .branch-name-dot {
        width: 6px;
        height: 6px;
        min-width: 6px;
        min-height: 6px;
        border-radius: 50%;
        flex-shrink: 0;
        margin-right: 0;
    }
    .topbar .branch-selector-pill .branch-pill-chevron {
        font-size: 0.5rem !important;
    }
    .topbar .branch-selector-pill .branch-selector-compact-inner {
        min-width: 0;
        max-width: 14ch;
        overflow: hidden;
    }
    .topbar .branch-selector-pill .branch-selector-company,
    .topbar .branch-selector-pill .branch-name {
        max-width: 10ch;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }
    
    /* Mobile: hide sidebar by default (overlay when toggled); content full width; animate close (slide in off-screen) */
    .sidebar {
        transform: translateX(-100%);
        z-index: 1050;
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        position: fixed;
        width: min(86vw, 320px) !important;
        min-width: min(86vw, 320px) !important;
        max-width: min(86vw, 320px) !important;
        bottom: 0;
        min-height: 100dvh;
        height: 100dvh;
        box-shadow: 20px 0 40px rgba(15,23,42,.18);
    }
    .sidebar.toggled {
        transform: translateX(0);
    }
    body.sidebar-collapsed-load .sidebar {
        transform: translateX(-100%);
    }
    #content-wrapper {
        margin-left: 0 !important;
    }
    .sidebar-collapse-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* Bottom nav (mobile only) — 2026 SaaS frosted bar */
    .bottom-nav {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw;
        margin: 0 !important;
        height: var(--bottom-nav-height);
        min-height: var(--bottom-nav-height);
        box-sizing: content-box;
        padding-bottom: constant(safe-area-inset-bottom, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(255,255,255,.95);
        backdrop-filter: blur(24px) saturate(1.3);
        -webkit-backdrop-filter: blur(24px) saturate(1.3);
        border-top: 1px solid rgba(15,23,42,.05);
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        z-index: 1040;
        padding-left: 6px;
        padding-right: 6px;
        border-radius: 0;
        box-shadow: none;
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        isolation: isolate;
        flex-shrink: 0;
    }
    .bottom-nav-item {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        min-width: 0;
        padding: 8px 4px 6px;
        color: #9ca3af;
        font-size: 0.6rem;
        font-weight: 600;
        text-decoration: none;
        border: none;
        background: none;
        cursor: pointer;
        transition: color 0.18s cubic-bezier(.22,1,.36,1);
        letter-spacing: 0.02em;
        gap: 3px;
        position: relative;
    }
    .bottom-nav-item i {
        font-size: 1.15rem;
        margin-bottom: 0;
        transition: color 0.18s cubic-bezier(.22,1,.36,1);
    }
    .bottom-nav-item span {
        display: block;
        text-align: center;
    }
    .bottom-nav-item.active {
        color: var(--primary-color);
    }
    .bottom-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 20px;
        height: 2.5px;
        background: var(--primary-color);
        border-radius: 0 0 2px 2px;
    }
    .bottom-nav-item.active i {
        transform: none;
    }
    .bottom-nav-item:hover {
        color: #374151;
    }
    .bottom-nav-more-trigger {
        position: relative;
    }
    /* Content padding so main area is not behind bottom nav (includes iOS safe area) */
    #content-wrapper {
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 1rem);
    }
    
    /* More Drawer — 2026 SaaS rekit */
    .more-drawer {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 82vw;
        max-width: 300px;
        background: var(--bg-main, #f8f9fa);
        z-index: 1060;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(.22,1,.36,1);
        box-shadow: -8px 0 32px rgba(15,23,42,.1);
        display: flex;
        flex-direction: column;
    }
    .more-drawer.open {
        transform: translateX(0);
    }
    .more-drawer-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.35);
        z-index: 1055;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .more-drawer-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
    body.mobile-drawer-open {
        overflow: hidden;
        position: fixed;
        inset: 0;
        width: 100%;
    }
    .more-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 1.1rem 1.1rem 0.9rem;
        border-bottom: 1px solid rgba(15,23,42,.06);
        flex-shrink: 0;
        background: #fff;
    }
    .more-drawer-close {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        border: none;
        background: transparent;
        color: #9ca3af;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.18s, color 0.18s;
        flex-shrink: 0;
        font-size: 0.8rem;
        -webkit-tap-highlight-color: transparent;
    }
    .more-drawer-close:hover {
        background: rgba(15,23,42,.06);
        color: #374151;
    }
    .more-drawer-content {
        flex: 1;
        overflow-y: auto;
        padding: 0.5rem 0;
        -webkit-overflow-scrolling: touch;
    }
    /* Company info inside drawer header */
    .more-drawer-company-info {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        flex: 1;
        min-width: 0;
    }
    .company-name-mobile {
        font-size: 0.875rem;
        font-weight: 700;
        color: #111827;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .branch-name-mobile {
        font-size: 0.68rem;
        color: #9ca3af;
        line-height: 1.3;
        font-weight: 500;
    }
    .more-drawer-nav {
        display: flex;
        flex-direction: column;
        padding: 0.2rem 0.5rem;
    }
    .more-drawer-divider {
        height: 1px;
        background: rgba(15,23,42,.05);
        margin: 0.3rem 0.75rem;
    }
    .more-drawer-item {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        padding: 0.55rem 0.75rem;
        color: #374151;
        text-decoration: none;
        font-size: 0.84rem;
        font-weight: 500;
        transition: background 0.15s, color 0.15s;
        -webkit-tap-highlight-color: transparent;
        min-height: 42px;
        border-radius: 10px;
    }
    .more-drawer-item:hover {
        background: rgba(15,23,42,.04);
        color: #111827;
        text-decoration: none;
    }
    .more-drawer-item:active {
        background: rgba(15,23,42,.06);
    }
    .more-drawer-item.active {
        background: rgba(var(--primary-rgb), 0.08);
        color: var(--primary-color);
        font-weight: 600;
    }
    .more-drawer-item i {
        width: 1.6rem;
        min-width: 1.6rem;
        height: 1.6rem;
        text-align: center;
        font-size: 0.8rem;
        color: #9ca3af;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(15,23,42,.04);
        border-radius: 7px;
    }
    .more-drawer-item:hover i {
        color: #6b7280;
        background: rgba(15,23,42,.06);
    }
    .more-drawer-item.active i {
        color: var(--primary-color);
        background: rgba(var(--primary-rgb), 0.1);
    }
    .more-drawer-item span {
        flex: 1;
        min-width: 0;
    }
    .more-drawer-item.text-danger {
        color: #dc2626 !important;
    }
    .more-drawer-item.text-danger i {
        color: #dc2626 !important;
        background: #fef2f2;
    }
    .more-drawer-item.text-danger:hover {
        background: #fef2f2;
        color: #b91c1c !important;
    }
    /* Hide items already on bottom nav (Sales, Orders, Expenses) */
    .more-drawer-item[href="sales"],
    .more-drawer-item[href="orders"],
    .more-drawer-item[href="expense"] {
        display: none !important;
    }
    /* Dark mode toggle inside more drawer */
    .more-drawer-dark-toggle.dark-mode-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.55rem 0.75rem;
        margin: 0;
        border-radius: 10px;
        font-size: 0.84rem;
        font-weight: 500;
        color: #374151;
        cursor: pointer;
        min-height: 42px;
        transition: background 0.15s;
        -webkit-tap-highlight-color: transparent;
    }
    .more-drawer-dark-toggle.dark-mode-toggle .dm-label {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    .more-drawer-dark-toggle.dark-mode-toggle .dm-label i {
        width: 20px;
        text-align: center;
        font-size: 1rem;
        color: #5f6d8c;
    }
    .more-drawer-dark-toggle.dark-mode-toggle:hover {
        background: rgba(15,23,42,.04);
    }
    .more-drawer-dark-toggle .dm-switch {
        width: 40px;
        height: 22px;
        border-radius: 11px;
    }
    .more-drawer-dark-toggle .dm-switch::after {
        width: 18px;
        height: 18px;
    }

    .more-drawer-signout {
        color: #dc2626;
        margin-top: 0.25rem;
    }
    .more-drawer-signout i {
        color: #dc2626;
    }
    .more-drawer-signout:hover {
        background: #fef2f2;
        color: #b91c1c;
    }
    .more-drawer-signout:hover i {
        color: #b91c1c;
    }
    
    
    /* Mobile Page Header - title and buttons on same line (like dashboard/sales) */
    .page-header {
        margin-bottom: 1.25rem;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }
    
    .page-header-content {
        min-width: 0;
        flex-shrink: 0;
    }
    
    .page-header h1,
    .page-header .page-title-wrapper h1 {
        font-size: 1.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .page-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .page-actions {
        flex-shrink: 0;
        flex-wrap: nowrap;
    }
    
    .page-actions .btn {
        white-space: nowrap;
    }
    
    /* Mobile Filters */
    .filter-bar,
    .search-bar {
        padding: 0.875rem 1rem; /* 14px 16px on mobile */
        margin-bottom: 1rem; /* 16px on mobile */
    }
    
    /* Mobile Dropdown */
    .dropdown-menu {
        font-size: 0.8125rem; /* 13px on mobile */
    }
    
    .dropdown-item {
        padding: 0.5rem 0.875rem; /* 8px 14px on mobile */
        font-size: 0.8125rem; /* 13px on mobile */
    }
}

/* Extra Small Mobile (< 576px) */
@media (max-width: 576px) {
    .container-fluid {
        padding: 0.875rem; /* 14px on very small screens */
    }
    
    .card-body {
        padding: 0.875rem; /* 14px on very small screens */
    }
    
    h1 { font-size: 1.375rem; } /* 22px */
    h2 { font-size: 1.125rem; } /* 18px */
    h3 { font-size: 1rem; }     /* 16px */
}

/* ============================================
   REMOVE ALL UNWANTED ANIMATIONS
   ============================================ */
.sidebar .nav-item .nav-link,
.card,
.btn,
.metric-card,
.stock-item,
.quick-action-btn {
    transform: none !important;
}

/* NO FADE IN ANIMATIONS */
@keyframes fadeInUp {
    from, to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   COMPACT TIME FILTERS
   ============================================ */
.time-filter .btn {
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.45rem 0.875rem;
}

.time-filter .btn-outline-primary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.time-filter .btn-outline-primary:hover {
    background-color: var(--border-light);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.time-filter .btn-outline-primary.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ============================================
   BRANCH SELECTOR STYLING
   ============================================ */
.branch-selector-link {
    padding: 0.5rem 1rem !important;
    display: flex;
    align-items: center;
    height: auto !important;
}

.branch-selector-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.branch-company-name {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.15rem;
}

.branch-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.branch-name i {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* Branch selector hover state */
.branch-selector-link:hover {
    background-color: var(--bg-main) !important;
}

.branch-selector-link:hover .branch-selector-content {
    opacity: 1;
}

/* Fix notification and user dropdown heights to match */
.topbar .nav-item .nav-link {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    height: auto;
}

.topbar .nav-item.dropdown .nav-link {
    height: auto !important;
}

/* Ensure consistent height for all topbar items */
.topbar .navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

/* ============================================
   MOBILE STYLES - Bottom Navigation
   ============================================ */

/* Mobile Bottom Navigation — website-matched frosted glass */
#mobileBottomNav {
    display: none;
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw;
    margin: 0 !important;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-top: 1px solid rgba(15,23,42,.06);
    padding: 0.5rem 0;
    padding-bottom: calc(0.75rem + constant(safe-area-inset-bottom, 0px));
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    /* Extra height extension below for iPhones — overscroll reveals the nav bg, not the page */
    box-sizing: content-box;
    z-index: 1040;
    box-shadow: 0 -1px 16px rgba(15,23,42,.06);
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    isolation: isolate;
}
#mobileBottomNav::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    height: 60px;
    background: inherit;
    pointer-events: none;
}

#mobileBottomNav .nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
    gap: 0.25rem;
    padding: 0 0.75rem;
}

#mobileBottomNav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 6px 4px;
    color: #5f6d8c;
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.18s cubic-bezier(.22,1,.36,1);
    border-radius: 0;
    background: none;
}

#mobileBottomNav .nav-item:hover {
    color: #0f172a;
    background: none;
}

#mobileBottomNav .nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
    color: inherit;
    transition: transform 0.18s cubic-bezier(.22,1,.36,1);
}

#mobileBottomNav .nav-item.active {
    color: var(--primary-color, var(--primary-color));
    background: none;
}

#mobileBottomNav .nav-item.active i {
    color: var(--primary-color, var(--primary-color));
    transform: scale(1.1);
}

#mobileBottomNav .nav-item span {
    font-weight: 500;
    white-space: nowrap;
}

/* Mobile Topbar Adjustments */
@media (max-width: 768px) {
    /* Hide sidebar on mobile */
    .sidebar {
        display: none !important;
    }
    
    /* Show mobile bottom nav - keep Safari stick fixes from base #mobileBottomNav */
    #mobileBottomNav {
        display: block !important;
        flex-shrink: 0;
    }
    
    /* Adjust content wrapper */
    #content-wrapper {
        margin-left: 0 !important;
        /* padding-bottom is set in the primary mobile block above with env(safe-area-inset-bottom) */
    }
    
    /* Mobile Topbar */
    .topbar {
        padding: 0.75rem 1rem;
        box-shadow: var(--shadow-md);
        position: sticky;
        top: 0;
        z-index: 999;
    }
    
    /* Force hide hamburger menu button on mobile - not needed with bottom nav */
    .topbar #sidebarToggleTop {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    /* Hide company name on mobile */
    .company-name-section {
        display: none !important;
    }
    
    /* Mobile topbar layout: Logo | Branch + User */
    .topbar ul.navbar-nav {
        display: flex;
        align-items: center;
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
    }
    
    /* Logo left aligned */
    .sidebar-brand-mobile {
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        margin-right: auto;
    }
    
    .sidebar-brand-mobile img {
        max-height: 28px;
        width: auto;
    }
    
    /* Branch selector next to user (no extra margin) */
    .topbar .nav-item.dropdown:has(#centerDropdown) {
        margin-left: auto;
        margin-right: 0;
    }
    
    #centerDropdown {
        display: flex !important;
    }
    
    .branch-selector-link {
        padding: 0.35rem 0.75rem !important;
        border-radius: var(--radius-md);
        background: var(--bg-main);
    }
    
    .branch-company-name {
        font-size: 0.6rem !important;
        color: var(--text-secondary);
    }
    
    .branch-name {
        font-size: 0.75rem !important;
        font-weight: 600;
        color: var(--text-primary);
    }
    
    .branch-name i {
        font-size: 0.6rem !important;
        margin-left: 0.25rem;
    }
    
    /* Hide company name and branch on mobile */
    .mobile-company-branch {
        display: none !important;
    }
    
    /* Hide hamburger and company name section on mobile */
    .topbar .company-name-section {
        display: none !important;
    }
    
    /* User dropdown on right - sibling of branch selector */
    .user-dropdown {
        padding: 0.35rem 0.75rem !important;
        position: relative;
    }
    
    .user-dropdown img {
        width: 32px !important;
        height: 32px !important;
    }
    
    .user-dropdown .user-info,
    .user-dropdown > .fa-chevron-down {
        display: none !important;
    }
    
    /* Notification badge on user icon */
    .mobile-notification-badge {
        position: absolute;
        top: 0;
        right: 0;
        background: var(--color-danger);
        color: white;
        border-radius: 50%;
        width: 16px;
        height: 16px;
        font-size: 0.65rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        border: 2px solid white;
    }
    
    /* Hide desktop elements on mobile */
    .topbar .topbar-divider,
    .d-none.d-sm-block {
        display: none !important;
    }
    
    /* Mobile user dropdown menu */
    .user-dropdown + .dropdown-menu {
        right: 0 !important;
        left: auto !important;
        min-width: 200px;
    }
    
    /* Add notifications to user dropdown on mobile */
    .mobile-notification-section {
        display: block;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .mobile-notification-section .dropdown-item {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
    
    /* Adjust page header for mobile */
    .page-header {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    /* Mobile card adjustments */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Mobile table responsiveness */
    .table-responsive {
        border: none;
    }
    
    /* Keep branch selector and user dropdown visible on mobile (do not hide .nav-item.dropdown globally) */
    
    /* Hide desktop notification dropdown on mobile */
    #notificationsNav {
        display: none !important;
    }
    
    /* Show notifications in mobile user dropdown */
    .mobile-notification-section {
        display: block !important;
    }
    
    .app-footer {
        display: none !important;
    }
}

/* Extra small devices (portrait phones) */
@media (max-width: 576px) {
    .topbar {
        padding: 0.5rem 0.75rem;
    }
    
    .sidebar-brand-mobile img {
        max-height: 24px;
    }
    
    .user-dropdown img {
        width: 32px !important;
        height: 32px !important;
    }
}

/* ============================================
   FOOTER - Fixed bottom bar
   ============================================ */
.app-footer {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    min-height: var(--footer-height);
    padding: 0.6rem var(--shell-gutter);
    background: var(--bg-main, #f8f9fa);
    border-top: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    z-index: 100;
}
/* Mobile: hide footer — bottom nav handles navigation */
@media (max-width: 767px) {
    .app-footer { display: none !important; }
}

.app-footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    color: var(--text-muted, #9ca3af);
    font-size: 0.72rem;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.app-footer-copy {
    flex-shrink: 0;
    letter-spacing: 0.01em;
    color: var(--text-muted, #9ca3af);
    font-weight: 500;
}

.app-footer-brand {
    flex-shrink: 0;
}

.app-footer-link {
    color: var(--text-secondary, #6b7280);
    text-decoration: none;
    transition: color 0.15s ease;
    font-weight: 600;
}

.app-footer-link:hover {
    color: var(--primary-color);
}

/* ============================================
   TABLE VIBE (Reference: user.php)
   Badge, action button, bordering, search, entries, pagination
   ============================================ */
.table-vibe-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.table-vibe-card .card-body {
    padding: 1rem 1.25rem;
}

/* Table base - NO vertical borders, horizontal only */
.table-vibe,
.table.table-vibe {
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-vibe th,
.table-vibe td,
.table.table-vibe th,
.table.table-vibe td {
    border-left: none !important;
    border-right: none !important;
}

.table-vibe thead th,
.table.table-vibe thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    padding: 0.75rem;
    vertical-align: middle;
}

/* Sortable column headers: click to sort (DataTables classes + manual .th-sortable) */
.table-vibe thead th.sorting,
.table-vibe thead th.sorting_asc,
.table-vibe thead th.sorting_desc,
.table-vibe thead th.th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.table-vibe thead th.th-sortable:hover {
    color: var(--primary-color, var(--primary-color));
}
.table-vibe thead th.th-sortable.th-sort-asc::after {
    content: " \2191";
    font-size: 0.75em;
    opacity: 0.8;
}
.table-vibe thead th.th-sortable.th-sort-desc::after {
    content: " \2193";
    font-size: 0.75em;
    opacity: 0.8;
}

.table-vibe tbody td,
.table.table-vibe tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light) !important;
}

.table-vibe tbody tr:last-child td,
.table.table-vibe tbody tr:last-child td {
    border-bottom: none !important;
}

.table-vibe tbody tr:hover,
.table.table-vibe tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Badge status (shared across tables) */
.badge-status {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
}

.badge-status.badge-active,
.badge-status.badge-success {
    background-color: var(--color-success);
    color: white;
    border: none;
}

.badge-status.badge-disabled,
.badge-status.badge-secondary {
    background-color: var(--color-secondary);
    color: white;
    border: none;
}

.badge-status.badge-warning {
    background-color: var(--color-warning);
    color: #000;
}

.badge-status.badge-danger {
    background-color: var(--color-danger);
    color: white;
}

.badge-status.badge-invited {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.badge-status.badge-pending,
.badge-status.badge-info {
    background-color: var(--color-info);
    color: white;
}

.badge-status.badge-verified {
    background-color: transparent;
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

.badge-status.badge-admin,
.badge-status.badge-manager,
.badge-status.badge-staff,
.badge-status.badge-owner {
    background-color: transparent;
    border: 1px solid currentColor;
}

.badge-status.badge-admin { color: #4e73df; border-color: #4e73df; }
.badge-status.badge-manager { color: #36b9cc; border-color: #36b9cc; }
.badge-status.badge-staff { color: #6c757d; border-color: #6c757d; }
.badge-status.badge-owner { color: #5a5c69; border-color: #5a5c69; }

/* Action menu (3-dot dropdown) - consistent across all pages */
.action-menu {
    position: relative;
    display: inline-block;
}

.action-menu-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    color: #6c757d;
    transition: all 0.2s;
    border-radius: 6px;
}

.action-menu-btn:hover {
    color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.08);
}

.action-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.08);
    min-width: 200px;
    z-index: 1060;
    overflow: hidden;
}

.action-menu-dropdown.show {
    display: block;
}

.action-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1f2937;
    transition: all 0.15s;
    font-size: 0.875rem;
    text-decoration: none;
}

.action-menu-item:last-child {
    border-bottom: none;
}

.action-menu-item:hover {
    background-color: #f8f9fa;
}

.action-menu-item i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.action-menu-item.danger {
    color: #dc3545;
}

.action-menu-item.danger:hover {
    background-color: rgba(220, 53, 69, 0.08);
}

.action-menu-item.success {
    color: #28a745;
}

.action-menu-item.success:hover {
    background-color: rgba(40, 167, 69, 0.08);
}

.action-menu-item.warning {
    color: #d97706;
}

.action-menu-item.warning:hover {
    background-color: rgba(217, 119, 6, 0.08);
}

.action-menu-item.info {
    color: #17a2b8;
}

.action-menu-item.info:hover {
    background-color: rgba(23, 162, 184, 0.08);
}

.action-dropdown-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: var(--bg-sidebar) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

.action-dropdown-btn:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

/* Table action dropdown: always on top (fix single-row dropdown sinking into table) */
.table td .dropdown,
.table th .dropdown {
    position: relative;
    z-index: 2;
}
.table td .dropdown.show,
.table th .dropdown.show {
    z-index: 1060;
}
.table .dropdown-menu {
    z-index: 1060;
}

/* DataTables wrapper (search, entries, pagination) */
div.dataTables_wrapper {
    font-size: 0.875rem;
}

div.dataTables_wrapper div.dataTables_length,
div.dataTables_wrapper div.dataTables_filter {
    padding: 0.5rem 0;
}

div.dataTables_wrapper div.dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
}

div.dataTables_wrapper div.dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
}

div.dataTables_wrapper div.dataTables_info {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

div.dataTables_wrapper div.dataTables_paginate .page-link {
    border-color: var(--border-color);
    color: var(--text-primary);
}

div.dataTables_wrapper div.dataTables_paginate .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Custom pagination (non-DataTables) - match vibe */
.table-vibe-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.table-vibe-pagination .table-vibe-info {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.table-vibe-pagination .pagination {
    margin-bottom: 0;
}

.table-vibe-pagination .pagination .page-link {
    border-color: var(--border-color);
    color: var(--text-primary);
}

.table-vibe-pagination .pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   IMPERSONATION STRIP (fixed at ultimate top, subtle, never scrolls away)
   ============================================ */
.impersonation-strip {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fefce8;
    color: #854d0e;
    border-bottom: 1px solid #fde68a;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
/* Reserve space so content doesn't sit under the fixed strip */
body:has(.impersonation-strip) {
    padding-top: 36px;
}
/* Sidebar: pin from below strip to viewport bottom so it stays on screen and can scroll */
body:has(.impersonation-strip) .sidebar,
body:has(.impersonation-strip) #accordionSidebar {
    top: 36px;
    bottom: 0;
    height: auto;
    min-height: 0;
}
.impersonation-strip-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 1rem;
    flex-wrap: wrap;
    max-width: 100%;
}
.impersonation-strip-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.impersonation-strip-text > i {
    font-size: 0.875rem;
    flex-shrink: 0;
    opacity: 0.85;
}
.impersonation-strip-title {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.impersonation-strip-detail {
    display: block;
    font-size: 0.6875rem;
    opacity: 0.9;
    line-height: 1.3;
}
.impersonation-strip-company,
.impersonation-strip-admin {
    white-space: nowrap;
}
.impersonation-strip-btn {
    background: #fff;
    color: #b45309;
    border: 1px solid #fde68a;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.6875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
}
.impersonation-strip-btn:hover {
    background: #fef9c3;
    color: #92400e;
    border-color: #facc15;
}
.impersonation-strip-btn i {
    font-size: 0.65rem;
}
@media (max-width: 767px) {
    body:has(.impersonation-strip) {
        padding-top: 52px;
    }
    body:has(.impersonation-strip) .sidebar,
    body:has(.impersonation-strip) #accordionSidebar {
        top: 52px;
        bottom: 0;
        height: auto;
        min-height: 0;
    }
    .impersonation-strip-inner {
        padding: 0.4rem 0.75rem;
        flex-direction: row;
        align-items: center;
    }
    .impersonation-strip-text {
        gap: 0.4rem;
        flex: 1;
        min-width: 0;
    }
    .impersonation-strip-title {
        font-size: 0.625rem;
    }
    .impersonation-strip-detail {
        font-size: 0.625rem;
    }
    .impersonation-strip-company,
    .impersonation-strip-admin {
        display: inline;
        white-space: nowrap;
    }
    .impersonation-strip-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.625rem;
    }
    .impersonation-strip-btn-text {
        display: inline;
    }
}

/* ============================================
   DARK MODE
   ============================================ */
html[data-theme="dark"] {
    --sidebar-logo-text: #ececef;
    --bg-main: #0f0f12;
    --bg-sidebar: #131316;
    --bg-card: #151518;
    --text-primary: #ececef;
    --text-secondary: #a0a4b0;
    --text-muted: #64687a;
    --border-color: rgba(255,255,255,.06);
    --border-light: rgba(255,255,255,.03);
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    color-scheme: dark;

    /* Extended palette — dark overrides */
    --bg-subtle: #131316;
    --bg-hover: rgba(255,255,255,.04);
    --text-heading: #ececef;
    --text-body: #c4c8d4;
    --text-label: #a0a4b0;
    --text-placeholder: #64687a;
    --border-mid: rgba(255,255,255,.08);

    /* Semantic tinted backgrounds (dark mode — low-opacity tints) */
    --bg-info: rgba(59,130,246,0.08);    --text-info: #7ab4ff;
    --bg-warning: rgba(245,158,11,0.08); --text-warning: #fbbf24;  --text-warning-dark: #fcd34d;
    --bg-danger-light: rgba(239,68,68,0.07); --text-danger: #ff8a8a;
    --bg-success-light: rgba(16,185,129,0.07);--text-success: #5ae8b5; --border-success: rgba(74,222,128,0.2);
    --bg-note: rgba(161,98,7,0.08);      --text-note: #fbbf24;     --text-note-dark: #fcd34d;
    --bg-deleted: rgba(250,204,21,0.06); --border-deleted: rgba(250,204,21,0.25); --text-deleted: #fcd34d;
    --bg-discount: rgba(254,249,195,0.06); --text-discount: #fbbf24;
}

/* Core layout — override SB Admin 2 hardcoded #f8f9fc and any other white bgs */
html[data-theme="dark"] body {
    background-color: var(--bg-main) !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] #content-wrapper {
    background-color: var(--bg-main) !important;
}
html[data-theme="dark"] #content-wrapper #content {
    background-color: var(--bg-main) !important;
}
html[data-theme="dark"] .container-fluid {
    background-color: transparent !important;
}

/* Cards — elevated surface */
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-modern,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .metric-card {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    box-shadow: none !important;
}

/* Footer */
html[data-theme="dark"] .app-footer {
    background: var(--bg-main) !important;
    border-top: 1px solid rgba(255,255,255,.025) !important;
}
html[data-theme="dark"] .app-footer-copy,
html[data-theme="dark"] .app-footer-brand {
    color: var(--text-muted, #5c6070) !important;
}
html[data-theme="dark"] .app-footer-link {
    color: var(--text-secondary, #a1a5b0) !important;
}

/* Table headers — override hardcoded "white !important" */
html[data-theme="dark"] table thead th {
    background: rgba(255,255,255,.015) !important;
    color: var(--text-muted) !important;
    border-bottom-color: rgba(255,255,255,.03) !important;
}
html[data-theme="dark"] table thead.thead-light th {
    background: rgba(255,255,255,.015) !important;
    color: var(--text-muted) !important;
}
html[data-theme="dark"] .table thead th {
    background-color: rgba(255,255,255,.015) !important;
}

/* Card modern — hardcoded white */
html[data-theme="dark"] .card-modern {
    background: var(--bg-card);
}

/* Branch notification — hardcoded white */
html[data-theme="dark"] .branch-notification {
    background: var(--bg-card);
}

/* Dropdown menus (Bootstrap) */
html[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-card);
    border: 1px solid rgba(255,255,255,.04);
    box-shadow: 0 8px 32px rgba(0,0,0,.45);
}
html[data-theme="dark"] .dropdown-item {
    color: var(--text-secondary);
}
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255,255,255,.05);
    color: var(--text-primary);
}

/* Modals */
html[data-theme="dark"] .modal-backdrop.show {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
html[data-theme="dark"] .modal-content {
    background-color: var(--bg-card);
    border: 1px solid rgba(255,255,255,.04);
    color: var(--text-primary);
    box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
html[data-theme="dark"] .modal-header {
    border-bottom-color: rgba(255,255,255,.04);
}
html[data-theme="dark"] .modal-footer {
    border-top-color: rgba(255,255,255,.04);
    background: rgba(255,255,255,.015);
}
html[data-theme="dark"] .modal-footer .btn-secondary,
html[data-theme="dark"] .modal-footer .btn-default,
html[data-theme="dark"] .modal-footer .btn-light {
    background: rgba(255,255,255,.04);
    border-color: rgba(255,255,255,.04);
    color: var(--text-secondary);
}
html[data-theme="dark"] .modal-footer .btn-secondary:hover,
html[data-theme="dark"] .modal-footer .btn-default:hover,
html[data-theme="dark"] .modal-footer .btn-light:hover {
    background: rgba(255,255,255,.07);
    color: var(--text-primary);
}
html[data-theme="dark"] .close {
    color: var(--text-secondary);
    text-shadow: none;
}

/* Checkboxes & custom controls — dark mode */
html[data-theme="dark"] .custom-control-label::before {
    background-color: var(--bg-main);
    border-color: var(--border-color);
}
html[data-theme="dark"] .custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--primary-color, var(--primary-color));
    border-color: var(--primary-color, var(--primary-color));
}
html[data-theme="dark"] .custom-control-input:focus ~ .custom-control-label::before {
    box-shadow: 0 0 0 0.15rem rgba(var(--primary-rgb), 0.2);
}
html[data-theme="dark"] .custom-control-label {
    color: var(--text-primary);
}
html[data-theme="dark"] input[type="checkbox"] {
    accent-color: var(--primary-color, var(--primary-color));
}
html[data-theme="dark"] .form-check-label {
    color: var(--text-primary);
}
html[data-theme="dark"] .custom-switch .custom-control-label::before {
    background-color: var(--border-color);
}
html[data-theme="dark"] .custom-switch .custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--primary-color, var(--primary-color));
    border-color: var(--primary-color, var(--primary-color));
}

/* Alerts — dark mode */
html[data-theme="dark"] .alert {
    border-color: var(--border-color);
}
html[data-theme="dark"] .alert-danger {
    background: rgba(220, 38, 38, 0.1) !important;
    color: #fca5a5 !important;
    border-color: rgba(220, 38, 38, 0.25) !important;
}
html[data-theme="dark"] .alert-success {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
}
html[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #fcd34d !important;
    border-color: rgba(245, 158, 11, 0.25) !important;
}
html[data-theme="dark"] .alert-info {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #93c5fd !important;
    border-color: rgba(59, 130, 246, 0.25) !important;
}
html[data-theme="dark"] .alert-primary {
    background: rgba(var(--primary-rgb), 0.1) !important;
    color: #fca5a5 !important;
    border-color: rgba(var(--primary-rgb), 0.25) !important;
}
html[data-theme="dark"] .alert-secondary {
    background: rgba(107, 114, 128, 0.1) !important;
    color: var(--text-secondary, #9aa0a6) !important;
    border-color: rgba(107, 114, 128, 0.25) !important;
}

/* Badge counter border */
html[data-theme="dark"] .topbar .badge-counter {
    border-color: var(--bg-card) !important;
}
html[data-theme="dark"] #notificationsBadge {
    border-color: var(--bg-card, #0f0f12) !important;
}

/* Mobile bottom nav — dark frosted glass */
html[data-theme="dark"] .bottom-nav,
html[data-theme="dark"] #mobileBottomNav {
    background: rgba(12,12,15,.92);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-top: 1px solid rgba(255,255,255,.025);
    box-shadow: 0 -1px 8px rgba(0,0,0,.2);
}
html[data-theme="dark"] .bottom-nav-item {
    color: #5c6070;
}
html[data-theme="dark"] .bottom-nav-item:hover {
    color: #c4c8d4;
}

/* More menu (mobile) */
html[data-theme="dark"] #mobileMoreMenu {
    background: var(--bg-card);
    border-left-color: var(--border-color);
}

/* More drawer (mobile slide-out) — dark mode */
html[data-theme="dark"] .more-drawer {
    background: var(--bg-main);
    box-shadow: -8px 0 40px rgba(0,0,0,.5);
}
html[data-theme="dark"] .more-drawer-header {
    background: var(--bg-card);
    border-bottom-color: rgba(255,255,255,.03);
}
html[data-theme="dark"] .more-drawer-overlay.active {
    background: rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .more-drawer-close {
    background: transparent;
    color: var(--text-muted, #6b7280);
}
html[data-theme="dark"] .more-drawer-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary, #e8eaed);
}
html[data-theme="dark"] .more-drawer-item i {
    background: rgba(255,255,255,.05);
    color: var(--text-muted, #6b7280);
}
html[data-theme="dark"] .more-drawer-item:hover i {
    background: rgba(255,255,255,.08);
}
html[data-theme="dark"] .company-name-mobile {
    color: var(--text-primary, #e8eaed);
}
html[data-theme="dark"] .branch-name-mobile {
    color: var(--text-secondary, #9aa0a6);
}
html[data-theme="dark"] .more-drawer-divider {
    background: var(--border-color, #252530);
}
html[data-theme="dark"] .more-drawer-item {
    color: var(--text-secondary, #9aa0a6);
}
html[data-theme="dark"] .more-drawer-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary, #e8eaed);
}
html[data-theme="dark"] .more-drawer-item:active {
    background: rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .more-drawer-item.active {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary-color, var(--primary-color));
}
html[data-theme="dark"] .more-drawer-item i {
    color: var(--text-muted, #6b7280);
}
html[data-theme="dark"] .more-drawer-item:hover i {
    color: var(--text-secondary, #9aa0a6);
}
html[data-theme="dark"] .more-drawer-item.active i {
    color: var(--primary-color, var(--primary-color));
}
html[data-theme="dark"] .more-drawer-item.text-danger {
    color: #f87171 !important;
}
html[data-theme="dark"] .more-drawer-item.text-danger i {
    color: #f87171 !important;
    background: rgba(248, 113, 113, 0.08) !important;
}
html[data-theme="dark"] .more-drawer-item.text-danger:hover {
    background: rgba(248, 113, 113, 0.08) !important;
}
html[data-theme="dark"] .more-drawer-item.text-danger:hover i {
    background: rgba(248, 113, 113, 0.15) !important;
}
html[data-theme="dark"] .more-drawer-dark-toggle.dark-mode-toggle {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .more-drawer-dark-toggle.dark-mode-toggle:hover {
    background: rgba(255,255,255,.04) !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .more-drawer-dark-toggle.dark-mode-toggle .dm-label i {
    color: #f59e0b !important;
}

/* Branch selector pill border on mobile */
html[data-theme="dark"] .topbar .branch-selector-pill {
    border-color: var(--border-mid, #2d2d35) !important;
}

/* Sidebar — elevated surface with right edge */
html[data-theme="dark"] .sidebar {
    background: var(--bg-sidebar) !important;
    box-shadow: 1px 0 0 rgba(255,255,255,.025), 4px 0 12px rgba(0,0,0,.2) !important;
}
html[data-theme="dark"] .sidebar .sidebar-divider {
    border-top-color: rgba(255,255,255,.02);
}
html[data-theme="dark"] .sidebar .sidebar-brand:hover {
    background-color: rgba(255, 255, 255, 0.04);
}
html[data-theme="dark"] .sidebar #sidebarToggle {
    background-color: rgba(255,255,255,.04) !important;
    border: 1px solid rgba(255,255,255,.03);
}

/* Bootstrap text-muted */
html[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

/* DataTables */
html[data-theme="dark"] .dataTables_wrapper .dataTables_length,
html[data-theme="dark"] .dataTables_wrapper .dataTables_filter,
html[data-theme="dark"] .dataTables_wrapper .dataTables_info,
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary);
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}
html[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--border-light) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Select / custom-select dark bg + arrow fix */
html[data-theme="dark"] .custom-select,
html[data-theme="dark"] select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3e%3cpath fill='%239aa0a6' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 8px 10px !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    padding-right: 2rem !important;
}
/* Form controls — true dark inputs */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .custom-select {
    background-color: rgba(255,255,255,.03) !important;
    border-color: rgba(255,255,255,.08) !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .custom-select:focus {
    background-color: rgba(255,255,255,.04) !important;
    border-color: rgba(var(--primary-rgb), 0.5) !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
}
/* Select option elements (native dropdown) */
html[data-theme="dark"] .form-control option,
html[data-theme="dark"] .custom-select option,
html[data-theme="dark"] select option {
    background-color: var(--bg-card, #18181c);
    color: var(--text-primary, #f0f1f4);
}

/* Input placeholder */
html[data-theme="dark"] ::placeholder {
    color: var(--text-muted) !important;
    opacity: 1;
}

/* Scrollbar */
html[data-theme="dark"] ::-webkit-scrollbar-track {
    background: transparent;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.1);
    border-radius: 4px;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,.16);
}

/* Page icon backgrounds */
html[data-theme="dark"] .page-icon.primary { background: rgba(var(--primary-rgb), 0.15); }
html[data-theme="dark"] .page-icon.success { background: rgba(16, 185, 129, 0.15); }
html[data-theme="dark"] .page-icon.info { background: rgba(59, 130, 246, 0.15); }
html[data-theme="dark"] .page-icon.warning { background: rgba(245, 158, 11, 0.15); }

/* Dark mode toggle styling in dropdown */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin: 2px 0.5rem;
    transition: var(--transition);
    user-select: none;
}
.dark-mode-toggle:hover {
    background-color: var(--border-light);
    color: var(--text-primary);
}
.dark-mode-toggle .dm-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.dark-mode-toggle .dm-label i {
    font-size: 0.875rem;
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}
.dark-mode-toggle:hover .dm-label i {
    color: var(--text-primary);
}
/* Hidden checkbox — kept in DOM but not used for logic */
.dm-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}
/* Toggle switch — driven by .dm-on class (JS adds/removes on click) */
.dm-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: #d1d5db;
    border-radius: 10px;
    transition: background 0.22s cubic-bezier(.22,1,.36,1);
    flex-shrink: 0;
    cursor: pointer;
}
.dm-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.22s cubic-bezier(.22,1,.36,1);
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
/* ON state — dark mode active */
.dm-switch.dm-on {
    background: var(--primary-color, var(--primary-color));
}
.dm-switch.dm-on::after {
    transform: translateX(16px);
}

/* Sidebar logo — swap to dark variant via JS (see modern-ui.js applyDarkMode) */
/* No CSS filter needed — JS swaps logo.svg ↔ logo-dark.svg */

/* ---- Broad overrides for page-specific hardcoded #fff/white ---- */
/* Cards, panels, modals, drawers, toasts, action menus */
html[data-theme="dark"] .action-menu-dropdown,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .resman-toast,
html[data-theme="dark"] .branch-notification,
html[data-theme="dark"] .skeleton-card,
html[data-theme="dark"] .skeleton-table {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* Generic white-background sections used across pages */
html[data-theme="dark"] .filter-bar,
html[data-theme="dark"] .search-bar,
html[data-theme="dark"] .back-btn,
html[data-theme="dark"] .filter-pill,
html[data-theme="dark"] .notif-item,
html[data-theme="dark"] .load-more-btn,
html[data-theme="dark"] .ref-card,
html[data-theme="dark"] .ref-link-card,
html[data-theme="dark"] .ref-list-card,
html[data-theme="dark"] .branch-card,
html[data-theme="dark"] .charge-item,
html[data-theme="dark"] .dash-pool-card,
html[data-theme="dark"] .dashboard-edit-toolbar-btn {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Buttons with white backgrounds */
html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .btn-2026-secondary,
html[data-theme="dark"] .btn-edit-branch,
html[data-theme="dark"] .btn-cancel-edit,
html[data-theme="dark"] .btn-delete-branch,
html[data-theme="dark"] .btn-activate-branch,
html[data-theme="dark"] .btn-deactivate-branch,
html[data-theme="dark"] .be-btn-cancel,
html[data-theme="dark"] .action-btn-outline {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Inputs and selects */
html[data-theme="dark"] .be-input,
html[data-theme="dark"] .pf-search-input,
html[data-theme="dark"] .uf-search-input {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Bottom sheet / editor headers and bodies */
html[data-theme="dark"] .be-header,
html[data-theme="dark"] .be-body {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Tab pills and view buttons with white active states */
html[data-theme="dark"] .pf-view-btn.active,
html[data-theme="dark"] .pf-tab:hover,
html[data-theme="dark"] .uf-tab:hover,
html[data-theme="dark"] .uamt-btn.active,
html[data-theme="dark"] .menu-import-mode-btn.active,
html[data-theme="dark"] .cat-item-chosen {
    background: var(--bg-card) !important;
}

/* Hardcoded text colors in page CSS (#374151, #111827, #0f172a, etc.) */
html[data-theme="dark"] .branch-card,
html[data-theme="dark"] .be-input,
html[data-theme="dark"] .btn-2026-secondary,
html[data-theme="dark"] .btn-edit-branch,
html[data-theme="dark"] .btn-cancel-edit,
html[data-theme="dark"] .be-btn-cancel,
html[data-theme="dark"] .dashboard-edit-toolbar-btn {
    color: var(--text-primary) !important;
}

/* Onboarding overlay */
html[data-theme="dark"] .onboarding-modal,
html[data-theme="dark"] .onboarding-card,
html[data-theme="dark"] .onboarding-content {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Responsive shared (mobile panels, bottom sheets, etc.) */
html[data-theme="dark"] .mobile-panel,
html[data-theme="dark"] .bottom-sheet,
html[data-theme="dark"] .bottom-sheet-content,
html[data-theme="dark"] .mobile-filter-panel {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Menu import cards */
html[data-theme="dark"] .menu-import-card,
html[data-theme="dark"] .menu-import-review .menu-import-cat-pill,
html[data-theme="dark"] .menu-import-review .add-cat-btn,
html[data-theme="dark"] .menu-import-card-row2 .menu-import-cat {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

/* Settings pages */
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .perm-card,
html[data-theme="dark"] .perm-grid-item {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}
html[data-theme="dark"] .settings-section {
    background: transparent !important;
}

/* Profile page */
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .profile-section {
    background: var(--bg-card) !important;
}

/* Mobile bottom nav dark — frosted glass */
html[data-theme="dark"] .bottom-nav {
    background: rgba(12,12,15,.92) !important;
    backdrop-filter: blur(24px) saturate(1.4) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.4) !important;
    border-color: rgba(255,255,255,.025) !important;
    box-shadow: 0 -1px 8px rgba(0,0,0,.2) !important;
}

/* Dropdown header card (user profile dropdown) */
html[data-theme="dark"] .dropdown-header-card {
    border-color: var(--border-color) !important;
}

/* Chart.js canvas backgrounds — transparent works for both modes */
html[data-theme="dark"] canvas {
    border-radius: var(--radius-md);
}

/* Hardcoded border colors (#e5e7eb) in page CSS */
html[data-theme="dark"] [style*="border"],
html[data-theme="dark"] [style*="border-color"] {
    border-color: var(--border-color);
}

/* SB Admin 2 overrides */
html[data-theme="dark"] .bg-white {
    background-color: var(--bg-card) !important;
}
html[data-theme="dark"] .bg-light {
    background-color: var(--bg-main) !important;
}
html[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .text-gray-900,
html[data-theme="dark"] .text-gray-800 {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .text-gray-600,
html[data-theme="dark"] .text-gray-500 {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-left,
html[data-theme="dark"] .border-right,
html[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

/* User dropdown header card */
html[data-theme="dark"] .user-dropdown-menu .dropdown-header-card {
    background: var(--border-light);
}

/* Login/Register pages */
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .register-card,
html[data-theme="dark"] .verify-card {
    background: var(--bg-card) !important;
}

/* Receipt page — keep light for printing */

/* Dark mode sun/moon icon swap */
html[data-theme="dark"] .dark-mode-toggle .dm-label i::before {
    content: "\f185"; /* fa-sun */
}
html[data-theme="dark"] .dark-mode-toggle .dm-label i {
    color: #f59e0b;
}

/* ---- Header.css dark overrides (hardcoded #fff, #f3f4f6, #e5e7eb, text colors) ---- */
html[data-theme="dark"] .topbar {
    background: rgba(12,12,15,.92) !important;
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-bottom: 1px solid rgba(255,255,255,.03) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
html[data-theme="dark"] .topbar-brand,
html[data-theme="dark"] .topbar-company-name-single,
html[data-theme="dark"] .topbar-mobile-company-name {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .topbar-branch-name-single {
    color: var(--text-muted) !important;
}
html[data-theme="dark"] .topbar-nav-item {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .topbar-nav-item:hover {
    background: rgba(255,255,255,.06) !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .branch-selector-pill {
    background: rgba(255,255,255,.04) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(255,255,255,.03) !important;
}
html[data-theme="dark"] .branch-selector-pill:hover,
html[data-theme="dark"] .branch-selector-pill:focus {
    background: rgba(255,255,255,.07) !important;
}
html[data-theme="dark"] .branch-selector-pill .branch-name,
html[data-theme="dark"] .branch-selector-mobile .branch-name-mobile {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .user-dropdown-trigger {
    background: rgba(255,255,255,.03) !important;
    color: var(--text-secondary) !important;
    border: 1px solid rgba(255,255,255,.025) !important;
}
html[data-theme="dark"] .user-dropdown-trigger:hover {
    background: rgba(255,255,255,.06) !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .user-dropdown-trigger .user-name {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .user-dropdown-trigger .user-role {
    color: var(--text-muted) !important;
}
html[data-theme="dark"] .user-avatar-wrap {
    border-color: var(--primary-color) !important;
}
html[data-theme="dark"] .dashboard-view-toggle {
    background: rgba(255,255,255,.04) !important;
}
html[data-theme="dark"] .dashboard-view-toggle a {
    color: var(--text-muted) !important;
}
html[data-theme="dark"] .dashboard-view-toggle a:hover {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .dashboard-view-toggle a.active {
    background: rgba(255,255,255,.08) !important;
    color: var(--text-primary) !important;
}
/* Dropdown menus from header.css */
html[data-theme="dark"] .branch-dropdown,
html[data-theme="dark"] .dropdown-menu.user-dropdown-menu,
html[data-theme="dark"] .notifications-dropdown {
    background: var(--bg-card) !important;
    border: 1px solid rgba(255,255,255,.04) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,.45) !important;
}
html[data-theme="dark"] .branch-dropdown .dropdown-header,
html[data-theme="dark"] .branch-dropdown .branch-dropdown-title-line,
html[data-theme="dark"] .notifications-dropdown .dropdown-header {
    color: var(--text-muted) !important;
    border-bottom-color: rgba(255,255,255,.03) !important;
}
html[data-theme="dark"] .user-dropdown-menu .dropdown-header-card {
    background: rgba(255,255,255,.02) !important;
    border-bottom-color: rgba(255,255,255,.03) !important;
}
html[data-theme="dark"] .user-dropdown-menu .dropdown-header-card img {
    border-color: var(--border-color) !important;
}
html[data-theme="dark"] .user-dropdown-menu .dropdown-header-card .user-name {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .user-dropdown-menu .dropdown-header-card .user-email {
    color: var(--text-muted) !important;
}
html[data-theme="dark"] .user-dropdown-menu .dropdown-item {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .user-dropdown-menu .dropdown-item:hover {
    background: rgba(255,255,255,.05) !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .user-dropdown-menu .dropdown-item.text-danger {
    color: #f87171 !important;
}
html[data-theme="dark"] .user-dropdown-menu .dropdown-item.text-danger:hover {
    background: rgba(248, 113, 113, 0.1) !important;
}
html[data-theme="dark"] .center-button {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .center-button:hover {
    background: rgba(255,255,255,.06) !important;
}
html[data-theme="dark"] .center-button.current {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #34d399 !important;
}
html[data-theme="dark"] .notifications-dropdown {
    background: var(--bg-card) !important;
    border: 1px solid rgba(255,255,255,.04) !important;
}
html[data-theme="dark"] .notifications-dropdown .dropdown-header {
    color: var(--text-primary) !important;
    border-bottom-color: rgba(255,255,255,.03) !important;
}
html[data-theme="dark"] .notification-dropdown-item {
    border-bottom-color: var(--border-color, #1a1a1f) !important;
    color: var(--text-primary, #e8eaed) !important;
    background: transparent !important;
}
html[data-theme="dark"] .notification-dropdown-item[data-unread="1"] {
    background: rgba(var(--primary-rgb), 0.06) !important;
}
html[data-theme="dark"] .notification-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}
html[data-theme="dark"] .notification-item-title {
    color: var(--text-primary, #e8eaed) !important;
}
html[data-theme="dark"] .notification-item-message {
    color: var(--text-muted, #6b7280) !important;
}
html[data-theme="dark"] .notification-item-time {
    color: var(--text-muted, #6b7280) !important;
}
html[data-theme="dark"] .notifications-dropdown .dropdown-divider {
    border-color: var(--border-color, #252530) !important;
}
html[data-theme="dark"] .notifications-dropdown .dropdown-item:last-child {
    color: var(--text-muted, #6b7280) !important;
}
html[data-theme="dark"] .notifications-dropdown .dropdown-item:last-child:hover {
    color: var(--text-primary, #e8eaed) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}
html[data-theme="dark"] .notifications-dropdown .text-muted {
    color: var(--text-muted, #6b7280) !important;
}
html[data-theme="dark"] .topbar-bell {
    color: var(--text-secondary, #9aa0a6) !important;
}
html[data-theme="dark"] .topbar-bell:hover {
    color: var(--text-primary, #e8eaed) !important;
}
html[data-theme="dark"] .topbar-bell.has-pending .fa-bell {
    color: var(--text-primary, #e8eaed) !important;
}
html[data-theme="dark"] .topbar .nav-item:has(#notificationsDropdown) .topbar-nav-item {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .topbar .nav-item:has(#notificationsDropdown) .topbar-nav-item:hover {
    background: var(--border-light) !important;
}
html[data-theme="dark"] .branch-selector-mobile .branch-mobile-chevron {
    color: var(--text-muted) !important;
}
html[data-theme="dark"] .branch-dropdown-title-line .branch-dropdown-title-dot {
    color: var(--text-muted) !important;
}
/* Sidebar dark overrides for header.css collapse-item hover */
html[data-theme="dark"] .sidebar .collapse-item:hover {
    background-color: var(--border-light) !important;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .topbar,
    .impersonation-strip,
    #mobileBottomNav,
    .app-footer {
        display: none !important;
    }
    
    #content-wrapper {
        margin-left: 0 !important;
        padding-bottom: 0 !important;
    }
}
