:root {
    /* Color Palette - Dark Luxury */
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --primary: #10b981;
    --primary-hover: #059669;
    --primary-glow: rgba(16, 185, 129, 0.3);
    --accent: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 15px var(--primary-glow);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    /* For toggle button context if needed */
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.5px;
}

.logo-text .highlight {
    color: var(--primary);
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.main-nav li {
    padding: 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.main-nav li:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.main-nav li.active {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-glow);
}

.main-nav li i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.user-profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: 1px solid var(--border);
}

.user-info .name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.main-content::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

.topbar {
    height: 80px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
}

.page-title h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.icon-btn:hover {
    color: var(--text-main);
}

.icon-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent);
    color: black;
    font-size: 0.6rem;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Dashboard Grid Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.stat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-trend {
    font-size: 0.8rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Tables */
.table-container {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-top: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: rgba(255, 255, 255, 0.02);
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    color: var(--text-main);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-glow);
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #ef4444;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background-color: rgba(0, 0, 0, 0.2);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* --- Auth Screen --- */
#login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #112240, var(--bg-body));
}

.auth-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    animation: authFadeIn 0.5s ease;
}

.auth-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(16, 185, 129, 0.1);
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 
   -----------------------------------------
   MOBILE RESPONSIVE & TOGGLE LOGIC
   -----------------------------------------
*/

/* Sidebar Overlay (Mobile Backcdrop) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 900;
    /* Below sidebar (1000), above content */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Toggle Button Default Styles */
.btn-toggle-sidebar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1100;
    /* Very high z-index to be clickable */
    transition: color 0.2s;
}

.btn-toggle-sidebar:hover {
    color: var(--primary);
}

/* --- Mobile Drawer Layout (Max Width 768px) --- */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    /* Top Bar Mobile */
    .topbar {
        padding: 0 1rem 0 3.5rem;
        /* Left padding for fixed toggle button */
        height: 60px;
        z-index: 50;
    }

    .page-title h2 {
        font-size: 1.1rem;
    }

    .page-title p {
        display: none;
    }

    .content-area {
        padding: 1rem;
        padding-top: 1rem;
    }

    /* Sidebar Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 260px;
        z-index: 1000;
        border-right: 1px solid var(--border);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
        transform: translateX(-100%);
        /* HIDDEN BY DEFAULT */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: 2rem;
        /* Clear top area */
        background-color: var(--bg-sidebar);
    }

    /* Reveal Sidebar on Toggle */
    .sidebar.show-mobile {
        transform: translateX(0);
    }

    /* Hide Toggle Button inside Sidebar logic if any, use fixed one */
    .btn-toggle-sidebar {
        position: fixed;
        top: 15px;
        left: 15px;
        width: 40px;
        height: 40px;
        right: auto;
        background-color: var(--bg-card);
        color: var(--text-main);
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border);
    }

    /* Adjust Grid */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Tables */
    .table-responsive,
    .table-container {
        display: block;
        overflow-x: auto;
    }
}

