/* =========================================================
   STOCK SYSTEM — MODERN SIDEBAR & HEADER
   Design: Premium dark sidebar + glassmorphism header
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {

    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;

    --header-height: 68px;
    --header-bar-height: 68px;

    /* Safe Area Insets for Notch / Dynamic Island / Home Indicator */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);

    /* Sidebar palette */
    --sb-bg:            #0d1117;
    --sb-bg-card:       rgba(255, 255, 255, 0.035);
    --sb-border:        rgba(255, 255, 255, 0.06);
    --sb-text:          #8b949e;
    --sb-text-bright:   #e6edf3;
    --sb-hover:         rgba(255, 255, 255, 0.06);
    --sb-active:        rgba(99, 102, 241, 0.18);
    --sb-active-border: #6366f1;

    /* Accent */
    --accent:           #6366f1;
    --accent-2:         #8b5cf6;
    --accent-light:     #a5b4fc;
    --accent-glow:      rgba(99, 102, 241, 0.35);

    /* Header */
    --hdr-bg:           rgba(10, 15, 26, 0.45);
    --hdr-border:       rgba(255, 255, 255, 0.08);

    /* Body */
    --body-bg:          #080c14;
    --text-primary:     #f8fafc;
    --text-muted:       #94a3b8;

    /* Misc */
    --radius-sm:        8px;
    --radius-md:        11px;
    --radius-lg:        14px;
    --transition:       0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sidebar:   4px 0 24px rgba(0, 0, 0, 0.25);
    --shadow-header:    0 1px 20px rgba(15, 23, 42, 0.06);
}


/* =========================================================
   GLOBAL
   ========================================================= */

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

html {
    width: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background: var(--body-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.12), transparent 50%),
        radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.08), transparent 50%);
    z-index: -1;
    pointer-events: none;
}

body.sidebar-mobile-locked {
    overflow: hidden !important;
    touch-action: none !important;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(10, 15, 26, 0.45);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition:
        width var(--transition),
        transform var(--transition);
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        4px 0 24px rgba(0, 0, 0, 0.25),
        inset -1px 0 0 rgba(255, 255, 255, 0.04);
}


/* =========================================================
   SIDEBAR HEADER
   ========================================================= */

.sidebar-header {
    height: var(--header-height);
    min-height: var(--header-height);
    padding: 0 16px 0 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    flex: 1;
    transition: opacity var(--transition);
}

.sidebar-brand:hover {
    opacity: 0.85;
}

.brand-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: #fff;
    font-size: 18px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.brand-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 60%);
    border-radius: inherit;
    pointer-events: none;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}

.brand-title {
    color: var(--sb-text-bright);
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    letter-spacing: -0.01em;
}

.brand-subtitle {
    color: #4b5563;
    font-size: 10.5px;
    line-height: 15px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-close {
    display: none;
    border: 0;
    background: transparent;
    color: var(--sb-text);
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition:
        background var(--transition),
        color var(--transition);
}

.sidebar-close:hover {
    background: var(--sb-hover);
    color: var(--sb-text-bright);
}


/* =========================================================
   NAVIGATION
   ========================================================= */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    padding: 0 10px 6px;
    color: #374151;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}


/* =========================================================
   NAV ITEM
   ========================================================= */

.nav-item {
    position: relative;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    margin-bottom: 2px;
    border: 0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 11px;
    background: transparent;
    color: var(--sb-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition:
        background var(--transition),
        color var(--transition);
    outline: none;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    border-radius: 0 3px 3px 0;
    background: var(--sb-active-border);
    /* No transition here — avoids shake on page load */
}

.nav-item:hover {
    background: var(--sb-hover);
    color: var(--sb-text-bright);
}

.nav-item.active {
    background: var(--sb-active);
    color: var(--sb-text-bright);
}

.nav-item.active::before {
    transform: translateY(-50%) scaleY(1);
}

.nav-item.active .nav-icon {
    color: var(--accent-light);
}

.nav-item.group-active {
    color: var(--sb-text-bright);
}

.nav-icon {
    width: 20px;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: color var(--transition);
}

.nav-label {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #64748b;
    margin-left: auto;
    transition:
        transform var(--transition),
        color var(--transition);
    pointer-events: none;
}

.nav-item:hover .nav-arrow {
    color: var(--sb-text-bright);
}

.nav-group-toggle[aria-expanded="true"] .nav-arrow,
.nav-group-toggle.open .nav-arrow {
    transform: rotate(180deg);
}

.nav-group-toggle .nav-label,
.nav-group-toggle .nav-icon {
    pointer-events: none;
}


/* =========================================================
   SUBMENU
   ========================================================= */

.nav-submenu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height 0.2s cubic-bezier(0, 0, 0.2, 1), opacity 0.16s ease, visibility 0.2s;
    margin-left: 18px;
    padding: 0 0 0 12px;
    border-left: 1.5px solid rgba(255, 255, 255, 0.08);
    will-change: max-height, opacity;
}

.nav-submenu.open {
    max-height: 320px;
    opacity: 1;
    visibility: visible;
    padding: 4px 0 6px 12px;
}

.nav-submenu::before {
    content: "";
}

.nav-submenu-header {
    display: none;
}

.nav-subitem {
    min-width: 0;
    min-height: 38px;
    padding: 0 10px 0 14px;
    margin: 1px 0;
    display: flex;
    align-items: center;
    gap: 9px;
    color: #6b7280;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition:
        background var(--transition),
        color var(--transition);
}

.nav-subitem:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--sb-text-bright);
}

.nav-subitem.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--sb-text-bright);
}

.nav-subitem.active .subitem-icon {
    color: var(--accent-light);
}

.subitem-icon {
    width: 16px;
    min-width: 16px;
    display: flex;
    justify-content: center;
    font-size: 14px;
}


