/* ============================================================
   DL MEAT SUPPLY — ERP Theme  v3 — Premium SaaS
   ============================================================ */
:root {
    /* DL MEAT SUPPLY — Dark Red / Dark Orange Brand Palette */
    --app-bg:              #F8FAFC;
    --sidebar-bg:          #FFFFFF;
    --sidebar-text:        #526173;
    --sidebar-title:       #1F2937;
    --sidebar-subtitle:    #64748B;
    --sidebar-active-bg:   rgba(127,29,29,.09);
    --sidebar-active-text: #991B1B;
    --primary:             #991B1B;
    --primary-hover:       #7F1D1D;
    --primary-soft:        rgba(153,27,27,.09);
    --accent-blue:         #2B6FA3;
    --accent-blue-soft:    #EAF3F8;
    --accent-orange:       #C2410C;
    --accent-orange-soft:  rgba(194,65,12,.09);
    --purple:              #7C3AED;
    --purple-soft:         #F1ECFF;
    --success:             #16A34A;
    --success-soft:        #EAF8EF;
    --danger:              #DC2626;
    --danger-soft:         #FDECEC;
    --teal-dark:           #7F1D1D;
    --teal-soft:           rgba(127,29,29,.08);
    --card-bg:             #FFFFFF;
    --border:              #E5E7EB;
    --card-border:         #E5E7EB;
    --text-main:           #1F2937;
    --text-muted:          #64748B;

    /* Legacy alias — keeps other modules working */
    --primary-blue:        #2B6FA3;
    --primary-dark:        #7F1D1D;
    --primary-light:       #C2410C;
    --accent-brown:        #991B1B;
    --accent-dark:         #7F1D1D;
    --accent-light:        #C2410C;
    --background-main:     #F8FAFC;
    --card-white:          #FFFFFF;
    --text-dark:           #1F2937;
    --border-light:        #E5E7EB;
    --success-green:       #16A34A;
    --warning-orange:      #D97706;
    --danger-red:          #DC2626;
    --primary-navy:        #1F2937;

    /* Layout */
    --sidebar-width:       265px;
    --topnav-height:       64px;

    /* Shape */
    --radius-sm:           8px;
    --radius-md:           12px;
    --radius-lg:           16px;

    /* Shadows */
    --shadow-sm:           0 1px 4px rgba(15,23,42,.06);
    --shadow-md:           0 4px 16px rgba(15,23,42,.08);
    --shadow-lg:           0 10px 30px rgba(15,23,42,.13);
}

html[data-theme="dark"] {
    --app-bg:              #0F172A;
    --sidebar-bg:          #1E293B;
    --sidebar-text:        #E2E8F0;
    --sidebar-title:       #F8FAFC;
    --sidebar-subtitle:    #CBD5E1;
    --sidebar-active-bg:   rgba(153,27,27,.22);
    --sidebar-active-text: #FCA5A5;
    --primary:             #F87171;
    --primary-hover:       #FCA5A5;
    --primary-soft:        rgba(248,113,113,.14);
    --accent-blue:         #60A5FA;
    --accent-blue-soft:    rgba(96,165,250,.14);
    --accent-orange:       #FB923C;
    --accent-orange-soft:  rgba(251,146,60,.14);
    --purple:              #A78BFA;
    --purple-soft:         rgba(167,139,250,.15);
    --success:             #4ADE80;
    --success-soft:        rgba(74,222,128,.14);
    --danger:              #F87171;
    --danger-soft:         rgba(248,113,113,.14);
    --teal-dark:           #FCA5A5;
    --teal-soft:           rgba(248,113,113,.14);
    --card-bg:             #1E293B;
    --border:              #334155;
    --card-border:         #334155;
    --text-main:           #F8FAFC;
    --text-muted:          #CBD5E1;
    --card-white:          #1E293B;
    --text-dark:           #F8FAFC;
    --border-light:        #334155;
    --background-main:     #0F172A;
    --shadow-sm:           0 1px 4px rgba(0,0,0,.22);
    --shadow-md:           0 6px 18px rgba(0,0,0,.28);
    --shadow-lg:           0 14px 34px rgba(0,0,0,.36);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Noto Sans Khmer', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--app-bg);
    color: var(--text-main);
    font-size: 14px;
    margin: 0;
    line-height: 1.6;
    animation: pageEnter .4s ease both;
    overflow-x: hidden; /* Prevent horizontal scroll on mobile */
}

html[data-theme="dark"] body {
    background-color: var(--app-bg);
    color: var(--text-main);
}

@keyframes pageEnter {
    /* iBMS-MODAL-FIX-v2: body animation is opacity-only — NO transform on body.
   Any transform on body (even translateY(0)/none) may create a stacking context
   in some browsers, trapping position:fixed modals relative to body height.
   Slide effect moved to #main-wrapper below (modal is teleported outside it). */
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #F1F5F9; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── SIDEBAR ────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 12px rgba(15,23,42,.04);
    scrollbar-width: thin;
    scrollbar-color: #E2E8F0 transparent;
    display: flex;
    flex-direction: column;
}

/* Brand block */
#sidebar .sidebar-brand {
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}

/* ── Sidebar awning (Domnor-style) ─── */
.shop-awning-sidebar {
    display: flex;
    width: calc(100% + 40px);      /* bleed past padding on both sides */
    margin: 0 -20px 14px;
    height: 14px;
    border: none;
    border-bottom: 1px solid rgba(127,29,29,.22);
    box-shadow: 0 3px 10px rgba(127,29,29,.14);
    background: transparent;
    flex-shrink: 0;
}
.shop-awning-sidebar span {
    flex: 1;
    display: block;
    height: 100%;
}
.shop-awning-sidebar span:nth-child(odd)  { background: linear-gradient(180deg, #991B1B, #7F1D1D); }
.shop-awning-sidebar span:nth-child(even) { background: linear-gradient(180deg, #FECACA, #FEE2E2); }

/* ── Sidebar user mini card ─── */
.sidebar-user-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(127,29,29,.07);
    border: 1px solid rgba(127,29,29,.18);
    border-radius: var(--radius-md);
}
.sidebar-user-avatar {
    font-size: 22px;
    color: var(--primary);
    flex-shrink: 0;
    line-height: 1;
}
.sidebar-user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--sidebar-title);
    display: block;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 10px;
    color: var(--primary);
    font-weight: 600;
    text-transform: capitalize;
    display: block;
    opacity: .85;
}
.sidebar-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    padding: 3px 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: color .18s, background .18s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
.sidebar-action-btn:hover { color: var(--primary); background: rgba(127,29,29,.10); }
.sidebar-logout-btn:hover { color: var(--danger) !important; background: rgba(220,38,38,.08) !important; }

/* ── Sidebar footer logo ─── */
#sidebar .sidebar-footer .sf-logo {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--primary), var(--teal-dark));
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px; color: #fff;
    box-shadow: 0 2px 8px rgba(153,27,27,.30);
    margin: 0 auto 6px;
}

#sidebar .sidebar-brand .brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--teal-dark));
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff;
    box-shadow: 0 3px 10px rgba(153,27,27,.35);
    margin-bottom: 10px;
    transition: transform .25s ease;
}
#sidebar .sidebar-brand .brand-icon:hover { transform: scale(1.08) rotate(4deg); }

#sidebar .sidebar-brand h4 {
    color: var(--sidebar-title);
    font-size: 15px;
    font-weight: 800;
    margin: 0 0 3px;
    letter-spacing: -.1px;
    line-height: 1.2;
}

#sidebar .sidebar-brand .brand-sub {
    color: var(--sidebar-subtitle);
    font-size: 10.5px;
    letter-spacing: .6px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Section titles */
#sidebar .nav-section-title {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #94A3B8;
    padding: 18px 20px 5px;
    font-weight: 700;
}

/* Nav links */
#sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px 9px 16px;
    margin: 1px 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    border-radius: var(--radius-sm);
    position: relative;
}

#sidebar .nav-link:hover {
    background: var(--app-bg);
    color: var(--sidebar-active-text);
    transform: translateX(3px);
}

#sidebar .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    border-left: 3px solid var(--sidebar-active-text);
}

#sidebar .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
    opacity: .85;
}
#sidebar .nav-link.active i { opacity: 1; }

/* Submenu */
#sidebar .nav-submenu {
    display: none;
    background: #FAFBFC;
    border-left: 2px solid var(--border);
    margin: 0 8px 0 24px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

#sidebar .nav-submenu .nav-link {
    padding-left: 20px;
    font-size: 13px;
    color: var(--sidebar-text);
    margin: 1px 4px;
    padding-top: 7px;
    padding-bottom: 7px;
    opacity: .9;
}

#sidebar .nav-submenu .nav-link:hover,
#sidebar .nav-submenu .nav-link.active {
    color: var(--sidebar-active-text);
    opacity: 1;
}

#sidebar .nav-item.open .nav-submenu { display: block; }
#sidebar .nav-item.open > .nav-link .toggle-icon { transform: rotate(180deg); }