/* --- Desktop Collapsible State (Min Width 769px) --- */
@media (min-width: 769px) {
    .sidebar.collapsed {
        width: 80px;
        align-items: center;
    }

    .sidebar.collapsed .logo-text,
    .sidebar.collapsed .main-nav span,
    .sidebar.collapsed .user-info {
        display: none;
    }

    .sidebar.collapsed .logo-area {
        justify-content: center;
        padding: 0;
        margin-bottom: 2rem;
    }

    .sidebar.collapsed .main-nav li {
        justify-content: center;
        padding: 1rem 0;
    }

    .sidebar.collapsed .main-nav li i {
        font-size: 1.4rem;
        width: auto;
    }

    .sidebar.collapsed .user-profile {
        justify-content: center;
        padding: 0.5rem;
    }

    .sidebar.collapsed .btn-toggle-sidebar {
        right: 50%;
        transform: translateX(50%);
        top: 0.5rem;
    }
}/ *   - - -   F O R C E   M O B I L E   D R A W E R   S T Y L E S   - - -   * /  
  
 / *   T o g g l e   B u t t o n   -   a l w a y s   v i s i b l e   o n   t o p   * /  
 . b t n - t o g g l e - s i d e b a r   {  
         p o s i t i o n :   f i x e d   ! i m p o r t a n t ;  
         t o p :   1 5 p x   ! i m p o r t a n t ;  
         l e f t :   1 5 p x   ! i m p o r t a n t ;  
         w i d t h :   4 5 p x   ! i m p o r t a n t ;  
         h e i g h t :   4 5 p x   ! i m p o r t a n t ;  
         z - i n d e x :   1 0 0 0 1   ! i m p o r t a n t ;  
         / *   H i g h e s t   p r i o r i t y   * /  
         b a c k g r o u n d - c o l o r :   # 1 e 2 9 3 b   ! i m p o r t a n t ;  
         / *   b g - c a r d   * /  
         c o l o r :   # f 8 f a f c   ! i m p o r t a n t ;  
         / *   t e x t - m a i n   * /  
         b o r d e r :   1 p x   s o l i d   # 3 3 4 1 5 5   ! i m p o r t a n t ;  
         b o r d e r - r a d i u s :   8 p x   ! i m p o r t a n t ;  
         d i s p l a y :   f l e x   ! i m p o r t a n t ;  
         a l i g n - i t e m s :   c e n t e r   ! i m p o r t a n t ;  
         j u s t i f y - c o n t e n t :   c e n t e r   ! i m p o r t a n t ;  
         c u r s o r :   p o i n t e r   ! i m p o r t a n t ;  
         b o x - s h a d o w :   0   4 p x   6 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 3 )   ! i m p o r t a n t ;  
 }  
  
 . b t n - t o g g l e - s i d e b a r   i   {  
         f o n t - s i z e :   1 . 5 r e m   ! i m p o r t a n t ;  
 }  
  
 / *   S i d e b a r   O v e r l a y   * /  
 . s i d e b a r - o v e r l a y   {  
         z - i n d e x :   9 9 9 8   ! i m p o r t a n t ;  
         / *   J u s t   b e l o w   s i d e b a r   * /  
 }  
  
 @ m e d i a   ( m a x - w i d t h :   7 6 8 p x )   {  
  
         / *   S i d e b a r   D r a w e r   L o g i c   * /  
         . s i d e b a r   {  
                 p o s i t i o n :   f i x e d   ! i m p o r t a n t ;  
                 t o p :   0   ! i m p o r t a n t ;  
                 l e f t :   0   ! i m p o r t a n t ;  
                 h e i g h t :   1 0 0 v h   ! i m p o r t a n t ;  
                 w i d t h :   2 8 0 p x   ! i m p o r t a n t ;  
                 b a c k g r o u n d - c o l o r :   # 0 2 0 6 1 7   ! i m p o r t a n t ;  
                 / *   b g - s i d e b a r   * /  
                 z - i n d e x :   9 9 9 9   ! i m p o r t a n t ;  
                 / *   B e l o w   b u t t o n ,   a b o v e   e v e r y t h i n g   e l s e   * /  
                 t r a n s f o r m :   t r a n s l a t e X ( - 1 0 5 % )   ! i m p o r t a n t ;  
                 / *   H i d d e n   * /  
                 t r a n s i t i o n :   t r a n s f o r m   0 . 3 s   e a s e - o u t   ! i m p o r t a n t ;  
                 p a d d i n g - t o p :   5 r e m   ! i m p o r t a n t ;  
                 b o r d e r - r i g h t :   1 p x   s o l i d   # 3 3 4 1 5 5   ! i m p o r t a n t ;  
                 b o x - s h a d o w :   1 0 p x   0   3 0 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 5 )   ! i m p o r t a n t ;  
                 d i s p l a y :   f l e x   ! i m p o r t a n t ;  
                 f l e x - d i r e c t i o n :   c o l u m n   ! i m p o r t a n t ;  
         }  
  
         . s i d e b a r . s h o w - m o b i l e   {  
                 t r a n s f o r m :   t r a n s l a t e X ( 0 )   ! i m p o r t a n t ;  
                 / *   V i s i b l e   * /  
         }  
  
         / *   H i d e   t h e   i n t e r n a l   b u t t o n   i f   r e f e r e n c e d   i n c o r r e c t l y ,   r e l y i n g   o n   f i x e d   o n e   * /  
         . s i d e b a r   . b t n - t o g g l e - s i d e b a r   {  
                 d i s p l a y :   n o n e   ! i m p o r t a n t ;  
         }  
 }  
 / *   - - -   N E W   T O G G L E   B U T T O N   S T Y L E S   ( I n t e g r a t e d   i n   H e a d e r )   - - -   * /  
  
 . b t n - t o g g l e - s i d e b a r   {  
         b a c k g r o u n d :   t r a n s p a r e n t ;  
         b o r d e r :   n o n e ;  
         c o l o r :   v a r ( - - t e x t - m u t e d ) ;  
         f o n t - s i z e :   1 . 4 r e m ;  
         / *   S l i g h t l y   l a r g e r   f o r   t o u c h   * /  
         c u r s o r :   p o i n t e r ;  
         d i s p l a y :   f l e x ;  
         a l i g n - i t e m s :   c e n t e r ;  
         j u s t i f y - c o n t e n t :   c e n t e r ;  
         p a d d i n g :   0 . 5 r e m ;  
         b o r d e r - r a d i u s :   8 p x ;  
         t r a n s i t i o n :   a l l   0 . 2 s ;  
         / *   R e s e t   f i x e d   p o s i t i o n i n g   f r o m   p r e v i o u s   h a c k s   * /  
         p o s i t i o n :   s t a t i c   ! i m p o r t a n t ;  
         z - i n d e x :   a u t o   ! i m p o r t a n t ;  
         w i d t h :   a u t o   ! i m p o r t a n t ;  
         h e i g h t :   a u t o   ! i m p o r t a n t ;  
         b o x - s h a d o w :   n o n e   ! i m p o r t a n t ;  
 }  
  
 . b t n - t o g g l e - s i d e b a r : h o v e r   {  
         b a c k g r o u n d - c o l o r :   r g b a ( 2 5 5 ,   2 5 5 ,   2 5 5 ,   0 . 0 5 ) ;  
         c o l o r :   v a r ( - - p r i m a r y ) ;  
 }  
  
 / *   M o b i l e   S p e c i f i c s   * /  
 @ m e d i a   ( m a x - w i d t h :   7 6 8 p x )   {  
         . b t n - t o g g l e - s i d e b a r   {  
                 d i s p l a y :   f l e x   ! i m p o r t a n t ;  
                 / *   E n s u r e   v i s i b l e   o n   m o b i l e   * /  
         }  
  
         . t o p b a r   {  
                 p a d d i n g - l e f t :   1 r e m   ! i m p o r t a n t ;  
                 / *   R e s e t   p a d d i n g   s i n c e   b u t t o n   i s   i n s i d e   * /  
         }  
 }  
  
 / *   D e s k t o p   S p e c i f i c s   ( C o l l a p s e   L o g i c )   * /  
 @ m e d i a   ( m i n - w i d t h :   7 6 9 p x )   {  
  
         / *   O n   d e s k t o p ,   w e   m i g h t   w a n t   t o   h i d e   t h i s   h e a d e r   b u t t o n   i f   w e   w a n t   t h e   c o l l a p s e   b u t t o n    
               t o   b e   i n s i d e   t h e   s i d e b a r   ( l i k e   b e f o r e ) ,   O R   w e   k e e p   i t   i n   h e a d e r   t o   c o n t r o l   s i d e b a r .  
                
               U s e r   s a i d :   " o n l y   a p p e a r s   o n   l a r g e r   d e v i c e s "   ( p r e v i o u s   c o n t e x t ) .  
               L e t ' s   k e e p   i t   v i s i b l e   o n   d e s k t o p   t o o ,   a c t i n g   a s   t h e   c o l l a p s e   t r i g g e r .  
         * /  
         . b t n - t o g g l e - s i d e b a r   {  
                 d i s p l a y :   f l e x ;  
                 m a r g i n - r i g h t :   0 . 5 r e m ;  
         }  
 }  
 