:root {
    /* Color System */
    --color-navy-deep: #0B1220;
    --color-navy-primary: #131E32;
    --color-blue-business: #1D4ED8; /* Unified deep business blue */
    --color-blue-hover: #1E40AF;
    --color-emerald: #059669; /* deeper formal green */
    --color-red: #E11D48; /* coral rose red */
    --color-amber: #F59E0B;
    
    --color-workspace: #F1F5F9; /* Darkened for better eye comfort */
    --color-surface: #FFFFFF;
    --color-border: #CBD5E1; /* Strengthened for clearer panel separation */
    
    /* Text System */
    --color-text-primary: #0F172A;
    --color-text-secondary: #334155; /* Slate 700 */
    --color-text-muted: #475569; /* Slate 600 */
    
    /* Shadows & Depth */
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--color-workspace);
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--color-blue-business);
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--color-blue-hover);
}

/* App Shell Layout */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--color-navy-deep);
    color: var(--color-surface);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform var(--transition-fast);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
}

.sidebar-brand {
    height: 70px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.brand-icon {
    font-size: 24px;
    color: var(--color-blue-business);
}
.brand-text {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.brand-sub {
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.nav-group {
    margin-bottom: 24px;
}

.nav-group-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    margin-bottom: 10px;
    padding: 0 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: rgba(255,255,255,0.7);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
}
.nav-link i {
    font-size: 18px;
    opacity: 0.8;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--color-surface);
}

.nav-link:hover i {
    transform: translateX(2px);
}

.nav-link.active {
    background-color: var(--color-blue-business);
    color: var(--color-surface);
    box-shadow: inset 2px 0 0 rgba(255,255,255,0.3);
}
.nav-link.active i {
    opacity: 1;
}

/* Main Wrapper & Topbar */
.main-wrapper {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; 
    transition: margin-left var(--transition-fast);
}

/* Collapsed Sidebar Styles (Desktop) */
@media (min-width: 992px) {
    .app-shell.sidebar-collapsed .sidebar {
        width: 80px;
    }
    .app-shell.sidebar-collapsed .main-wrapper {
        margin-left: 80px;
    }
    .app-shell.sidebar-collapsed .brand-text,
    .app-shell.sidebar-collapsed .brand-sub,
    .app-shell.sidebar-collapsed .nav-group-label {
        display: none;
    }
    .app-shell.sidebar-collapsed .sidebar-brand {
        justify-content: center;
        padding: 0;
    }
    .app-shell.sidebar-collapsed .nav-link {
        justify-content: center;
        padding: 12px 0;
        font-size: 0;
    }
    .app-shell.sidebar-collapsed .nav-link i {
        font-size: 24px;
        margin: 0;
    }
    .app-shell.sidebar-collapsed .sidebar-nav {
        padding: 24px 8px;
    }
}


.topbar {
    height: 70px;
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 2px 4px rgba(0,0,0,0);
    transition: box-shadow var(--transition-normal);
}

.breadcrumb-current {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .status-dot { animation: none; }
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-emerald);
    animation: pulseRing 3s infinite;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background-color var(--transition-fast);
}
.user-menu:hover {
    background-color: var(--color-workspace);
}

.user-info-text {
    text-align: right;
}

.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 220px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(15,23,42,0.1), 0 4px 6px -4px rgba(15,23,42,0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 16px;
    background-color: var(--color-workspace);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--color-workspace);
    color: var(--color-blue-business);
}

.dropdown-item.text-danger:hover {
    color: var(--color-red);
    background-color: rgba(225, 29, 72, 0.05);
}

.dropdown-item i {
    font-size: 18px;
    color: var(--color-text-muted);
}
.dropdown-item:hover i {
    color: inherit;
}
.user-name-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.user-role-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-navy-primary);
    color: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: transform var(--transition-fast);
}
.user-menu:hover .avatar {
    transform: scale(1.05);
}

/* Page Container */
.page-container {
    padding: 32px;
    flex: 1;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .hero-section, .perf-strip, .actions-bar, .analytical-grid, .activity-panel {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}
.hero-section { animation: fadeUp 250ms ease-out both; animation-delay: 0ms; }
.perf-strip { animation: fadeUp 250ms ease-out both; animation-delay: 50ms; }
.actions-bar { animation: fadeUp 250ms ease-out both; animation-delay: 100ms; }
.analytical-grid { animation: fadeUp 250ms ease-out both; animation-delay: 150ms; }
.activity-panel { animation: fadeUp 250ms ease-out both; animation-delay: 200ms; }

/* Utilities */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -12px;
    margin-right: -12px;
}
.col-12, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-8, .col-lg-68, .col-lg-32 {
    padding-left: 12px;
    padding-right: 12px;
    width: 100%;
}
@media (min-width: 768px) {
    .col-md-6 { width: 50%; }
}
@media (min-width: 1024px) {
    .col-lg-3 { width: 25%; }
    .col-lg-4 { width: 33.333333%; }
    .col-lg-8 { width: 66.666667%; }
    .col-lg-68 { width: 68%; flex: 0 0 68%; }
    .col-lg-32 { width: 32%; flex: 0 0 32%; }
}

