/* ============================================
   Advanced Clinic Suite - Design System
   Premium Dark/Light Theme with Glassmorphism
   ============================================ */

/* --- CSS Variables (Theme Tokens) --- */
:root {
    /* Primary Palette — Teal/Medical */
    --primary: #0097A7;
    --primary-light: #00ACC1;
    --primary-dark: #00838F;
    --primary-50: #E0F7FA;
    --primary-100: #B2EBF2;
    --primary-200: #80DEEA;
    
    /* Accent */
    --accent: #00838F;
    --accent-light: #0097A7;
    --accent-dark: #006064;
    
    /* Semantic Colors */
    --success: #059669;
    --success-light: #10B981;
    --success-bg: #ECFDF5;
    --warning: #D97706;
    --warning-light: #F59E0B;
    --warning-bg: #FFFBEB;
    --danger: #DC2626;
    --danger-light: #EF4444;
    --danger-bg: #FEF2F2;
    --info: #0891B2;
    --info-light: #06B6D4;
    --info-bg: #ECFEFF;
    
    /* Neutrals */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    
    /* Layout Colors */
    --bg-body: #F0F2F5;
    --bg-sidebar: #111827; /* Deep Slate/Navy */
    --bg-sidebar-hover: rgba(255,255,255,0.08);
    --bg-sidebar-active: linear-gradient(90deg, rgba(13, 148, 136, 0.2) 0%, rgba(13, 148, 136, 0.1) 100%); /* Subtle Teal Tint */
    --bg-card: #FFFFFF;
    --bg-header: rgba(255,255,255,0.95);
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --text-sidebar: #94A3B8; /* Slate 400 */
    --text-sidebar-active: #2DD4BF; /* Teal 400 */
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    
    /* Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 65px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Fonts */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* --- Google Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

img { max-width: 100%; height: auto; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ============================================
   LAYOUT - Sidebar + Header + Content
   ============================================ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #111827; /* Fallback */
    background: linear-gradient(180deg, #111827 0%, #0F172A 100%); /* Rich Deep Slate */
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow);
    overflow: hidden;
}

.sidebar-brand {
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.2); /* Darker header */
    min-height: var(--header-height);
}

.sidebar-brand .brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #26C6DA, #00BCD4); /* Brighter Cyan/Teal */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.sidebar-brand .brand-text {
    color: white;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand .brand-text small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

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

.nav-section-title {
    color: #4DB6AC; /* Vibrant Light Teal */
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 16px 16px 8px;
    white-space: nowrap;
    opacity: 0.9;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-sidebar);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    position: relative;
    text-decoration: none;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: white;
}

.nav-link.active {
    background: var(--bg-sidebar-active);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #FFFFFF;
    border-radius: 4px 0 0 4px;
    display: none; /* Removed the sidebar line, using full highlight instead */
}

.nav-link .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* --- Header / Top Bar --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-slow);
}

.header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}
.sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.page-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.header-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.header-search input {
    width: 100%;
    padding: 9px 16px 9px 40px;
    background: var(--gray-100);
    border: 1px solid transparent;
    border-radius: 50px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.header-search input:focus {
    outline: none;
    background: white;
    border-color: var(--primary-200);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.header-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

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

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-fast);
}
.header-btn:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.header-btn .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
}
.user-dropdown:hover { background: var(--gray-100); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

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

.user-info {
    text-align: left;
}
.user-info .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}
.user-info .user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* --- Content Area --- */
.content-area {
    flex: 1;
    padding: 24px;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.content-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    list-style: none;
    margin-bottom: 4px;
}
.breadcrumb li + li::before {
    content: '›';
    margin-right: 8px;
    color: var(--gray-400);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--gray-50);
}

/* Stats Cards */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, var(--primary-50) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-card:hover::after { opacity: 1; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.primary { background: var(--primary-50); color: var(--primary); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }
.stat-icon.accent { background: #E0F7FA; color: var(--accent); }

.stat-details { flex: 1; position: relative; z-index: 1; }
.stat-details .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.stat-details .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.stat-details .stat-change {
    font-size: 12px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-family);
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 2px 6px rgba(79,70,229,0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    box-shadow: 0 4px 12px rgba(79,70,229,0.4);
    color: white;
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-light));
    color: white;
}
.btn-success:hover { box-shadow: 0 4px 12px rgba(5,150,105,0.3); color: white; }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-light));
    color: white;
}
.btn-danger:hover { box-shadow: 0 4px 12px rgba(220,38,38,0.3); color: white; }

.btn-warning {
    background: linear-gradient(135deg, var(--warning), var(--warning-light));
    color: white;
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--text-primary);
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--text-primary); }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-block { width: 100%; }

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-control:disabled, .form-control[readonly] {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger);
}
.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