#sidebar .toggle-icon {
    margin-left: auto;
    transition: transform .2s;
    font-size: 11px;
    opacity: .5;
}

/* Sidebar footer */
#sidebar .sidebar-footer {
    margin: auto 12px 12px;
    padding: 12px 14px;
    background: var(--app-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
}
/* Legacy sf-* kept for safety */
#sidebar .sidebar-footer .sf-powered {
    font-size: 10px;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: .5px;
    display: block;
    margin-bottom: 2px;
}
#sidebar .sidebar-footer .sf-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}

/* ── Sidebar brand identity (horizontal: icon + name) ─────── */
/* When wrapped in <a> for Home link, neutralise anchor colour */
a.sidebar-brand-identity { color: inherit; }
.sidebar-brand-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.sidebar-client-icon {
    width: 42px; height: 42px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #C2410C 0%, #7F1D1D 100%);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow:
        0 0 0 3px rgba(153,27,27,.12),
        0 4px 12px rgba(153,27,27,.32);
    transition: transform .25s ease;
}
.sidebar-client-icon:hover { transform: scale(1.07); }
.sidebar-monogram {
    font-size: 16px;
    font-weight: 900;
    color: #FFFFFF;
    letter-spacing: -1px;
    line-height: 1;
    font-style: italic;
    font-family: 'Segoe UI', system-ui, sans-serif;
}
.sidebar-brand-text {
    flex: 1;
    min-width: 0;
}
.sidebar-brand-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--sidebar-title);
    display: block;
    line-height: 1.2;
    letter-spacing: -.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-brand-sub {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--sidebar-subtitle);
    font-weight: 600;
    display: block;
    opacity: .8;
}

/* ── iBMS footer ──────────────────────────────────────────── */
.ibms-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.ibms-logo-mark {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #334155 0%, #1E293B 100%);
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    margin-bottom: 4px;
}
.ibms-logo-mark em {
    font-size: 18px;
    font-weight: 900;
    font-style: italic;
    color: #fff;
    line-height: 1;
    font-family: 'Segoe UI', Georgia, serif;
}
.ibms-powered {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: #94A3B8;
    display: block;
}
.ibms-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-muted);
    display: block;
    letter-spacing: -.2px;
    line-height: 1.2;
}
.ibms-tagline {
    font-size: 8.5px;
    color: #94A3B8;
    display: block;
    letter-spacing: .15px;
    line-height: 1.3;
}
.ibms-version {
    font-size: 8px;
    color: #B0BAC8;
    display: block;
    letter-spacing: .3px;
    margin-top: 3px;
    opacity: .7;
}

/* /* iBMS-POWER-CARD-v2 */ */
/* iBMS Power Card v2 — compact sticky sidebar footer */
.ibms-power-card {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--sidebar-bg, var(--app-bg));
}
.ipc-powered {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    opacity: .6;
    letter-spacing: .2px;
    line-height: 1.5;
    white-space: nowrap;
}
.ipc-powered strong { font-weight: 800; }
/* iBMS-SUPPORT-CARD-v1 */
/* iBMS sidebar support card */
.ibms-support-title {
    display: block;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    opacity: .5;
    margin: 6px 0 3px;
    text-align: center;
    white-space: nowrap;
}
.ibms-support-link {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    font-size: 10px;
    color: var(--text-muted);
    opacity: .52;
    cursor: not-allowed;
    pointer-events: none;
    padding: 3px 0;
    text-decoration: none;
}
.ibms-support-link i { font-size: 11px; flex-shrink: 0; }
.ibms-support-link > span:first-of-type { flex: 1; text-align: left; }
.ibms-soon-badge {
    font-size: 7.5px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(100, 116, 139, .1);
    color: #64748B;
    letter-spacing: .2px;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.6;
}
html[data-theme="dark"] .ibms-soon-badge {
    background: rgba(148, 163, 184, .1);
    color: #94A3B8;
}

html[data-theme="dark"] .ibms-footer {
    background: #111827;
    border-color: #1F2937;
}
html[data-theme="dark"] .ibms-name { color: var(--text-muted); }
html[data-theme="dark"] .ibms-powered,
html[data-theme="dark"] .ibms-tagline { color: #4B5563; }

/* ── Notification bell enhancements ──────────────────────── */
.notif-count-pill {
    font-size: 9.5px;
    font-weight: 700;
    background: rgba(153,27,27,.10);
    color: #991B1B;
    border-radius: 20px;
    padding: 2px 8px;
}
html[data-theme="dark"] .notif-count-pill {
    background: rgba(248,113,113,.14);
    color: #FCA5A5;
}
.notification-item.notif-danger i {
    background: rgba(220,38,38,.12);
    color: #DC2626;
}
.notification-item.notif-warning i {
    background: rgba(194,65,12,.10);
    color: #C2410C;
}
.notification-item.notif-info i {
    background: var(--accent-blue-soft);
    color: var(--accent-blue);
}
html[data-theme="dark"] .notification-item.notif-danger i  { background: rgba(248,113,113,.16); color: #F87171; }
html[data-theme="dark"] .notification-item.notif-warning i { background: rgba(251,146,60,.16); color: #FB923C; }
html[data-theme="dark"] .notification-item.notif-info i    { background: rgba(96,165,250,.16); color: #60A5FA; }

/* ── MAIN WRAPPER ───────────────────────────────────────── */
#main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── TOP NAVBAR ─────────────────────────────────────────── */
#topnav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: var(--topnav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1010; /* Above sidebar (1000) and overlay (999) so topnav links are always clickable */
    box-shadow: 0 1px 6px rgba(15,23,42,.05);
}

#topnav .toggle-sidebar-btn {
    background: none; border: none;
    font-size: 20px; cursor: pointer;
    color: var(--text-main);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
    line-height: 1;
}
#topnav .toggle-sidebar-btn:hover {
    background: var(--app-bg);
    color: var(--primary);
}

#topnav .page-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -.1px;
}

#topnav .topnav-date-badge {
    font-size: 11.5px;
    color: var(--text-muted);
    background: var(--app-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── Single-value currency / language toggle ───────────────── */
/* Wrapper: no background/border — the pill is the entire visual */
.topbar-currency-toggle,
.topbar-language-toggle {
    align-items: center;
    gap: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}
/* Shared pill style — always looks like a clear, tappable button */
.topbar-currency-toggle .currency-pill,
.topbar-language-toggle .language-pill {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 6px 11px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease;
    box-shadow: var(--shadow-sm);
}
.topbar-currency-toggle .currency-pill:hover,
.topbar-language-toggle .language-pill:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: none;
}
/* active class kept for JS compatibility but not needed visually */
.topbar-currency-toggle .currency-pill.active,
.topbar-language-toggle .language-pill.active {
    background: var(--card-bg);
    color: var(--text-main);
}

.topbar-icon-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: var(--app-bg);
    color: var(--text-main);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
    line-height: 1;
    transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.topbar-icon-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: rgba(153,27,27,.35);
    transform: translateY(-1px);
}
.topbar-icon-btn i { font-size: 15px; }
.topbar-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    border-radius: 999px;
    padding: 0 4px;
    background: var(--danger);
    color: #fff;
    border: 2px solid var(--card-bg);
    font-size: 9px;
    font-weight: 800;
    line-height: 13px;
    text-align: center;
}

.topbar-notification-menu {
    width: 310px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card-bg);
}
.notification-menu-title {
    padding: 6px 8px 9px;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.notification-empty {
    padding: 16px 8px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}
.notification-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    text-decoration: none;
    font-size: 13px;
}
.notification-item:hover {
    background: var(--app-bg);
    color: var(--primary);
}
.notification-item i {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#topnav .user-dropdown .btn {
    background: var(--app-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    transition: all .18s;
}
#topnav .user-dropdown .btn:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}

/* ── CONTENT ────────────────────────────────────────────── */
#content { flex: 1; padding: 24px; }

/* ── CARDS ──────────────────────────────────────────────── */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--card-bg);
    transition: transform .22s ease, box-shadow .22s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-footer {
    background: var(--app-bg);
    border-top: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── GREETING CARD ──────────────────────────────────────── */
.greeting-card {
    background: linear-gradient(120deg, #FFFFFF 60%, #FEF2F2 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
}
.greeting-card .greeting-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 4px;
}
.greeting-card .greeting-sub {
    font-size: 13.5px;
    color: var(--text-muted);
    margin: 0;
}
.greeting-card .greeting-icon {
    width: 64px; height: 64px;
    background: var(--primary-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--primary);
    flex-shrink: 0;
}
.greeting-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 20px;
    padding: 3px 10px;
    margin-top: 6px;
    font-weight: 600;
}