/* =========================================================
   SIDEBAR FOOTER — Profile Card
   ========================================================= */

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--sb-border);
    flex-shrink: 0;
}

/* Profile row */
.sb-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px 10px;
}

.sb-profile-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(99,102,241,0.35), rgba(139,92,246,0.35));
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sb-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.sb-profile-avatar span {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: -0.3px;
}

.sb-profile-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.sb-profile-name {
    color: var(--sb-text-bright);
    font-size: 12px;
    font-weight: 600;
    line-height: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-profile-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

/* Action buttons row */
.sb-footer-actions {
    display: flex;
    gap: 6px;
}

.sb-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    transition:
        background var(--transition),
        color var(--transition),
        border-color var(--transition),
        box-shadow var(--transition),
        transform 0.12s ease;
}

.sb-action-btn i {
    font-size: 13px;
    transition: transform var(--transition);
}

.sb-action-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--sb-text-bright);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sb-action-btn:active,
.sb-action-btn.touch-active {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.16);
}

.sb-action-btn.sb-logout {
    color: #f87171;
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.18);
}

.sb-action-btn.sb-logout:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.38);
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.22);
}

.sb-action-btn.sb-logout:hover i {
    transform: translateX(2px);
}

.sb-action-btn.sb-logout:active,
.sb-action-btn.sb-logout.touch-active {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.55);
    color: #fecaca;
    transform: scale(0.96);
}

.sb-action-btn.sb-install {
    color: var(--accent-light);
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.08);
}

.sb-action-btn.sb-install:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.35);
    color: #fff;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.sb-action-btn.sb-install:active,
.sb-action-btn.sb-install.touch-active {
    background: rgba(99, 102, 241, 0.28);
    border-color: rgba(99, 102, 241, 0.5);
    transform: scale(0.96);
}

/* Hide install btn if PWA already installed */
.sb-action-btn.sb-install.pwa-hidden {
    display: none;
}

/* Switched Session Return Button in Sidebar Footer */
.sb-switch-return-wrap {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.sb-switch-info {
    font-size: 10.5px;
    color: #fbbf24;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-switch-info strong {
    color: #ffffff;
}

.sb-return-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 32px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1c1300 !important;
    font-size: 11.5px;
    font-weight: 800;
    border-radius: 8px;
    text-decoration: none !important;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
    transition: all 0.2s ease;
}

.sb-return-btn:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000 !important;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(245, 158, 11, 0.5);
}

.sb-return-btn:active {
    transform: scale(0.97);
}

/* Collapsed mode — show only avatar */
body.sidebar-collapsed .sb-profile-info,
body.sidebar-collapsed .sb-footer-actions,
body.sidebar-collapsed .sb-switch-info {
    display: none;
}

body.sidebar-collapsed .sb-switch-return-wrap {
    padding: 6px 4px;
    display: flex;
    justify-content: center;
}

body.sidebar-collapsed .sb-return-btn span {
    display: none;
}

body.sidebar-collapsed .sb-return-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 auto;
    padding: 0;
}

body.sidebar-collapsed .sb-profile {
    justify-content: center;
    padding: 6px 0;
}

/* Keep pulse dot keyframe for status-dot references */
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
    50%       { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
}


/* =========================================================
   HEADER  — Dark Glassmorphism
   ========================================================= */

.app-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--header-height);
    background: rgba(10, 15, 26, 0.45);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 900;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
    transition: left var(--transition);
}


/* =========================================================
   HEADER LEFT
   ========================================================= */

.header-left {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
}

.desktop-sidebar-toggle,
.mobile-menu-button {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 19px;
    transition:
        background var(--transition),
        border-color var(--transition),
        color var(--transition),
        transform var(--transition);
}

.desktop-sidebar-toggle:hover,
.mobile-menu-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
    transform: scale(1.04);
}

.mobile-menu-button {
    display: none;
}

.page-heading {
    min-width: 0;
}

.page-heading h1 {
    margin: 0;
    color: #f1f5f9;
    font-size: 17px;
    font-weight: 700;
    line-height: 22px;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-heading p {
    margin: 1px 0 0;
    color: rgba(255, 255, 255, 0.38);
    font-size: 11px;
    line-height: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* =========================================================
   HEADER RIGHT
   ========================================================= */

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-status {
    height: 28px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 100px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #4ade80;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.header-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse-dot 2.4s ease-in-out infinite;
}

.header-icon-button {
    position: relative;
    width: 38px;
    height: 38px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    cursor: pointer;
    transition:
        background var(--transition),
        color var(--transition),
        border-color var(--transition),
        transform var(--transition);
}

.header-icon-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.12);
    transform: scale(1.05);
}

.notification-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    border: 1.5px solid rgba(10,14,22,0.8);
    animation: notif-bounce 1.8s ease-in-out infinite;
}

@keyframes notif-bounce {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.25); }
}

.header-notif-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notification-badge-num {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    border: 1.5px solid rgba(10, 14, 22, 0.9);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
    animation: notif-bounce 1.8s ease-in-out infinite;
    pointer-events: none;
}

/* =========================================================
   NOTIFICATIONS DROPDOWN PANEL
   ========================================================= */

.notif-dropdown {
    position: absolute;
    top: calc(var(--header-height) + 6px);
    right: 0;
    width: 360px;
    max-width: 92vw;
    background: rgba(10, 14, 22, 0.92);
    backdrop-filter: blur(24px) saturate(170%);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 14px 45px rgba(0, 0, 0, 0.65);
    z-index: 1200;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-dropdown.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.notif-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: #f1f5f9;
}

.notif-header-title i {
    color: var(--accent-light);
    font-size: 15px;
}

.notif-badge-pill {
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    line-height: 14px;
}