.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-5 { margin-bottom: 32px; }
.mt-4 { margin-top: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Semantic Colors */
.text-emerald { color: var(--color-emerald) !important; }
.text-red { color: var(--color-red) !important; }
.text-amber { color: var(--color-amber) !important; }
.text-blue { color: var(--color-blue-business) !important; }
.text-muted { color: var(--color-text-muted) !important; }

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1030;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .sidebar { 
        position: fixed; 
        left: -250px; 
        transition: left var(--transition-fast);
        z-index: 1040;
        box-shadow: var(--shadow-lg);
    } 
    .app-shell.sidebar-collapsed .sidebar {
        left: 0;
    }
    .main-wrapper { 
        margin-left: 0; 
        width: 100%;
        max-width: 100vw;
    }
    .app-shell.sidebar-collapsed .main-wrapper {
        margin-left: 0; /* Keep it 0 even when sidebar is open on mobile */
    }
    .app-shell.sidebar-collapsed .sidebar-overlay {
        display: block;
    }
    .page-container { padding: 16px; overflow-x: hidden; }
    .topbar { padding: 0 16px; height: 60px; }
    .system-status { display: none; }
    .breadcrumb-current { font-size: 14px; gap: 8px; }
    .topbar-right { gap: 12px; }
    
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 767px) {
    .row { margin-left: -8px; margin-right: -8px; }
    .col-12, .col-md-6, .col-lg-3, .col-lg-4, .col-lg-8, .col-lg-68, .col-lg-32 {
        padding-left: 8px;
        padding-right: 8px;
    }
    .auth-card {
        padding: 24px;
    }
}

/* ==========================================================================
   Auth / Login Layout
   ========================================================================== */
.auth-body {
    background-color: var(--color-navy-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 24px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.auth-container {
    width: 100%;
    display: flex;
    justify-content: center;
}
.auth-wrapper {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}
.auth-brand {
    text-align: center;
    color: var(--color-surface);
}
.auth-brand .brand-icon {
    font-size: 56px;
    color: var(--color-blue-business);
    margin-bottom: 16px;
    animation: fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-brand .brand-text {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    animation: fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 50ms both;
}
.auth-brand .brand-sub {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 100ms both;
}
.auth-card {
    background-color: var(--color-surface);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    animation: fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 150ms both;
}
.auth-header {
    margin-bottom: 32px;
    text-align: center;
}
.auth-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 8px;
    margin-top: 0;
}
.auth-header p {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: 0;
}
.auth-footer {
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    animation: fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 200ms both;
}

/* Form Styles inside Auth */
.auth-form .form-group {
    margin-bottom: 20px;
    position: relative;
}
.auth-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}
.auth-form .form-control {
    width: 100%;
    width: -moz-available;
    min-width: 100%;
    max-width: 100%;
    display: block;
    height: 48px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0 16px;
    font-size: 14px;
    color: var(--color-text-primary);
    background-color: var(--color-workspace);
    transition: all var(--transition-fast);
    outline: none;
    box-sizing: border-box;
}
.auth-form .form-control:focus {
    border-color: var(--color-blue-business);
    background-color: var(--color-surface);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);
}
.auth-form .form-control::placeholder {
    color: var(--color-text-muted);
}
.auth-form .input-icon-wrapper {
    display: block;
    width: 100%;
}
.auth-form .input-icon-wrapper .input-icon {
    position: absolute;
    left: 16px;
    top: 47px;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 20px;
    pointer-events: none;
    transition: color var(--transition-fast);
}
.auth-form .form-control:focus + .input-icon, 
.auth-form .input-icon-wrapper:focus-within .input-icon {
    color: var(--color-blue-business);
}
.auth-form .form-control.with-icon {
    padding-left: 16px;
    text-indent: 32px;
}

/* Alerts */
.auth-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    border: 1px solid transparent;
}
.bg-red-50 { background-color: #FEF2F2; }
.text-red-600 { color: #DC2626; }
.border-red-200 { border-color: #FECACA; }
.auth-alert i { font-size: 20px; }