.shop-awning {
    display: flex;
    overflow: hidden;
    border: 1px solid rgba(127,29,29,.18);
    background: #fff;
    box-shadow: 0 6px 16px rgba(127,29,29,.10);
}
.shop-awning span {
    width: 28px;
    height: 16px;
    display: block;
}
.shop-awning span:nth-child(odd) {
    background: linear-gradient(180deg, #C2410C, #991B1B);
}
.shop-awning span:nth-child(even) {
    background: linear-gradient(180deg, #FFF7ED, #FEE2E2);
}
.shop-awning span:first-child { border-bottom-left-radius: 10px; }
.shop-awning span:last-child { border-bottom-right-radius: 10px; }
.shop-awning-greeting {
    position: absolute;
    top: 0;
    left: 24px;
    width: 168px;
    height: 17px;
    border-top: 0;
    border-radius: 0 0 12px 12px;
    opacity: .85;
    pointer-events: none;
}
.shop-awning-login {
    width: 196px;
    height: 18px;
    border-top: 0;
    border-radius: 0 0 12px 12px;
    margin: -44px auto 22px;
}

/* ── KPI CARDS (White SaaS style) ───────────────────────── */
.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .22s ease, box-shadow .22s ease;
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Thin top accent line */
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kpi-blue::before   { background: var(--accent-orange); } /* iBMS-BRAND-v2 */
.kpi-green::before  { background: var(--primary); }
.kpi-orange::before { background: var(--accent-orange); }
.kpi-teal::before   { background: var(--success); }
.kpi-purple::before { background: var(--purple); }
.kpi-dark-teal::before { background: var(--teal-dark); }

.kpi-card .kpi-icon-wrap {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 20px;
}
.kpi-blue   .kpi-icon-wrap { background: var(--accent-orange-soft); color: var(--accent-orange); } /* iBMS-BRAND-v2 */
.kpi-green  .kpi-icon-wrap { background: var(--primary-soft);       color: var(--primary); }
.kpi-orange .kpi-icon-wrap { background: var(--accent-orange-soft); color: var(--accent-orange); }
.kpi-teal   .kpi-icon-wrap { background: var(--success-soft);       color: var(--success); }
.kpi-purple .kpi-icon-wrap { background: var(--purple-soft);        color: var(--purple); }
.kpi-dark-teal .kpi-icon-wrap { background: var(--teal-soft);       color: var(--teal-dark); }

.kpi-card .kpi-value {
    margin-bottom: 6px;
}
.kpi-card .kpi-value .money-current,
.kpi-card .kpi-value .money-khr {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    display: block;
    line-height: 1.15;
    letter-spacing: -.3px;
}
.kpi-card .kpi-value .money-secondary,
.kpi-card .kpi-value .money-usd {
    font-size: 13px;
    color: #64748B;
    display: block;
    line-height: 1.4;
    font-weight: 500;
    margin-top: 2px;
}
/* Plain number KPI (e.g. product count) */
.kpi-card .kpi-number {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    letter-spacing: -.4px;
    display: block;
    margin-bottom: 6px;
}

.kpi-card .kpi-label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .7px;
    font-weight: 600;
}

.kpi-card .kpi-menu-btn {
    position: absolute;
    top: 14px; right: 14px;
    background: none; border: none;
    color: #CBD5E1;
    font-size: 16px;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    transition: color .15s;
}
.kpi-card .kpi-menu-btn:hover { color: var(--text-muted); }

/* Slide-up animation on load */
.kpi-card {
    animation: kpiSlideUp .45s ease both;
}
.kpi-card:nth-child(1) { animation-delay: .05s; }
.kpi-card:nth-child(2) { animation-delay: .10s; }
.kpi-card:nth-child(3) { animation-delay: .15s; }
.kpi-card:nth-child(4) { animation-delay: .20s; }
.kpi-card:nth-child(5) { animation-delay: .25s; }
.kpi-card:nth-child(6) { animation-delay: .30s; }

@keyframes kpiSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── CHART CARDS ────────────────────────────────────────── */
.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .22s ease, box-shadow .22s ease;
}
.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.chart-card .chart-card-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.chart-card .chart-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-card .chart-card-title i {
    color: var(--primary);
    font-size: 16px;
}
.chart-card .chart-filter-pill {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-soft);
    border: 1px solid rgba(153,27,27,.25);
    border-radius: 20px;
    padding: 3px 10px;
}
.chart-card .chart-card-body {
    padding: 16px 20px 20px;
    position: relative;
}
.chart-container { position: relative; height: 240px; }
.chart-container-sm { position: relative; height: 200px; }

/* ── TABLES ─────────────────────────────────────────────── */
.table { font-size: 13.5px; margin-bottom: 0; }

.table thead th {
    background: #F8FAFC;
    color: #334155;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 14px;
    vertical-align: middle;
    border-color: #F1F5F9;
    color: var(--text-main);
}