.notif-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.notif-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.16);
}

/* =========================================================
   Web Push Notifications Banner (Mobile / Lockscreen Alerts)
   ========================================================= */
.notif-push-banner {
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.6) 0%, rgba(30, 41, 59, 0.4) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notif-push-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notif-push-icon-box {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.notif-push-icon-box.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.notif-push-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.notif-push-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notif-push-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #f1f5f9;
}

.notif-push-badge {
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.notif-push-badge.badge-active {
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
}

.notif-push-badge.badge-disabled {
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.notif-push-badge.badge-checking {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #38bdf8;
}

.notif-push-badge.badge-unsupported {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.notif-push-desc {
    font-size: 10.5px;
    color: #94a3b8;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-push-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notif-push-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 7px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.notif-push-enable-btn {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.25);
}

.notif-push-enable-btn:hover {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.notif-push-enable-btn.btn-active {
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    box-shadow: none;
}

.notif-push-enable-btn.btn-active:hover {
    background: rgba(16, 185, 129, 0.25);
}

.notif-push-test-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
}

.notif-push-test-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.5);
    transform: translateY(-1px);
}

.notif-ios-pwa-tip {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 9px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 7px;
    color: #fbbf24;
    font-size: 10px;
    line-height: 1.4;
}

.notif-ios-pwa-tip i {
    font-size: 12px;
    margin-top: 1px;
    flex-shrink: 0;
}

.notif-body {
    max-height: 380px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.notif-body::-webkit-scrollbar {
    width: 5px;
}
.notif-body::-webkit-scrollbar-track {
    background: transparent;
}
.notif-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.notif-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 20px;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
}

.notif-empty-state i {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.notif-empty-state p {
    font-size: 12.5px;
    margin: 0;
    font-weight: 500;
}

/* Individual notification card item */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    transition: background var(--transition);
}

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

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-item.unread {
    background: rgba(56, 189, 248, 0.04);
}

.notif-item.unread:hover {
    background: rgba(56, 189, 248, 0.08);
}

.notif-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 1px;
}

.notif-icon-box.portal_access {
    background: rgba(6, 182, 212, 0.16);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #22d3ee;
}

.notif-icon-box.stock_request {
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.notif-icon-box.system {
    background: rgba(99, 102, 241, 0.16);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
}

.notif-icon-box.user_login {
    background: rgba(14, 165, 233, 0.16);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #38bdf8;
}

.notif-icon-box.user_terminated {
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.notif-icon-box.user_unterminated {
    background: rgba(34, 197, 94, 0.16);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.notif-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
    white-space: nowrap;
}

.notif-item-msg {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 16px;
    margin-top: 2px;
    word-break: break-word;
}

.notif-unread-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
    flex-shrink: 0;
    margin-top: 6px;
}

.notif-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
}

.notif-footer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    white-space: nowrap;
}

.notif-btn-view-all {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(99, 102, 241, 0.2));
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.notif-btn-view-all:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(99, 102, 241, 0.35));
    border-color: rgba(56, 189, 248, 0.6);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

.notif-btn-clear-history {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.notif-btn-clear-history:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* =========================================================
   ALL SYSTEM ALERTS MODAL
   ========================================================= */

.alerts-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10500;
    background: rgba(4, 8, 20, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: alertsFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes alertsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.alerts-modal-card {
    position: relative;
    width: 100%;
    max-width: 680px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.94), rgba(15, 23, 42, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.65), 0 0 35px rgba(56, 189, 248, 0.1);
    overflow: hidden;
    animation: alertsSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes alertsSlideUp {
    from { transform: translateY(18px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.alerts-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.alerts-modal-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alerts-modal-icon-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(99, 102, 241, 0.25));
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.alerts-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
    line-height: 1.25;
}

.alerts-modal-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 2px 0 0;
}

.alerts-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alerts-count-pill {
    font-size: 11px;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.alerts-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.alerts-modal-close:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.alerts-modal-toolbar {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.alerts-filter-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
}

.alerts-filter-tabs::-webkit-scrollbar {
    display: none;
}

.alerts-filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.alerts-filter-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

.alerts-filter-tab.active {
    background: rgba(56, 189, 248, 0.16);
    border-color: rgba(56, 189, 248, 0.45);
    color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.tab-badge {
    font-size: 9.5px;
    font-weight: 800;
    background: #38bdf8;
    color: #040814;
    padding: 1px 5px;
    border-radius: 999px;
    line-height: 1.2;
}

.alerts-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.alerts-search-box {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    color: #94a3b8;
}

.alerts-search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #f1f5f9;
    font-size: 12px;
    width: 120px;
}

.alerts-search-box input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.alerts-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    border: none;
    outline: none;
}

.alerts-action-read {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.alerts-action-read:hover {
    background: rgba(16, 185, 129, 0.25);
    color: #ffffff;
}

.alerts-action-clear {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #f87171;
}

.alerts-action-clear:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ffffff;
}

.alerts-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 240px;
    max-height: 520px;
}

.alerts-modal-loading,
.alerts-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    gap: 10px;
}

.alerts-empty-state i {
    font-size: 38px;
    opacity: 0.5;
}

.alerts-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(56, 189, 248, 0.2);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: alertsSpin 0.7s linear infinite;
}

@keyframes alertsSpin {
    to { transform: rotate(360deg); }
}

.alerts-card-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 13px 15px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.alerts-card-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.alerts-card-item.unread {
    background: rgba(56, 189, 248, 0.06);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: inset 3px 0 0 #38bdf8;
}

.alerts-card-body {
    flex: 1;
    min-width: 0;
}

.alerts-card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.alerts-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alerts-type-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
}