.form-text {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    inset: 0;
    background: var(--gray-300);
    border-radius: 24px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.switch .slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ============================================
   TABLES
   ============================================ */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-fast);
}
.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table .patient-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table .actions {
    display: flex;
    gap: 6px;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 50px;
    white-space: nowrap;
}

.badge i { font-size: 10px; }

.badge-primary { background: var(--primary-50); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-accent { background: #E0F7FA; color: var(--accent); }
.badge-dark { background: var(--gray-200); color: var(--gray-700); }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 600; }

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--gray-200); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--gray-50);
}

.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 440px;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.toast-message { font-size: 13px; color: var(--text-secondary); }

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.tab-btn:hover { color: var(--primary); }

.tab-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ============================================
   DROPDOWN MENUS
   ============================================ */

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    min-width: 200px;
    padding: 6px;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--transition-fast);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    border-radius: 6px;
    transition: background var(--transition-fast);
    text-decoration: none;
}
.dropdown-item:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

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

/* ============================================
   PAGINATION
   ============================================ */

.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.pagination {
    display: flex;
    gap: 4px;
    list-style: none;
}

.page-item { }
.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    text-decoration: none;
}
.page-link:hover {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary-200);
}
.page-item.active .page-link {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 14px 18px;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}
.alert i { margin-top: 2px; }

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #A7F3D0; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #FECACA; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #FDE68A; }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid #A5F3FC; }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #061621 0%, #0D2137 50%, #0097A7 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0,151,167,0.3), transparent 70%);
    top: -100px;
    right: -100px;
    z-index: 0;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0,131,143,0.2), transparent 70%);
    bottom: -80px;
    left: -80px;
    z-index: 0;
}

.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand .brand-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    font-weight: 800;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(0,151,167,0.3);
}

.login-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-form .form-group { margin-bottom: 20px; }

.login-form .form-control {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 10px;
}

.login-form .btn-primary {
    padding: 12px;
    font-size: 15px;
    border-radius: 10px;
    width: 100%;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state h3 {
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ============================================
   LOADING / SKELETON
   ============================================ */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

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

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

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   UTILITIES
   ============================================ */

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.d-block { display: block; }

.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }

.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.p-0 { padding: 0; }
.p-8 { padding: 8px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.w-full { width: 100%; }
.rounded { border-radius: var(--border-radius); }

.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }

    /* Sidebar: slide-in overlay on tablet */
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    .sidebar.open { transform: translateX(0); }

    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.active { display: block; }

    /* Header adjustments */
    .main-header {
        left: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    /* Grid stacking */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }

    /* Content area padding */
    .content-area { padding: 12px; }

    /* Content header: stack vertically */
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .content-header .actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .content-header .actions .btn {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }

    /* Hide secondary header elements */
    .header-search { display: none; }
    .user-info { display: none; }

    /* Cards */
    .card-body { padding: 16px; }

    /* Table: horizontal scroll */
    .table-responsive,
    .card-body:has(.table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table {
        min-width: 600px;
    }
    .table td, .table th { 
        padding: 10px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Stat cards: compact */
    .stat-card {
        padding: 16px;
    }
    .stat-card .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 12px;
        flex-wrap: wrap;
    }

    /* Button adjustments */
    .btn-group {
        flex-wrap: wrap;
    }
    .btn { font-size: 13px; }
    .btn-lg { font-size: 14px; padding: 10px 20px; }

    /* Modal: full-width on mobile */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100vw - 20px) !important;
    }
    .modal-body { padding: 16px; }

    /* Forms */
    .form-label { font-size: 13px; }
    .form-control { font-size: 14px; }

    /* Page title */
    .content-header h1 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .login-card { padding: 20px; }

    .stat-card { padding: 12px; }
    .stat-details .stat-value { font-size: 1.15rem; }
    .stat-details .stat-label { font-size: 11px; }

    /* Content area minimal padding */
    .content-area { padding: 8px; }

    /* Card footer actions stack */
    .card-footer {
        flex-direction: column;
        gap: 8px;
    }
    .card-footer .btn { width: 100%; }

    /* Sidebar brand compact */
    .sidebar-brand { padding: 14px; }

    /* Typography scaling */
    .content-header h1 { font-size: 1.1rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.05rem; }

    /* Badge smaller */
    .badge { font-size: 10px; padding: 3px 6px; }

    /* Alert compact */
    .alert { padding: 10px 14px; font-size: 13px; }

    /* Action buttons in tables */
    .table .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Print: hide sidebar and header */
@media print {
    .sidebar, .main-header, .sidebar-overlay, .sidebar-toggle { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0 !important; }
}