.table tbody tr {
    transition: background-color .16s ease;
}
.table tbody tr:hover { background: #F6F8FB !important; }
.table-responsive { border-radius: var(--radius-md); overflow: hidden; }

/* ── TABLE SECTION HEADERS ──────────────────────────────── */
.table-section-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.table-section-card .card-header .view-all-btn {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: 20px;
    padding: 3px 12px;
    text-decoration: none;
    transition: all .17s;
}
.table-section-card .card-header .view-all-btn:hover {
    background: var(--primary);
    color: #fff;
}

/* ── DUAL CURRENCY ──────────────────────────────────────── */
.money-khr {
    font-weight: 800;
    font-size: 1em;
    display: block;
    line-height: 1.2;
    color: var(--text-main);
}
.money-usd {
    font-size: 0.78em;
    color: var(--text-muted);
    display: block;
    line-height: 1.3;
    font-weight: 500;
}
.money-current {
    font-weight: 800;
    font-size: 1em;
    display: block;
    line-height: 1.2;
    color: var(--text-main);
}
.money-secondary {
    font-size: 0.78em;
    color: var(--text-muted);
    display: block;
    line-height: 1.3;
    font-weight: 500;
}
/* Table cell sizing */
td .money-khr { font-size: 13.5px; }
td .money-usd { font-size: 11.5px; }
td .money-current { font-size: 13.5px; }
td .money-secondary { font-size: 11.5px; }

html[data-theme="dark"] #topnav,
html[data-theme="dark"] .card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .balance-widget,
html[data-theme="dark"] .dropdown-menu {
    background: var(--card-bg);
    border-color: var(--border);
}
html[data-theme="dark"] .text-muted {
    color: #CBD5E1 !important;
}
html[data-theme="dark"] #sidebar {
    background: var(--sidebar-bg);
    border-color: var(--border);
}
html[data-theme="dark"] #sidebar .nav-submenu,
html[data-theme="dark"] #sidebar .sidebar-footer,
html[data-theme="dark"] .card-footer {
    background: #111827;
    border-color: #1F2937;
    color: #F8FAFC;
}
/* Sidebar awning + user mini — dark mode */
html[data-theme="dark"] .shop-awning-sidebar span:nth-child(even) {
    background: linear-gradient(180deg, rgba(153,27,27,.40), rgba(127,29,29,.28));
}
html[data-theme="dark"] .sidebar-user-mini {
    background: rgba(153,27,27,.16);
    border-color: rgba(248,113,113,.22);
}
html[data-theme="dark"] .sidebar-user-name { color: #F1F5F9; }
html[data-theme="dark"] .sidebar-brand-name { color: #F1F5F9; }
html[data-theme="dark"] .sidebar-brand-sub  { color: #94A3B8; }
html[data-theme="dark"] .sidebar-action-btn { color: #94A3B8; }
html[data-theme="dark"] .sidebar-action-btn:hover { color: #FCA5A5; background: rgba(248,113,113,.12); }
html[data-theme="dark"] #sidebar .sidebar-brand { border-color: var(--border); }
/* Balance widget — dark mode */
html[data-theme="dark"] .balance-widget {
    background: var(--card-bg);
    border-color: var(--card-border);
}
/* KPI cards money text — dark mode readability */
html[data-theme="dark"] .kpi-card .kpi-value .money-current,
html[data-theme="dark"] .kpi-card .kpi-value .money-khr { color: #F1F5F9; }
html[data-theme="dark"] .kpi-card .kpi-value .money-secondary,
html[data-theme="dark"] .kpi-card .kpi-value .money-usd  { color: #94A3B8; }
html[data-theme="dark"] .table {
    --bs-table-bg: #1E293B;
    --bs-table-color: #F8FAFC;
    --bs-table-border-color: #334155;
    --bs-table-striped-bg: #263449;
    --bs-table-striped-color: #F8FAFC;
    --bs-table-hover-bg: #263449;
    --bs-table-hover-color: #F8FAFC;
    color: #F8FAFC;
}
html[data-theme="dark"] .table thead th {
    background: #263449;
    border-color: #334155;
    color: #E2E8F0;
}
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .input-group-text {
    background: #111827;
    border-color: #334155;
    color: #E2E8F0;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background: #111827;
    border-color: var(--primary);
    color: #E2E8F0;
}
html[data-theme="dark"] label,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .kpi-card .kpi-label,
html[data-theme="dark"] .balance-widget .bw-label,
html[data-theme="dark"] .donut-center-label .dcl-label {
    color: #E2E8F0;
}
html[data-theme="dark"] .chart-card .chart-card-title,
html[data-theme="dark"] .notification-menu-title,
html[data-theme="dark"] .donut-center-label .dcl-value {
    color: #F8FAFC;
}
html[data-theme="dark"] .chart-card .chart-filter-pill {
    color: #FCA5A5;
    background: rgba(248,113,113,.14);
    border-color: rgba(248,113,113,.28);
}
html[data-theme="dark"] .kpi-card .kpi-value .money-current,
html[data-theme="dark"] .kpi-card .kpi-value .money-khr,
html[data-theme="dark"] .kpi-card .kpi-number {
    color: #F8FAFC;
}
html[data-theme="dark"] .kpi-card .kpi-value .money-secondary,
html[data-theme="dark"] .kpi-card .kpi-value .money-usd {
    color: #CBD5E1;
}
html[data-theme="dark"] .money-current,
html[data-theme="dark"] .money-khr {
    color: #F8FAFC;
}
html[data-theme="dark"] .money-secondary,
html[data-theme="dark"] .money-usd {
    color: #CBD5E1;
}
html[data-theme="dark"] .balance-widget .bw-value {
    color: #F8FAFC;
}
html[data-theme="dark"] .balance-widget .bw-value.text-danger {
    color: #FCA5A5 !important;
}
html[data-theme="dark"] .balance-widget .bw-value.text-primary {
    color: #93C5FD !important;
}
html[data-theme="dark"] .greeting-card {
    background: linear-gradient(120deg, #1E293B 58%, rgba(153,27,27,.16) 100%);
}
html[data-theme="dark"] .form-control::placeholder {
    color: #94A3B8;
}
html[data-theme="dark"] .table tbody td {
    border-color: #334155;
    color: #F8FAFC;
}
html[data-theme="dark"] .table tbody tr:hover {
    background: #263449 !important;
}
html[data-theme="dark"] .dropdown-divider {
    border-color: var(--border);
}

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.page-header h5 { font-size: 16px; font-weight: 800; color: var(--text-main); margin: 0; display:flex; align-items:center; }
/* iBMS-BACK-BTN-v1: compact back arrow in page title row */
.page-back-link { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:8px; color:var(--text-muted); text-decoration:none; font-size:15px; flex-shrink:0; margin-right:4px; transition:background .15s,color .15s; }
.page-back-link:hover { background:rgba(139,26,26,.08); color:#8B1A1A; }

/* ── BTN ACCENT (POS) ────────────────────────────────────── */
.btn-accent { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-accent:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
html[data-theme="dark"] .btn-accent { background: var(--primary); border-color: var(--primary); color: #0F172A; }

/* ── BADGE PILLS ─────────────────────────────────────────── */
.badge-pill {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; line-height: 1.4;
}
.badge-active,.badge-completed,.badge-paid,.badge-delivered,.badge-received {
    background: rgba(22,163,74,.10); color: #16A34A;
}
.badge-inactive,.badge-cancelled {
    background: rgba(100,116,139,.10); color: #64748B;
}
.badge-unpaid,.badge-overdue,.badge-failed {
    background: rgba(220,38,38,.10); color: #DC2626;
}
.badge-pending,.badge-partial,.badge-out_for_delivery {
    background: rgba(217,119,6,.10); color: #D97706;
}
.badge-draft,.badge-ordered {
    background: rgba(43,111,163,.10); color: #2B6FA3;
}
html[data-theme="dark"] .badge-active,
html[data-theme="dark"] .badge-completed,
html[data-theme="dark"] .badge-paid,
html[data-theme="dark"] .badge-delivered,
html[data-theme="dark"] .badge-received    { background: rgba(74,222,128,.14); color: #4ADE80; }
html[data-theme="dark"] .badge-inactive,
html[data-theme="dark"] .badge-cancelled    { background: rgba(148,163,184,.14); color: #94A3B8; }
html[data-theme="dark"] .badge-unpaid,
html[data-theme="dark"] .badge-overdue,
html[data-theme="dark"] .badge-failed       { background: rgba(248,113,113,.14); color: #F87171; }
html[data-theme="dark"] .badge-pending,
html[data-theme="dark"] .badge-partial,
html[data-theme="dark"] .badge-out_for_delivery { background: rgba(251,191,36,.14); color: #FBBF24; }
html[data-theme="dark"] .badge-draft,
html[data-theme="dark"] .badge-ordered      { background: rgba(96,165,250,.14); color: #60A5FA; }

/* ── STOCK STATUS ────────────────────────────────────────── */
.stock-low { color: #DC2626; font-weight: 600; }
.stock-ok  { color: #16A34A; }
html[data-theme="dark"] .stock-low { color: #F87171; }
html[data-theme="dark"] .stock-ok  { color: #4ADE80; }

/* ── KPI ADDITIONAL ACCENTS (kpi-red, kpi-slate) ─────────── */
.kpi-red::before  { background: #DC2626; }
.kpi-red .kpi-icon-wrap  { background: rgba(220,38,38,.09); color: #DC2626; }
.kpi-slate::before { background: #475569; }
.kpi-slate .kpi-icon-wrap { background: rgba(71,85,105,.09); color: #475569; }
html[data-theme="dark"] .kpi-red::before  { background: #F87171; }
html[data-theme="dark"] .kpi-red .kpi-icon-wrap  { background: rgba(248,113,113,.14); color: #F87171; }
html[data-theme="dark"] .kpi-slate::before { background: #94A3B8; }
html[data-theme="dark"] .kpi-slate .kpi-icon-wrap { background: rgba(148,163,184,.14); color: #94A3B8; }

/* ── KPI CLICKABLE ANCHOR ────────────────────────────────── */
a.kpi-link { display: block; text-decoration: none; color: inherit; }
a.kpi-link:hover .kpi-card { transform: translateY(-4px); box-shadow: var(--shadow-md); cursor: pointer; }
a.kpi-link:focus-visible .kpi-card { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

/* ── CARD HOVER EFFECTS ──────────────────────────────────── */
.card-clickable { transition: box-shadow .2s ease, transform .18s ease; cursor: pointer; }
.card-clickable:hover { box-shadow: 0 6px 24px rgba(0,0,0,.10); transform: translateY(-2px); }
html[data-theme="dark"] .card-clickable:hover { box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.chart-card-hov { transition: box-shadow .2s ease; }
.chart-card-hov:hover { box-shadow: 0 6px 24px rgba(0,0,0,.10); }
html[data-theme="dark"] .chart-card-hov:hover { box-shadow: 0 6px 24px rgba(0,0,0,.35); }

/* ── OWNER INSIGHT BARS ──────────────────────────────────── */
.insight-bar { border-radius: var(--radius-lg); padding: .65rem 1rem; font-size: 13px; font-weight: 500; border: 1px solid transparent; display: flex; align-items: center; gap: .5rem; }
.insight-ok     { background: rgba(22,163,74,.07);   border-color: rgba(22,163,74,.28);   color: var(--text-main); }
.insight-warn   { background: rgba(245,158,11,.08);  border-color: rgba(245,158,11,.32);  color: var(--text-main); }
.insight-danger { background: rgba(220,38,38,.07);   border-color: rgba(220,38,38,.28);   color: var(--text-main); }
html[data-theme="dark"] .insight-ok     { background: rgba(74,222,128,.07);  border-color: rgba(74,222,128,.25); }
html[data-theme="dark"] .insight-warn   { background: rgba(251,191,36,.07);  border-color: rgba(251,191,36,.25); }
html[data-theme="dark"] .insight-danger { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.25); }
.insight-icon { font-size: 15px; flex-shrink: 0; }
.insight-ok     .insight-icon { color: #16A34A; }
.insight-warn   .insight-icon { color: #D97706; }
.insight-danger .insight-icon { color: #DC2626; }
html[data-theme="dark"] .insight-ok     .insight-icon { color: #4ADE80; }
html[data-theme="dark"] .insight-warn   .insight-icon { color: #FCD34D; }
html[data-theme="dark"] .insight-danger .insight-icon { color: #F87171; }

/* ── FORM CONTROL ─────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    font-size: 13.5px;
    background: var(--card-bg);
    color: var(--text-main);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(153,27,27,.12);
    background: var(--card-bg);
    color: var(--text-main);
}
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .input-group-text {
    background: #111827; border-color: #334155; color: #E2E8F0;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background: #111827; border-color: var(--primary); color: #E2E8F0;
}
html[data-theme="dark"] .form-control::placeholder { color: #94A3B8; }
html[data-theme="dark"] label,
html[data-theme="dark"] .form-label { color: #E2E8F0; }

/* ── ALERTS ──────────────────────────────────────────────── */
html[data-theme="dark"] .alert-success { background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.28); color: #4ADE80; }
html[data-theme="dark"] .alert-danger  { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.28); color: #F87171; }
html[data-theme="dark"] .alert-warning { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.28); color: #FBBF24; }
html[data-theme="dark"] .alert-info    { background: rgba(96,165,250,.12); border-color: rgba(96,165,250,.28); color: #60A5FA; }

/* ── DARK MODE BADGE OVERRIDES ───────────────────────────── */
html[data-theme="dark"] .badge.text-bg-secondary { background-color: #334155 !important; color: #E2E8F0 !important; }
html[data-theme="dark"] .badge.text-bg-success   { background-color: rgba(74,222,128,.18) !important; color: #4ADE80 !important; }
html[data-theme="dark"] .badge.text-bg-warning   { background-color: rgba(251,191,36,.2) !important; color: #FBBF24 !important; }
html[data-theme="dark"] .badge.text-bg-primary   { background-color: rgba(248,113,113,.22) !important; color: #F87171 !important; }
html[data-theme="dark"] .badge.text-bg-danger    { background-color: rgba(248,113,113,.22) !important; color: #F87171 !important; }
html[data-theme="dark"] .badge.text-bg-info      { background-color: rgba(96,165,250,.18) !important; color: #60A5FA !important; }
html[data-theme="dark"] .dropdown-menu  { background: var(--card-bg); border-color: var(--border); }
html[data-theme="dark"] .dropdown-item  { color: var(--text-main); }
html[data-theme="dark"] .dropdown-item:hover { background: var(--app-bg); color: var(--primary); }
html[data-theme="dark"] .dropdown-divider { border-color: var(--border); }

/* ── DARK MODE POLISH ───────────────────────────────────────
   Premium charcoal look — clearer hierarchy, readable text,
   clickable secondary buttons, softer borders.
─────────────────────────────────────────────────────────── */

/* Page / card hierarchy: slightly differentiated backgrounds */
html[data-theme="dark"] body,
html[data-theme="dark"] #main-wrapper { background: #0D1117; }
html[data-theme="dark"] #content      { background: #0D1117; }
html[data-theme="dark"] .card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] #topnav,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .balance-widget { background: #161B22; border-color: #21262D; }

/* Softer, cleaner borders */
html[data-theme="dark"] { --border: #21262D; --card-border: #21262D; }

/* Secondary text — readable, not washed out */
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] small.text-muted,
html[data-theme="dark"] .money-secondary,
html[data-theme="dark"] .kpi-card .kpi-value .money-secondary { color: #8B949E !important; }

/* Primary text stays crisp */
html[data-theme="dark"] .money-current,
html[data-theme="dark"] .kpi-card .kpi-value .money-current,
html[data-theme="dark"] .kpi-card .kpi-number { color: #E6EDF3 !important; }

/* Toggle pills in dark mode */
html[data-theme="dark"] .topbar-currency-toggle .currency-pill,
html[data-theme="dark"] .topbar-language-toggle .language-pill {
    background: #161B22;
    border-color: #30363D;
    color: #CDD9E5;
}
html[data-theme="dark"] .topbar-currency-toggle .currency-pill:hover,
html[data-theme="dark"] .topbar-language-toggle .language-pill:hover {
    background: rgba(248,113,113,.15);
    color: #F87171;
    border-color: rgba(248,113,113,.40);
}

/* Quick Action outline-secondary buttons — look clickable, not disabled */
html[data-theme="dark"] .btn-outline-secondary {
    color: #CDD9E5;
    border-color: #30363D;
    background: transparent;
}
html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-secondary:focus {
    color: #E6EDF3;
    border-color: #8B949E;
    background: rgba(139,148,158,.12);
}

/* Insight / alert bars — readable, not too aggressive */
html[data-theme="dark"] .insight-ok    { background: rgba(63,185,80,.09);  border-color: rgba(63,185,80,.30);  }
html[data-theme="dark"] .insight-warn  { background: rgba(210,153,34,.09); border-color: rgba(210,153,34,.32); }
html[data-theme="dark"] .insight-danger{ background: rgba(248,81,73,.09);  border-color: rgba(248,81,73,.30);  }

/* Card header / table header contrast */
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .chart-card-header { background: #161B22; border-color: #21262D; }
html[data-theme="dark"] .table thead th    { background: #1C2128; border-color: #21262D; color: #CDD9E5; }
html[data-theme="dark"] .table tbody td    { border-color: #21262D; color: #CDD9E5; }
html[data-theme="dark"] .table tbody tr:hover { background: #1C2128 !important; }

/* Chart filter pill */
html[data-theme="dark"] .chart-filter-pill { color: #F87171; background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.25); }

/* Badge secondary in dark mode */
html[data-theme="dark"] .badge.text-bg-secondary { background: #30363D !important; color: #CDD9E5 !important; }

/* ── MISC UTILITIES ─────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.text-primary-green { color: var(--primary) !important; }
.text-navy   { color: var(--text-main); }
.text-accent { color: var(--primary); }
.bg-navy     { background: var(--text-main); }
.no-data { text-align: center; padding: 44px; color: var(--text-muted); }
.no-data i { font-size: 44px; margin-bottom: 10px; display: block; opacity: .2; }

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination .page-link {
    color: var(--primary); border-radius: var(--radius-sm);
    margin: 0 2px; font-size: 13px; border-color: var(--border);
}
.pagination .page-item.active .page-link {
    background: var(--primary); border-color: var(--primary);
}
html[data-theme="dark"] .pagination .page-link { background: var(--card-bg); color: var(--primary); border-color: var(--border); }

/* ── FOOTER ─────────────────────────────────────────────── */
/* iBMS-FOOTER-FINAL-v1 */
.erp-footer {
    background: var(--card-bg); border-top: 1px solid var(--border);
    padding: 11px 24px; display: flex; align-items: center;
    justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.erp-footer .footer-left { font-size: 11px; color: #94A3B8; }
.erp-footer .footer-support-label { font-weight: 700; color: var(--text-muted); }
.erp-footer .footer-soon { font-size: 10px; font-style: italic; }
.erp-footer .footer-right { font-size: 11px; color: var(--text-muted); text-align: right; }
.erp-footer .footer-right strong { font-weight: 700; color: var(--text-muted); }
.erp-footer .footer-version { color: #94A3B8; font-weight: 500; }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-demo-note {
    text-align: center; margin: 14px 0 0;
    font-size: 11px; color: #9CA3AF; font-style: italic;
}
.login-copyright {
    position: fixed; bottom: 14px; left: 0; right: 0;
    text-align: center; font-size: 10.5px; color: rgba(255,255,255,.28);
    letter-spacing: .3px; z-index: 10; pointer-events: none;
}

/* ── PRINT ───────────────────────────────────────────────── */
@media print {
    #sidebar, #topnav, .no-print, .erp-footer { display: none !important; }
    #main-wrapper { margin-left: 0 !important; }
    body { background: #fff !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    #content { padding: 0 !important; }
}

/* ── <=1200px ─────────────────────────────────────────────── */
@media (max-width: 1200px) {
    :root { --sidebar-width: 250px; }
}

/* ── <=992px Tablet ──────────────────────────────────────── */
@media (max-width: 992px) {
    :root { --sidebar-width: 265px; }
    #sidebar { transform: translateX(-100%); box-shadow: none; }
    #sidebar.show { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.18); }
    #main-wrapper { margin-left: 0; }
    #sidebar-overlay {
        display: none;
        position: fixed; top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0,0,0,.45);
        z-index: 999;
        backdrop-filter: blur(2px);
    }
    #sidebar-overlay.show { display: block; }
    #topnav { padding: 0 16px; }
    .topbar-notification-menu { width: 290px; }
    .quick-nav-pills { display: none !important; }
}

/* ── <=768px ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    #content { padding: 16px; }
    .kpi-card .kpi-value .money-current,
    .kpi-card .kpi-value .money-khr  { font-size: 22px; }
    .kpi-card .kpi-value .money-secondary,
    .kpi-card .kpi-value .money-usd  { font-size: 12px; }
    .kpi-card .kpi-number { font-size: 22px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .chart-container { height: 200px; }
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    #topnav .page-title { font-size: 13px; }
    .erp-footer { flex-direction: column; text-align: center; padding: 8px 16px; gap: 4px; }
    .erp-footer .footer-right { text-align: center; }
}

/* ── <=576px Mobile ──────────────────────────────────────── */
@media (max-width: 576px) {
    #content { padding: 12px; }
    .kpi-card { padding: 14px; }
    .kpi-card .kpi-value .money-current,
    .kpi-card .kpi-value .money-khr  { font-size: 20px; }
    .kpi-card .kpi-value .money-secondary,
    .kpi-card .kpi-value .money-usd  { font-size: 11.5px; }
    .kpi-card .kpi-number { font-size: 20px; }
    .card-header { padding: 10px 14px; font-size: 13px; }
    .card-body   { padding: 12px 14px; }
    #topnav { padding: 0 10px; height: 56px; }
    #topnav .toggle-sidebar-btn { font-size: 18px; padding: 5px 6px; }
    #topnav .page-title { font-size: 12.5px; }
    .topbar-icon-btn { width: 30px; height: 30px; }
    .topbar-icon-btn i { font-size: 13px; }
    .topbar-notification-menu { width: calc(100vw - 24px); left: auto !important; right: 0 !important; }
    .chart-container { height: 180px; }
    .chart-container-sm { height: 160px; }
    .sidebar-brand-name { font-size: 12px; }
    .sidebar-client-icon { width: 36px; height: 36px; }
    .sidebar-monogram { font-size: 14px; }
    .biz-pulse { padding: 10px 12px; gap: 6px; }
    .biz-pulse-divider { display: none; }
    .biz-pulse-stats { gap: 5px 12px; }
    .biz-pulse-stat { min-width: 72px; }
    .biz-pulse-stat-value { font-size: 12px; }
    /* Compact single-value currency/language pill on mobile */
    .topbar-currency-toggle .currency-pill,
    .topbar-language-toggle .language-pill { padding: 5px 8px; font-size: 10px; }
}

/* ── SIDEBAR COLLAPSE (desktop icon-only) ─────────────────── */
:root { --sidebar-collapsed-width: 62px; }

@media (min-width: 993px) {
    #sidebar.sidebar-collapsed { width: var(--sidebar-collapsed-width); }
    #main-wrapper.sidebar-collapsed { margin-left: var(--sidebar-collapsed-width); }
    #sidebar.sidebar-collapsed .sidebar-brand-text,
    #sidebar.sidebar-collapsed .sidebar-brand-sub,
    #sidebar.sidebar-collapsed .sidebar-user-info,
    #sidebar.sidebar-collapsed .sidebar-user-name,
    #sidebar.sidebar-collapsed .sidebar-user-role,
    #sidebar.sidebar-collapsed .nav-section-title,
    #sidebar.sidebar-collapsed .toggle-icon,
    #sidebar.sidebar-collapsed .nav-submenu,
    #sidebar.sidebar-collapsed .ibms-powered,
    #sidebar.sidebar-collapsed .ibms-name,
    #sidebar.sidebar-collapsed .ibms-tagline,
    #sidebar.sidebar-collapsed .ibms-version,
    #sidebar.sidebar-collapsed .ipc-powered,
    #sidebar.sidebar-collapsed .ipc-tagline,
    #sidebar.sidebar-collapsed .ibms-support-title,
    #sidebar.sidebar-collapsed .ibms-support-link,
    #sidebar.sidebar-collapsed .ibms-soon-badge { display: none !important; }
    #sidebar.sidebar-collapsed .sidebar-brand-identity { justify-content: center; }
    #sidebar.sidebar-collapsed .sidebar-user-mini { justify-content: center; padding: 6px; gap: 0; }
    #sidebar.sidebar-collapsed .nav-link {
        padding: 10px 0; justify-content: center; font-size: 0 !important; gap: 0;
    }
    #sidebar.sidebar-collapsed .nav-link > i { font-size: 17px !important; width: 22px; text-align: center; }
    #sidebar.sidebar-collapsed .nav-link > span { display: none !important; }
    #sidebar.sidebar-collapsed .ibms-footer,
    #sidebar.sidebar-collapsed .ibms-power-card { padding: 8px 4px; }
    #sidebar.sidebar-collapsed .ibms-logo-mark { margin-bottom: 0; }
    #sidebar.sidebar-collapsed .sidebar-footer { padding: 6px; }
}

/* ── HEADER QUICK NAV ───────────────────────────────────── */
.quick-nav-pills {
    border-left: 1px solid var(--border);
    padding-left: 10px;
    display: flex; align-items: center; gap: 2px; flex-wrap: nowrap;
}
.quick-nav-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    color: var(--text-muted); text-decoration: none;
    background: transparent; border: 1px solid transparent;
    transition: background .16s, color .16s, border-color .16s;
    white-space: nowrap; line-height: 1;
}
.quick-nav-pill:hover { background: var(--app-bg); color: var(--text-main); border-color: var(--border); }
.quick-nav-pill.active { background: var(--primary-soft); color: var(--primary); border-color: rgba(153,27,27,.22); }
.quick-nav-pill i { font-size: 12px; }
.quick-nav-pos {
    background: var(--primary-soft) !important; color: var(--primary) !important;
    border-color: rgba(153,27,27,.2) !important; font-weight: 700 !important;
}
.quick-nav-pos:hover { background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important; }
html[data-theme="dark"] .quick-nav-pos { background: rgba(248,113,113,.12) !important; color: #F87171 !important; border-color: rgba(248,113,113,.25) !important; }
html[data-theme="dark"] .quick-nav-pos:hover { background: #F87171 !important; color: #0F172A !important; }

/* ── TODAY'S BUSINESS PULSE ─────────────────────────────── */

/* ── TODAY'S BUSINESS PULSE ─────────────────────────────── */
.biz-pulse {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 12px 20px;
    box-shadow: var(--shadow-sm);
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 10px 16px; position: relative; overflow: hidden;
}
.biz-pulse::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, #991B1B 0%, #C2410C 50%, #991B1B 100%);
}
html[data-theme="dark"] .biz-pulse::before {
    background: linear-gradient(90deg, #F87171 0%, #FB923C 50%, #F87171 100%);
}
.biz-pulse-header { display: flex; flex-direction: column; gap: 2px; min-width: 120px; flex-shrink: 0; }
.biz-pulse-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .9px; color: var(--primary); display: block; }
.biz-pulse-date  { font-size: 12.5px; font-weight: 600; color: var(--text-main); display: block; line-height: 1.3; }
.biz-pulse-status {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 600; border-radius: 999px;
    padding: 3px 10px; margin-top: 3px; text-decoration: none;
}
.biz-pulse-status.ok     { background: rgba(22,163,74,.10); color: #16A34A; }
.biz-pulse-status.warn   { background: rgba(245,158,11,.12); color: #D97706; }
.biz-pulse-status.danger { background: rgba(220,38,38,.10); color: #DC2626; }
html[data-theme="dark"] .biz-pulse-status.ok     { background: rgba(74,222,128,.12); color: #4ADE80; }
html[data-theme="dark"] .biz-pulse-status.warn   { background: rgba(251,191,36,.12); color: #FCD34D; }
html[data-theme="dark"] .biz-pulse-status.danger { background: rgba(248,113,113,.12); color: #F87171; }
.biz-pulse-divider { width: 1px; height: 44px; background: var(--border); flex-shrink: 0; align-self: center; }
.biz-pulse-stats { display: flex; flex: 1; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.biz-pulse-stat { display: flex; flex-direction: column; gap: 1px; }
.biz-pulse-stat-label { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.biz-pulse-stat-value { font-size: 13.5px; font-weight: 700; color: var(--text-main); line-height: 1.2; }
.biz-pulse-profit-pos { color: #16A34A; }
.biz-pulse-profit-neg { color: #DC2626; }
html[data-theme="dark"] .biz-pulse-profit-pos { color: #4ADE80; }
html[data-theme="dark"] .biz-pulse-profit-neg { color: #F87171; }
.biz-pulse-stat-value .money-secondary { font-size: 10.5px; color: var(--text-muted); font-weight: 500; display: block; line-height: 1.2; }

/* ════════════════════════════════════════════════════════════
   LOGIN / AUTH PAGE — Complete Styles
   (Classes used in resources/views/auth/login.blade.php)
   ════════════════════════════════════════════════════════════ */

/* Full-screen wrapper */
.login-page {
    min-height: 100vh; width: 100%;
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    background: #0D1117;
    padding: 20px; box-sizing: border-box;
}

/* ── Background panels ───────────────────────────────────── */
.login-bg-panels { position: absolute; inset: 0; display: flex; }
.login-bg-panel  { flex: 1; opacity: .22; background-size: cover; background-position: center; }
.login-bg-panel-left  { background: linear-gradient(135deg, #1a3a5c 0%, #0D2137 100%); }
.login-bg-panel-right { background: linear-gradient(135deg, #7B1818 0%, #4A0E0E 100%); }
.login-bg-vignette {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, transparent 15%, rgba(13,17,23,.80) 100%);
}

/* ── Atmospheric blobs ───────────────────────────────────── */
.login-blob { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; }
.login-blob-1 { width: 380px; height: 380px; background: #991B1B; opacity: .16; top: -100px; left: -100px; }
.login-blob-2 { width: 300px; height: 300px; background: #B45309; opacity: .14; bottom: -70px; right: -70px; }
.login-blob-3 { width: 200px; height: 200px; background: #1D4ED8; opacity: .08; top: 30%; right: 8%; }
.login-blob-4 { width: 160px; height: 160px; background: #991B1B; opacity: .10; bottom: 20%; left: 6%; }

/* ── Decorative corner rings ─────────────────────────────── */
.login-corner-emblem { position: absolute; pointer-events: none; }
.login-corner-tl { top: -40px; left: -40px; }
.login-corner-br { bottom: -40px; right: -40px; transform: rotate(180deg); }
.lce-ring {
    position: absolute; border-radius: 50%;
    border: 1px solid rgba(153,27,27,.18);
    top: 50%; left: 50%; transform: translate(-50%,-50%);
}
.lce-ring-1 { width: 120px; height: 120px; }
.lce-ring-2 { width: 200px; height: 200px; opacity: .6; }
.lce-ring-3 { width: 300px; height: 300px; opacity: .3; }

/* ── Diagonal accent line ────────────────────────────────── */
.login-accent-line {
    position: absolute; width: 160%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(153,27,27,.30), rgba(180,83,9,.30), transparent);
    top: 55%; left: -30%; transform: rotate(-12deg); pointer-events: none;
}

/* ── Card ────────────────────────────────────────────────── */
.login-card {
    position: relative; z-index: 10;
    width: 100%; max-width: 420px;
    background: rgba(255,255,255,.98);
    border-radius: 20px;
    box-shadow: 0 28px 64px rgba(0,0,0,.42), 0 0 0 1px rgba(255,255,255,.10);
    overflow: hidden;
    animation: loginCardIn .50s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(26px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
html[data-theme="dark"] .login-card {
    background: rgba(22,27,34,.98);
    box-shadow: 0 28px 64px rgba(0,0,0,.60), 0 0 0 1px rgba(255,255,255,.06);
}

/* Top stripe */
.login-card-stripe {
    height: 4px;
    background: linear-gradient(90deg, #7B1818, #991B1B 35%, #B45309 65%, #991B1B);
}

/* Inner padding */
.login-card-inner { padding: 28px 32px 22px; }

/* ── Brand / Logo ────────────────────────────────────────── */
.login-logo { text-align: center; margin-bottom: 22px; }

.brand-seal-wrap {
    position: relative; display: inline-flex;
    align-items: center; justify-content: center;
    width: 72px; height: 72px; margin-bottom: 12px;
}
.brand-seal-ring {
    position: absolute; inset: 0; border-radius: 50%;
    border: 2px dashed rgba(153,27,27,.38);
    animation: spinSlow 14s linear infinite;
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
html[data-theme="dark"] .brand-seal-ring { border-color: rgba(248,113,113,.30); }

.brand-icon-lg {
    width: 56px; height: 56px; border-radius: 14px;
    background: linear-gradient(135deg, #991B1B 0%, #B45309 100%);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(153,27,27,.45);
}
.brand-monogram { font-size: 20px; font-weight: 900; color: #fff; letter-spacing: .5px; font-style: italic; }

.brand-cold-badge {
    position: absolute; bottom: 2px; right: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #1D4ED8;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.30);
    border: 1.5px solid #fff;
}
html[data-theme="dark"] .brand-cold-badge { border-color: rgba(22,27,34,.9); }

.login-brand-name { font-size: 17px; font-weight: 800; letter-spacing: .8px; margin-bottom: 3px; }
.brand-dl    { color: #991B1B; }
.brand-meat  { color: #111827; }
.brand-supply{ color: #6B7280; font-size: 15px; font-weight: 600; }
html[data-theme="dark"] .brand-meat   { color: #E6EDF3; }
html[data-theme="dark"] .brand-supply { color: #8B949E; }

.login-subtitle {
    font-size: 11px; font-weight: 600; color: #374151;
    text-transform: uppercase; letter-spacing: .8px; margin: 2px 0;
}
html[data-theme="dark"] .login-subtitle { color: #CDD9E5; }

.login-slogan { font-size: 11px; color: #9CA3AF; margin: 0 0 10px; }
html[data-theme="dark"] .login-slogan { color: #8B949E; }

.login-divider {
    width: 40px; height: 2px;
    background: linear-gradient(90deg, #991B1B, #B45309);
    border-radius: 2px; margin: 0 auto;
}

/* ── Error alert ─────────────────────────────────────────── */
.login-alert-error {
    display: flex; align-items: flex-start; gap: 8px;
    background: rgba(220,38,38,.07); border: 1px solid rgba(220,38,38,.28);
    border-radius: 10px; padding: 10px 12px;
    font-size: 13px; color: #DC2626; margin-bottom: 16px;
}
html[data-theme="dark"] .login-alert-error {
    background: rgba(248,113,113,.10); border-color: rgba(248,113,113,.28); color: #F87171;
}

/* ── Labels ──────────────────────────────────────────────── */
.login-label {
    display: block; font-size: 12px; font-weight: 600; color: #374151;
    margin-bottom: 6px; letter-spacing: .2px;
}
html[data-theme="dark"] .login-label { color: #CDD9E5; }

/* ── Input group ─────────────────────────────────────────── */
.login-input-group {
    border-radius: 10px !important; overflow: hidden;
    border: 1.5px solid #E5E7EB !important;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.login-input-group:focus-within {
    border-color: #991B1B !important;
    box-shadow: 0 0 0 3px rgba(153,27,27,.12) !important;
}
html[data-theme="dark"] .login-input-group { border-color: #30363D !important; }
html[data-theme="dark"] .login-input-group:focus-within {
    border-color: #F87171 !important;
    box-shadow: 0 0 0 3px rgba(248,113,113,.12) !important;
}

.login-input-icon {
    background: #F9FAFB !important; border: 0 !important;
    color: #9CA3AF !important; padding: 0 12px !important; font-size: 14px;
}
html[data-theme="dark"] .login-input-icon { background: #161B22 !important; color: #8B949E !important; }
.login-input-group:focus-within .login-input-icon { color: #991B1B !important; }
html[data-theme="dark"] .login-input-group:focus-within .login-input-icon { color: #F87171 !important; }

.login-input {
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    font-size: 14px; padding: 10px 12px !important;
    background: #fff !important; color: #111827 !important;
}
.login-input:focus { box-shadow: none !important; outline: 0; }
html[data-theme="dark"] .login-input { background: #0D1117 !important; color: #E6EDF3 !important; }
html[data-theme="dark"] .login-input::placeholder { color: #4B5563; }

.login-pwd-toggle {
    cursor: pointer !important; background: #F9FAFB !important; border: 0 !important;
    transition: color .15s ease;
}
.login-pwd-toggle:hover { color: #991B1B !important; }
html[data-theme="dark"] .login-pwd-toggle { background: #161B22 !important; color: #8B949E !important; }
html[data-theme="dark"] .login-pwd-toggle:hover { color: #F87171 !important; }

/* ── Remember me ─────────────────────────────────────────── */
.login-check { border-color: #D1D5DB !important; border-radius: 4px !important; cursor: pointer; }
.login-check:checked { background-color: #991B1B !important; border-color: #991B1B !important; }
.login-remember { font-size: 13px; color: #6B7280; cursor: pointer; }
html[data-theme="dark"] .login-remember { color: #8B949E; }

/* ── Sign In button ──────────────────────────────────────── */
.btn-login {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 11px 20px;
    background: linear-gradient(135deg, #991B1B 0%, #B45309 100%);
    color: #fff; font-size: 14px; font-weight: 700;
    letter-spacing: .4px; border: 0; border-radius: 10px; cursor: pointer;
    box-shadow: 0 4px 14px rgba(153,27,27,.40);
    transition: opacity .18s ease, transform .16s ease, box-shadow .18s ease;
}
.btn-login:hover { opacity: .90; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(153,27,27,.50); }
.btn-login:active { transform: translateY(0); opacity: 1; }

/* ── Demo note ───────────────────────────────────────────── */
.login-demo-note {
    text-align: center; font-size: 11px; color: #9CA3AF;
    margin: 12px 0 0; font-family: 'Courier New', monospace;
}
html[data-theme="dark"] .login-demo-note { color: #4B5563; }

/* ── Card footer ─────────────────────────────────────────── */
.login-footer {
    border-top: 1px solid #F3F4F6;
    padding: 11px 32px; font-size: 11px; color: #9CA3AF; text-align: center;
    background: #FAFAFA;
}
html[data-theme="dark"] .login-footer { border-top-color: #21262D; background: #0D1117; color: #4B5563; }
.login-footer strong { color: #991B1B; }
html[data-theme="dark"] .login-footer strong { color: #F87171; }
.login-footer-icon { color: #991B1B; font-size: 12px; }
html[data-theme="dark"] .login-footer-icon { color: #F87171; }

/* ── Copyright ───────────────────────────────────────────── */
.login-copyright {
    position: fixed; bottom: 14px; left: 0; right: 0;
    text-align: center; font-size: 11px; color: rgba(255,255,255,.30);
    margin: 0; z-index: 5; pointer-events: none;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .login-page { padding: 16px; }
    .login-card { border-radius: 16px; }
    .login-card-inner { padding: 22px 20px 18px; }
    .login-footer { padding: 10px 20px; }
    .login-copyright { display: none; }
}

/* ══════════════════════════════════════════════════════════
   TOPBAR REFRESH ANIMATION + DARK MODE READABILITY FIXES
   ══════════════════════════════════════════════════════════ */

/* ── Refresh icon spin animation ─────────────────────────── */
@keyframes ibms-rspin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
.ibms-refresh-spin{display:inline-block!important;animation:ibms-rspin .45s linear infinite}
/* single spin on post-reload = green 'fresh data' signal */
.ibms-refresh-done{display:inline-block!important;color:var(--success);animation:ibms-rspin .55s ease-out 1}

/* ── Topbar icon buttons — defined, not flat, in dark mode ── */
html[data-theme="dark"] .topbar-icon-btn {
    background: #1C2128;
    border-color: #30363D;
    color: #E6EDF3;
}
html[data-theme="dark"] .topbar-icon-btn:hover {
    background: rgba(248,113,113,.14);
    color: #F87171;
    border-color: rgba(248,113,113,.35);
}

/* ── Sidebar iBMS footer brand text — contrast fix ──────────
   Was: #4B5563 on #111827 background = ~2:1 (near-invisible)
   Now: #6B7280 on #111827 background = ~3.7:1 (readable)     */
html[data-theme="dark"] .ibms-powered,
html[data-theme="dark"] .ibms-tagline { color: #6B7280; }


/* ══════════════════════════════════════════════════════════
   GLOBAL MOBILE BREADCRUMB HIDE
   ══════════════════════════════════════════════════════════
   Breadcrumb navs waste vertical space on mobile (<768px).
   Desktop/tablet (≥768px): breadcrumbs show normally.
   Products page uses d-none d-md-flex as belt-and-suspenders.
   This rule auto-covers all current + future module pages.
   ══════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
    nav[aria-label="breadcrumb"] { display: none !important; }
}


/* ══════════════════════════════════════════════════════════
   iBMS-BRAND-OVERRIDE-v1
   Bootstrap blue -> iBMS dark red (global, no per-page edits)
   Loaded after Bootstrap so these rules win the cascade.
   ══════════════════════════════════════════════════════════ */

/* ── Bootstrap primary CSS variable re-map ── */
:root {
    --bs-primary:               #991B1B;
    --bs-primary-rgb:           153, 27, 27;
    --bs-link-color:            #991B1B;
    --bs-link-color-rgb:        153, 27, 27;
    --bs-link-hover-color:      #7F1D1D;
    --bs-link-hover-color-rgb:  127, 29, 29;
    --bs-focus-ring-color:      rgba(153, 27, 27, .25);
}
html[data-theme="dark"] {
    --bs-primary:               #F87171;
    --bs-primary-rgb:           248, 113, 113;
    --bs-link-color:            #FCA5A5;
    --bs-link-color-rgb:        252, 165, 165;
    --bs-link-hover-color:      #F87171;
    --bs-focus-ring-color:      rgba(248, 113, 113, .22);
}

/* ── .btn-primary → iBMS dark red ── */
.btn-primary {
    --bs-btn-color:                #fff;
    --bs-btn-bg:                   #991B1B;
    --bs-btn-border-color:         #991B1B;
    --bs-btn-hover-color:          #fff;
    --bs-btn-hover-bg:             #7F1D1D;
    --bs-btn-hover-border-color:   #7F1D1D;
    --bs-btn-focus-shadow-rgb:     153, 27, 27;
    --bs-btn-active-color:         #fff;
    --bs-btn-active-bg:            #6B1A1A;
    --bs-btn-active-border-color:  #6B1A1A;
    --bs-btn-active-shadow:        inset 0 3px 5px rgba(0,0,0,.125);
    --bs-btn-disabled-color:       #fff;
    --bs-btn-disabled-bg:          #991B1B;
    --bs-btn-disabled-border-color:#991B1B;
}

/* ── .btn-outline-primary → iBMS dark red outline ── */
.btn-outline-primary {
    --bs-btn-color:                #991B1B;
    --bs-btn-border-color:         #991B1B;
    --bs-btn-hover-color:          #fff;
    --bs-btn-hover-bg:             #991B1B;
    --bs-btn-hover-border-color:   #991B1B;
    --bs-btn-focus-shadow-rgb:     153, 27, 27;
    --bs-btn-active-color:         #fff;
    --bs-btn-active-bg:            #991B1B;
    --bs-btn-active-border-color:  #991B1B;
    --bs-btn-disabled-color:       #991B1B;
    --bs-btn-disabled-border-color:#991B1B;
}

/* ── dark mode btn-primary: slightly lighter base ── */
html[data-theme="dark"] .btn-primary {
    --bs-btn-bg:                   #B91C1C;
    --bs-btn-border-color:         #B91C1C;
    --bs-btn-hover-bg:             #991B1B;
    --bs-btn-hover-border-color:   #991B1B;
    --bs-btn-focus-shadow-rgb:     248, 113, 113;
    --bs-btn-active-bg:            #7F1D1D;
}
html[data-theme="dark"] .btn-outline-primary {
    --bs-btn-color:                #FCA5A5;
    --bs-btn-border-color:         rgba(248,113,113,.6);
    --bs-btn-hover-color:          #fff;
    --bs-btn-hover-bg:             #991B1B;
    --bs-btn-hover-border-color:   #991B1B;
    --bs-btn-focus-shadow-rgb:     248, 113, 113;
    --bs-btn-active-color:         #fff;
    --bs-btn-active-bg:            #991B1B;
}

/* ── Bootstrap utility classes ── */
.text-primary   { color:            #991B1B !important; }
.text-bg-primary { background-color: #991B1B !important; color: #fff !important; } /* iBMS-BRAND-v2 */
.bg-primary     { background-color: #991B1B !important; }
.border-primary { border-color:     #991B1B !important; }
html[data-theme="dark"] .text-primary { color: #FCA5A5 !important; }

/* ── nav-tabs active tab → brand red ── */
.nav-tabs .nav-link {
    color: var(--text-muted, #64748B);
    transition: color .18s ease, border-color .18s ease;
}
.nav-tabs .nav-link:hover:not(.active):not(:disabled) {
    color: #991B1B;
    border-color: transparent transparent rgba(153,27,27,.35);
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: #991B1B;
    border-bottom-color: #991B1B;
    font-weight: 600;
}
html[data-theme="dark"] .nav-tabs .nav-link.active,
html[data-theme="dark"] .nav-tabs .nav-item.show .nav-link {
    color: #FCA5A5;
    border-bottom-color: #F87171;
}

/* ── nav-pills active → brand red ── */
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: #991B1B;
    color: #fff;
}
html[data-theme="dark"] .nav-pills .nav-link.active,
html[data-theme="dark"] .nav-pills .show > .nav-link {
    background-color: #B91C1C;
}

/* ── form-check-input focus → brand red ── */
.form-check-input:focus {
    border-color: rgba(153,27,27,.5);
    box-shadow:  0 0 0 .25rem rgba(153,27,27,.18);
    outline: 0;
}
html[data-theme="dark"] .form-check-input:focus {
    border-color: rgba(248,113,113,.45);
    box-shadow:  0 0 0 .25rem rgba(248,113,113,.15);
}

/* ── focus-visible: brand ring only on primary-coloured elements ── */
/* btn-secondary, btn-danger, btn-warning etc. keep their own Bootstrap focus ring */
.btn-primary:focus-visible,
.btn-outline-primary:focus-visible,
a:not(.btn):not(.nav-link):not(.dropdown-item):focus-visible {
    outline-color: rgba(153,27,27,.55) !important;
}
html[data-theme="dark"] .btn-primary:focus-visible,
html[data-theme="dark"] .btn-outline-primary:focus-visible,
html[data-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item):focus-visible {
    outline-color: rgba(248,113,113,.55) !important;
}

/* ── Sidebar-scoped focus-visible already handled in app.blade.php ── */

/* iBMS-STICKY-THEAD-v3 (2026-06-17): sticky header ONLY inside .ibms-sticky-wrap.
   Root cause of old bug: table-responsive (overflow-x:auto) creates a scroll
   container; position:sticky children resolve top against THAT container, not the
   viewport, so top:var(--topnav-height) hid the first 64px of rows behind the header.
   Fix: .ibms-sticky-wrap is the intentional container; thead th sticks at top:0.
   JS in layouts/app.blade.php sets max-height on every .ibms-sticky-wrap at load+resize.
   Tables without .ibms-sticky-wrap get static headers — no overlap bugs. */

/* Mobile: update --topnav-height CSS var */
@media (max-width: 767.98px) {
    :root { --topnav-height: 56px; }
}

/* Wrapper: intentional scroll container; JS sets max-height */
.ibms-sticky-wrap {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sticky header at top:0 of the container */
@media (min-width: 576px) {
    .ibms-sticky-wrap .ibms-sticky-thead thead th {
        position: sticky;
        top: 0;
        z-index: 20;
        background: var(--card-bg);
        box-shadow: 0 1px 0 var(--border);
    }
}
/* Mobile: no sticky — card layout is used */
@media (max-width: 575.98px) {
    .ibms-sticky-wrap .ibms-sticky-thead thead th { position: static; }
}
/* Safety: .ibms-sticky-thead WITHOUT .ibms-sticky-wrap → static (no overlap) */
.ibms-sticky-thead thead th { position: static; }