.alerts-type-tag.portal_access { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.alerts-type-tag.stock_request { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.alerts-type-tag.user_login { background: rgba(14, 165, 233, 0.18); color: #38bdf8; }
.alerts-type-tag.user_terminated { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.alerts-type-tag.user_unterminated { background: rgba(34, 197, 94, 0.18); color: #4ade80; }

.alerts-timestamp {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.alerts-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alerts-unread-badge {
    font-size: 9.5px;
    font-weight: 700;
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 1px 6px;
    border-radius: 4px;
}

.alerts-delete-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.18s ease;
}

.alerts-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.alerts-card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0 0 4px;
    line-height: 1.35;
}

.alerts-card-msg {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.5;
    margin: 0;
    word-break: break-word;
}

.alerts-card-footer {
    margin-top: 8px;
    display: flex;
    align-items: center;
}

.alerts-open-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: #38bdf8;
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(56, 189, 248, 0.1);
    transition: all 0.18s ease;
}

.alerts-open-link:hover {
    background: rgba(56, 189, 248, 0.2);
    color: #ffffff;
}

.alerts-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.alerts-modal-footer-stats {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.45);
}

.alerts-modal-done-btn {
    padding: 6px 18px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f8fafc;
    cursor: pointer;
    transition: all 0.18s ease;
}

.alerts-modal-done-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}

/* ── Nested Mini Confirmation Modal on View All Modal ── */
.alerts-mini-dialog-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: rgba(3, 7, 18, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 18px;
    animation: alertsMiniFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes alertsMiniFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.alerts-mini-dialog-card {
    width: 100%;
    max-width: 350px;
    background: linear-gradient(145deg, rgba(28, 15, 20, 0.98), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 16px;
    padding: 24px 22px 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(239, 68, 68, 0.25);
    animation: alertsMiniCardPop 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes alertsMiniCardPop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.alerts-mini-dialog-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(153, 27, 27, 0.45));
    border: 2px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 14px;
    box-shadow: 0 0 22px rgba(239, 68, 68, 0.3);
}

.alerts-mini-dialog-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 6px;
    line-height: 1.3;
}

.alerts-mini-dialog-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.55;
    margin: 0 0 18px;
}

.alerts-mini-dialog-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alerts-mini-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.18s ease;
}

.alerts-mini-cancel {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #cbd5e1;
}

.alerts-mini-cancel:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.alerts-mini-confirm {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.alerts-mini-confirm:hover {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border-color: rgba(239, 68, 68, 0.7);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.5);
    transform: translateY(-1px);
}

@media (max-width: 640px) {
    .alerts-modal-card {
        max-height: 94vh;
        border-radius: 14px;
    }
    .alerts-modal-header {
        padding: 12px 14px;
    }
    .alerts-modal-toolbar {
        padding: 10px 14px;
    }
    .alerts-modal-body {
        padding: 10px 14px;
    }
    .alerts-search-box input {
        width: 80px;
    }
    .btn-text-desktop {
        display: none;
    }
}


/* =========================================================
   HEADER USER
   ========================================================= */

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    margin-left: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background var(--transition);
}

.header-user:hover {
    background: rgba(255, 255, 255, 0.07);
}

.header-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(139,92,246,0.3));
    color: var(--accent-light);
    font-size: 16px;
    flex-shrink: 0;
    border: 1px solid rgba(99,102,241,0.25);
}

.header-user-info {
    display: flex;
    flex-direction: column;
}

.header-user-name {
    color: #e2e8f0;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 17px;
    white-space: nowrap;
}

.header-user-role {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    line-height: 14px;
    white-space: nowrap;
    font-weight: 500;
}

.header-user-role.superadmin { color: #c084fc; font-weight: 600; }
.header-user-role.admin      { color: #38bdf8; font-weight: 600; }
.header-user-role.manager    { color: #34d399; font-weight: 600; }
.header-user-role.staff      { color: #fb923c; font-weight: 600; }
.header-user-role.user       { color: #94a3b8; font-weight: 500; }
/* Avatar image inside header */
.header-user-avatar img {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    display: block;
}

.hdr-initials {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.hdr-chevron {
    font-size: 11px;
    color: #94a3b8;
    margin-left: 2px;
    transition: transform var(--transition);
    flex-shrink: 0;
}

.header-user[aria-expanded="true"] .hdr-chevron {
    transform: rotate(180deg);
}


/* =========================================================
   HEADER DROPDOWN  — Dark Glass
   ========================================================= */

.hdr-dropdown {
    position: absolute;
    top: calc(var(--header-height) + 6px);
    right: 16px;
    width: 280px;
    background: rgba(10, 14, 22, 0.82);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.04) inset,
        0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1100;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
}

.hdr-dropdown.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.hdr-dd-profile {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 16px 14px;
}

.hdr-dd-avatar {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(139,92,246,0.3));
    border: 1px solid rgba(99,102,241,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.hdr-dd-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hdr-dd-avatar span {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: -0.5px;
}

.hdr-dd-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.hdr-dd-name {
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 700;
    line-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hdr-dd-username {
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    line-height: 16px;
}

.hdr-dd-dept {
    color: rgba(255, 255, 255, 0.25);
    font-size: 10px;
    line-height: 14px;
    margin-top: 1px;
}

.hdr-role-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    border-radius: 6px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    width: fit-content;
}

/* =========================================================
   ROLE & STATUS BADGES (Synchronized with User Accounts)
   ========================================================= */

.badge-role {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 13px;
    width: fit-content;
}

.badge-role.superadmin,
.hdr-role-badge.superadmin,
.hdr-role-badge.badge-sa {
    background: rgba(168, 85, 247, 0.18) !important;
    border: 1px solid rgba(168, 85, 247, 0.35) !important;
    color: #c084fc !important;
}

.badge-role.admin,
.hdr-role-badge.admin,
.hdr-role-badge.badge-adm {
    background: rgba(56, 189, 248, 0.18) !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    color: #38bdf8 !important;
}

.badge-role.manager,
.hdr-role-badge.manager {
    background: rgba(52, 211, 153, 0.18) !important;
    border: 1px solid rgba(52, 211, 153, 0.35) !important;
    color: #34d399 !important;
}

.badge-role.staff,
.hdr-role-badge.staff {
    background: rgba(251, 146, 60, 0.18) !important;
    border: 1px solid rgba(251, 146, 60, 0.35) !important;
    color: #fb923c !important;
}

.badge-role.user,
.hdr-role-badge.user,
.hdr-role-badge.badge-usr {
    background: rgba(148, 163, 184, 0.18) !important;
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
    color: #cbd5e1 !important;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 13px;
    width: fit-content;
}

.badge-status.active {
    background: rgba(34, 197, 94, 0.18) !important;
    border: 1px solid rgba(34, 197, 94, 0.35) !important;
    color: #4ade80 !important;
}

.badge-status.inactive {
    background: rgba(148, 163, 184, 0.18) !important;
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
    color: #94a3b8 !important;
}

.badge-status.pending {
    background: rgba(245, 158, 11, 0.18) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    color: #fbbf24 !important;
}

.badge-status.terminated {
    background: rgba(239, 68, 68, 0.22) !important;
    border: 1px solid rgba(239, 68, 68, 0.55) !important;
    color: #f87171 !important;
}

.badge-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-status-dot.active {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.badge-status-dot.inactive {
    background: #94a3b8;
}

.badge-status-dot.pending {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.badge-status-dot.terminated {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.hdr-dd-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 0 12px;
}

.hdr-dd-links {
    padding: 6px 8px;
}

.hdr-dd-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition:
        background var(--transition),
        color var(--transition),
        border-color var(--transition),
        transform 0.12s ease;
}

.hdr-dd-link i {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.35);
    width: 18px;
    text-align: center;
    transition: color var(--transition), transform var(--transition);
}

.hdr-dd-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.hdr-dd-link:hover i {
    color: var(--accent-light);
    transform: scale(1.12);
}

.hdr-dd-link:active,
.hdr-dd-link.touch-active {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
    transform: scale(0.98);
}

.hdr-dd-link:active i,
.hdr-dd-link.touch-active i {
    color: var(--accent-light);
}

/* Portal Alerts Toggle Switch Row in Profile Dropdown */
.hdr-dd-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 4px 0 2px 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    user-select: none;
    -webkit-user-select: none;
    transition: background var(--transition), border-color var(--transition);
}

.hdr-dd-toggle-row:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.hdr-dd-toggle-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hdr-dd-toggle-info i {
    font-size: 15px;
    color: var(--accent-light);
    width: 18px;
    text-align: center;
}

.hdr-dd-toggle-texts {
    display: flex;
    flex-direction: column;
}

.hdr-dd-toggle-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 16px;
}

.hdr-dd-toggle-sub {
    font-size: 10.5px;
    color: #10b981;
    font-weight: 500;
    line-height: 14px;
    transition: color var(--transition);
}

.hdr-dd-toggle-sub.muted {
    color: #94a3b8;
}

/* iOS-style toggle switch */
.hdr-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 23px;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}

.hdr-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.hdr-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    border-radius: 24px;
}

.hdr-slider:before {
    position: absolute;
    content: "";
    height: 17px;
    width: 17px;
    left: 2px;
    bottom: 2px;
    background-color: #ffffff;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.hdr-switch input:checked + .hdr-slider {
    background-color: #10b981;
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.hdr-switch input:checked + .hdr-slider:before {
    transform: translateX(19px);
}

/* Phone / Device Push Notification Button in Profile Dropdown */
.hdr-dd-device-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    margin-top: 4px;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.08);
    color: #38bdf8;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform 0.12s ease;
}

.hdr-dd-device-btn:hover {
    background: rgba(56, 189, 248, 0.16);
    border-color: rgba(56, 189, 248, 0.6);
    color: #fff;
}

.hdr-dd-device-btn:active {
    transform: scale(0.97);
}

.hdr-dd-device-btn.enabled {
    border: 1px solid rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
    color: #34d399;
}

.hdr-dd-device-btn.denied {
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
}

.hdr-dd-device-btn i {
    font-size: 14px;
    flex-shrink: 0;
}

/* Logout in header dropdown */
.hdr-dd-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 8px 8px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: #f87171;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition:
        background var(--transition),
        color var(--transition),
        border-color var(--transition),
        box-shadow var(--transition),
        transform 0.12s ease;
}

.hdr-dd-logout i {
    font-size: 15px;
    width: 18px;
    text-align: center;
    transition: transform var(--transition);
}

.hdr-dd-logout:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.32);
    color: #fca5a5;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.18);
}

.hdr-dd-logout:hover i {
    transform: translateX(3px);
}

.hdr-dd-logout:active,
.hdr-dd-logout.touch-active {
    background: rgba(239, 68, 68, 0.28);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fecaca;
    transform: scale(0.98);
}


/* =========================================================
   PAGE CONTENT
   ========================================================= */

.app-main,
.main {
    margin-left: var(--sidebar-width) !important;
    padding-top: var(--header-height) !important;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.app-content {
    padding: 24px;
}


/* =========================================================
   COLLAPSED SIDEBAR  — Desktop Only ( >= 769px )
   ========================================================= */

@media (min-width: 769px) {

    body.sidebar-collapsed .app-sidebar {
        width: var(--sidebar-collapsed-width);
        overflow: visible;
    }

    body.sidebar-collapsed .app-header {
        left: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed .app-main,
    body.sidebar-collapsed .main {
        margin-left: var(--sidebar-collapsed-width) !important;
    }

    /* Header when collapsed */
    body.sidebar-collapsed .page-heading p {
        display: none;
    }

    /* Sidebar Brand Header when collapsed */
    body.sidebar-collapsed .sidebar-header {
        justify-content: center;
        padding: 0;
    }

    body.sidebar-collapsed .sidebar-brand {
        flex: 0;
        justify-content: center;
        margin: 0 auto;
    }

    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .sidebar-close {
        display: none !important;
    }

    /* Sidebar Navigation when collapsed */
    body.sidebar-collapsed .sidebar-nav {
        padding: 14px 0;
        overflow: visible !important;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    body.sidebar-collapsed .nav-section {
        width: 100%;
        margin-bottom: 6px;
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    body.sidebar-collapsed .nav-section-title {
        display: none !important;
    }

    body.sidebar-collapsed .nav-item {
        width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
        margin: 4px auto;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1.5px solid transparent;
        color: rgba(255, 255, 255, 0.55);
        background: transparent;
        position: relative;
        cursor: pointer;
        transition: all var(--transition);
    }

    body.sidebar-collapsed .nav-item::before {
        display: none !important;
    }

    body.sidebar-collapsed .nav-label,
    body.sidebar-collapsed .nav-arrow {
        display: none !important;
    }

    body.sidebar-collapsed .nav-icon {
        font-size: 19px;
        width: auto;
        min-width: unset;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.sidebar-collapsed .nav-item:hover {
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.12);
        color: #fff;
    }

    /* Active item in collapsed mode */
    body.sidebar-collapsed .nav-item.active,
    body.sidebar-collapsed .nav-item.group-active {
        background: rgba(45, 212, 191, 0.12) !important;
        border: 1.5px solid #2dd4bf !important;
        box-shadow: 0 0 16px rgba(45, 212, 191, 0.25), inset 0 0 8px rgba(45, 212, 191, 0.08) !important;
        color: #2dd4bf !important;
        border-radius: 12px !important;
    }

    body.sidebar-collapsed .nav-item.active .nav-icon,
    body.sidebar-collapsed .nav-item.group-active .nav-icon,
    body.sidebar-collapsed .nav-item.active .nav-icon i,
    body.sidebar-collapsed .nav-item.group-active .nav-icon i {
        color: #2dd4bf !important;
    }

    /* Tooltip on hover in collapsed mode (ONLY for single items without submenus) */
    body.sidebar-collapsed .nav-item[data-tooltip]:not(.nav-group-toggle):hover::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background: rgba(10, 14, 22, 0.94);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        color: #f1f5f9;
        font-size: 12px;
        font-weight: 600;
        padding: 6px 12px;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        white-space: nowrap;
        pointer-events: none;
        z-index: 1200;
        animation: fadeInTooltip 0.15s ease;
    }

    /* Never render tooltips for nav-group-toggle buttons */
    body.sidebar-collapsed .nav-group-toggle::after {
        display: none !important;
        content: none !important;
    }

    @keyframes fadeInTooltip {
        from { opacity: 0; transform: translateY(-50%) translateX(-4px); }
        to   { opacity: 1; transform: translateY(-50%) translateX(0); }
    }

    /* Floating Submenu flyout in collapsed mode */
    body.sidebar-collapsed .nav-submenu,
    body.sidebar-collapsed .nav-submenu.open {
        display: flex !important;
        flex-direction: column !important;
        gap: 3px !important;
        position: absolute !important;
        left: calc(100% + 8px) !important;
        top: 0 !important;
        width: 215px !important;
        min-width: 200px !important;
        background: rgba(12, 17, 29, 0.96) !important;
        backdrop-filter: blur(24px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 14px !important;
        box-shadow: 
            0 12px 36px rgba(0, 0, 0, 0.65), 
            0 2px 10px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
        padding: 8px !important;
        margin: 0 !important;
        z-index: 1250 !important;
        max-height: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateX(-6px) scale(0.98) !important;
        transition: 
            opacity 0.15s cubic-bezier(0.16, 1, 0.3, 1),
            transform 0.15s cubic-bezier(0.16, 1, 0.3, 1),
            visibility 0.15s !important;
        overflow: visible !important;
    }

    /* Invisible hover bridge between icon and flyout */
    body.sidebar-collapsed .nav-submenu::before {
        content: '' !important;
        position: absolute !important;
        top: -10px !important;
        bottom: -10px !important;
        left: -18px !important;
        width: 22px !important;
        background: transparent !important;
        pointer-events: auto !important;
    }

    /* Reveal flyout ONLY when actively hovering that specific button/section or its flyout */
    body.sidebar-collapsed .nav-section:hover > .nav-submenu,
    body.sidebar-collapsed .nav-section > .nav-submenu:hover {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translateX(0) scale(1) !important;
    }

    /* Submenu Header in collapsed flyout */
    body.sidebar-collapsed .nav-submenu-header {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 6px 10px 8px !important;
        margin-bottom: 4px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.06em !important;
        color: #2dd4bf !important;
        pointer-events: none !important;
    }

    body.sidebar-collapsed .nav-submenu-header i {
        font-size: 13px !important;
        opacity: 0.9 !important;
    }

    /* Submenu Items in collapsed flyout */
    body.sidebar-collapsed .nav-subitem {
        padding: 8px 12px !important;
        color: rgba(241, 245, 249, 0.78) !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        text-decoration: none !important;
        transition: all 0.16s ease !important;
        white-space: nowrap !important;
        min-height: 36px !important;
    }

    body.sidebar-collapsed .nav-subitem .subitem-icon {
        width: 18px !important;
        min-width: 18px !important;
        font-size: 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: rgba(255, 255, 255, 0.6) !important;
        transition: color 0.16s ease !important;
    }

    body.sidebar-collapsed .nav-subitem:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        color: #ffffff !important;
    }

    body.sidebar-collapsed .nav-subitem:hover .subitem-icon {
        color: #2dd4bf !important;
    }

    body.sidebar-collapsed .nav-subitem.active {
        background: rgba(45, 212, 191, 0.16) !important;
        color: #2dd4bf !important;
        font-weight: 600 !important;
    }

    body.sidebar-collapsed .nav-subitem.active .subitem-icon {
        color: #2dd4bf !important;
    }

    /* Sidebar Footer in collapsed mode */
    body.sidebar-collapsed .sidebar-footer {
        padding: 14px 0;
        display: flex;
        justify-content: center;
        align-items: center;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    body.sidebar-collapsed .sb-profile {
        padding: 0;
        margin: 0;
        justify-content: center;
        display: flex;
        width: 100%;
    }

    body.sidebar-collapsed .sb-profile-avatar {
        width: 40px;
        height: 40px;
        min-width: 40px;
        border-radius: 50%;
        margin: 0 auto;
        border: 1.5px solid rgba(255, 255, 255, 0.2);
    }

    body.sidebar-collapsed .sb-profile-avatar img {
        border-radius: 50%;
    }

    body.sidebar-collapsed .sb-profile-info,
    body.sidebar-collapsed .sb-footer-actions {
        display: none !important;
    }

}


/* =========================================================
   MOBILE OVERLAY
   ========================================================= */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.6);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    will-change: opacity;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sidebar-overlay.no-transition {
    transition: none !important;
}


/* =========================================================
   TABLET  ( <= 1024px )
   ========================================================= */

@media (max-width: 1024px) {

    :root {
        --sidebar-width: 240px;
    }

    .header-status {
        display: none;
    }

}


/* =========================================================
   MOBILE RESPONSIVE  ( <= 768px )
   ========================================================= */

@media (max-width: 768px) {

    :root {
        --header-bar-height: 60px;
        --header-height: calc(60px + env(safe-area-inset-top, 0px));
    }

    /* ── Mobile Header ──────────────────────────────── */
    .app-header {
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        height: calc(60px + env(safe-area-inset-top, 0px)) !important;
        padding-top: env(safe-area-inset-top, 0px) !important;
        padding-bottom: 0 !important;
        padding-left: calc(12px + env(safe-area-inset-left, 0px)) !important;
        padding-right: calc(12px + env(safe-area-inset-right, 0px)) !important;
        box-sizing: border-box !important;
        background: rgba(10, 15, 26, 0.85) !important;
        backdrop-filter: blur(20px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        z-index: 900 !important;
    }

    .header-left {
        gap: 10px;
        flex: 1;
        min-width: 0;
    }

    .desktop-sidebar-toggle {
        display: none !important;
    }

    .mobile-menu-button {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        min-width: 42px;
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
        font-size: 22px;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        transition: background 0.15s ease, transform 0.1s ease;
        flex-shrink: 0;
    }

    .mobile-menu-button i {
        pointer-events: none;
    }

    .mobile-menu-button:active {
        background: rgba(255, 255, 255, 0.16);
        transform: scale(0.94);
    }

    .page-heading {
        min-width: 0;
        flex: 1;
    }

    .page-heading h1 {
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1.2 !important;
        color: #ffffff !important;
        margin: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .page-heading p {
        display: none !important;
    }

    .header-right {
        gap: 6px;
        flex-shrink: 0;
    }

    .header-status {
        display: none !important;
    }

    .header-icon-button {
        width: 36px;
        height: 36px;
        font-size: 16px;
        border-radius: 8px;
    }

    .header-user {
        border-left: 0 !important;
        padding: 3px !important;
        margin-left: 0 !important;
    }

    .header-user-info,
    .hdr-chevron {
        display: none !important;
    }

    .header-user-avatar {
        width: 34px !important;
        height: 34px !important;
        border-radius: 50% !important;
    }

    .header-user-avatar img {
        border-radius: 50% !important;
    }

    /* Mobile Header Dropdown */
    .hdr-dropdown {
        position: fixed !important;
        top: calc(var(--header-height) + 8px) !important;
        right: calc(12px + env(safe-area-inset-right, 0px)) !important;
        left: auto !important;
        width: calc(100vw - 24px) !important;
        max-width: 300px !important;
        z-index: 1200 !important;
    }

    /* ── Mobile Off-Canvas Sidebar Drawer ─────────────── */
    .app-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        padding-top: env(safe-area-inset-top, 0px) !important;
        padding-left: env(safe-area-inset-left, 0px) !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
        box-sizing: border-box !important;
        transform: translate3d(-100%, 0, 0) !important;
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        will-change: transform;
        z-index: 1100 !important;
        background: #0b1329 !important;
        box-shadow: 6px 0 28px rgba(0, 0, 0, 0.6) !important;
        border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .app-sidebar.no-transition,
    .sidebar-overlay.no-transition {
        transition: none !important;
    }

    .app-sidebar.mobile-open {
        transform: translate3d(0, 0, 0) !important;
    }

    .sidebar-header {
        height: 60px !important;
        min-height: 60px !important;
        padding: 0 16px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
        flex-shrink: 0 !important;
    }

    .sidebar-brand {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        flex: 1 !important;
        text-decoration: none !important;
    }

    .brand-icon {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        border-radius: 50% !important;
    }

    .brand-text {
        display: flex !important;
        flex-direction: column !important;
    }

    .brand-title {
        color: #ffffff !important;
        font-size: 15px !important;
        font-weight: 700 !important;
    }

    .brand-subtitle {
        color: #64748b !important;
        font-size: 10px !important;
        text-transform: uppercase !important;
        display: block !important;
    }

    .sidebar-close {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        border-radius: 8px !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        background: rgba(255, 255, 255, 0.06) !important;
        color: rgba(255, 255, 255, 0.85) !important;
        font-size: 16px !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
        user-select: none !important;
        transition: background 0.15s ease, transform 0.1s ease !important;
    }

    .sidebar-close i {
        pointer-events: none !important;
    }

    .sidebar-close:active {
        background: rgba(255, 255, 255, 0.16) !important;
        transform: scale(0.94) !important;
    }

    .sidebar-nav {
        flex: 1 !important;
        padding: 14px 10px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        display: block !important;
    }

    .nav-section {
        margin-bottom: 16px !important;
        display: block !important;
        width: 100% !important;
    }

    .nav-section-title {
        display: block !important;
        padding: 0 12px 6px !important;
        font-size: 10px !important;
        font-weight: 700 !important;
        color: #64748b !important;
        letter-spacing: 0.08em !important;
        text-transform: uppercase !important;
    }

    .nav-item {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        min-height: 44px !important;
        /* padding: 0 12px !important; */
        margin: 2px 0 !important;
        border-radius: 10px !important;
        font-size: 13.5px !important;
        color: #8fa0ab !important;
        text-decoration: none !important;
    }

    .nav-icon {
        width: 22px !important;
        min-width: 22px !important;
        font-size: 18px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .nav-label {
        display: block !important;
        flex: 1 !important;
        text-align: left !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .nav-arrow {
        display: flex !important;
        margin-left: auto !important;
        font-size: 12px !important;
        color: #64748b !important;
        pointer-events: none !important;
        transition: transform 0.25s ease !important;
    }

    .nav-group-toggle[aria-expanded="true"] .nav-arrow,
    .nav-group-toggle.open .nav-arrow {
        transform: rotate(180deg) !important;
    }

    .nav-submenu {
        position: static !important;
        width: auto !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
        margin-left: 18px !important;
        padding: 0 0 0 12px !important;
        border-left: 1.5px solid rgba(255, 255, 255, 0.08) !important;
        max-height: 0 !important;
        opacity: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
        transition: max-height 0.2s cubic-bezier(0, 0, 0.2, 1), opacity 0.16s ease, visibility 0.2s !important;
        will-change: max-height, opacity;
    }

    .nav-submenu.open {
        max-height: 320px !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 4px 0 6px 12px !important;
    }

    .nav-subitem {
        min-height: 38px !important;
        padding: 0 10px !important;
        font-size: 13px !important;
        color: #8fa0ab !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .sidebar-footer {
        padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
        flex-shrink: 0 !important;
        display: block !important;
    }

    .sb-profile {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        margin-bottom: 10px !important;
        text-decoration: none !important;
    }

    .sb-profile-avatar {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        border-radius: 50% !important;
    }

    .sb-profile-info {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 !important;
    }

    .sb-profile-name {
        color: #ffffff !important;
        font-size: 13px !important;
        font-weight: 700 !important;
    }

    .sb-profile-role {
        color: #64748b !important;
        font-size: 10.5px !important;
        text-transform: capitalize !important;
    }

    .sb-footer-actions {
        display: flex !important;
        gap: 6px !important;
    }

    .sb-action-btn {
        height: 32px !important;
        font-size: 11.5px !important;
    }

    /* ── Mobile Content ──────────────────────────────── */
    .app-main,
    .main {
        margin-left: 0 !important;
        padding-top: calc(60px + env(safe-area-inset-top, 0px)) !important;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
        padding-left: env(safe-area-inset-left, 0px) !important;
        padding-right: env(safe-area-inset-right, 0px) !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    .app-content {
        padding: 14px !important;
        padding-left: calc(14px + env(safe-area-inset-left, 0px)) !important;
        padding-right: calc(14px + env(safe-area-inset-right, 0px)) !important;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    }

}


/* =========================================================
   SMALL MOBILE  ( <= 480px )
   ========================================================= */

@media (max-width: 480px) {

    .app-header {
        padding-left: calc(10px + env(safe-area-inset-left, 0px)) !important;
        padding-right: calc(10px + env(safe-area-inset-right, 0px)) !important;
    }

    .header-left {
        gap: 8px;
    }

    .header-right {
        gap: 4px;
    }

    .notif-dropdown {
        position: fixed !important;
        top: calc(var(--header-height) + 6px) !important;
        left: calc(8px + env(safe-area-inset-left, 0px)) !important;
        right: calc(8px + env(safe-area-inset-right, 0px)) !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
    }

    .page-heading h1 {
        font-size: 14px !important;
        max-width: 40vw;
    }

    .app-content {
        padding: 10px !important;
        padding-left: calc(10px + env(safe-area-inset-left, 0px)) !important;
        padding-right: calc(10px + env(safe-area-inset-right, 0px)) !important;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }

}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}


/* =========================================================
   REDUCE MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

}


/* =========================================================
   TOP LOADING PROGRESS BAR & INSTANT FEEDBACK
   ========================================================= */

.app-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #38bdf8, #818cf8, #06b6d4);
    z-index: 999999;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.8), 0 0 4px rgba(129, 140, 248, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: width 0.35s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 0.2s ease;
}

.nav-item.nav-loading-active,
.nav-subitem.nav-loading-active {
    background: rgba(56, 189, 248, 0.16) !important;
    color: #38bdf8 !important;
}

/* =========================================================
   FLOATING PORTAL ALERT TOAST
   ========================================================= */

.portal-alert-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 380px;
    width: calc(100vw - 32px);
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 16px rgba(56, 189, 248, 0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.portal-alert-toast.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 17px;
    margin-bottom: 2px;
}

.toast-desc {
    font-size: 11.5px;
    color: #94a3b8;
    line-height: 15px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
}

.toast-close:hover {
    color: #fff;
}