/**
 * AbsenKu Enterprise Design System v4.0
 * Unified Mobile-First UI — Premium Quality
 * Inspired by: Shopee, Gojek, Grab, Google, Apple Human Interface
 * 
 * TARGET: 390px (Mobile) → Tablet → Desktop
 * Philosophy: Touch-first. Battery-conscious. Platform-respectful.
 */

:root {
    /* ==========================================
       COLOR SYSTEM - Unified Blue Identity
       ========================================== */
    
    /* Primary - Single brand across all roles */
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #60A5FA;
    --primary-subtle: rgba(59, 130, 246, 0.08);
    --primary-muted: rgba(59, 130, 246, 0.12);
    
    /* Secondary */
    --secondary: #6366F1;
    --secondary-subtle: rgba(99, 102, 241, 0.08);
    
    /* Semantic Colors */
    --success: #10B981;
    --success-dark: #059669;
    --success-light: #34D399;
    --success-subtle: rgba(16, 185, 129, 0.10);
    
    --warning: #F59E0B;
    --warning-dark: #D97706;
    --warning-light: #FBBF24;
    --warning-subtle: rgba(245, 158, 11, 0.10);
    
    --error: #EF4444;
    --error-dark: #DC2626;
    --error-light: #F87171;
    --error-subtle: rgba(239, 68, 68, 0.10);
    
    --info: #0EA5E9;
    --info-subtle: rgba(14, 165, 233, 0.08);
    
    /* Neutral - Slate palette */
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;
    
    /* Backgrounds */
    --bg-base: #F1F5F9;
    --bg-surface: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-overlay: rgba(15, 23, 42, 0.50);
    
    /* Text */
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --text-tertiary: #94A3B8;
    --text-disabled: #CBD5E1;
    --text-inverse: #FFFFFF;
    
    /* Border */
    --border-default: #E2E8F0;
    --border-hover: #CBD5E1;
    --border-focus: #3B82F6;
    --border-subtle: #F1F5F9;

    /* ==========================================
       SHADOW SYSTEM - iOS-inspired
       ========================================== */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -1px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(15, 23, 42, 0.18);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

    /* ==========================================
       SPACING - 8pt Grid System
       ========================================== */
    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* ==========================================
       TYPOGRAPHY - System Fonts
       ========================================== */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, Consolas, monospace;
    
    /* Font Sizes */
    --text-display: 32px;
    --text-h1: 28px;
    --text-h2: 24px;
    --text-h3: 20px;
    --text-title: 18px;
    --text-body-lg: 16px;
    --text-body: 14px;
    --text-sm: 13px;
    --text-xs: 12px;
    --text-caption: 11px;

    /* ==========================================
       BORDER RADIUS - Modern Rounded
       ========================================== */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-3xl: 32px;
    --radius-full: 9999px;

    /* ==========================================
       LAYOUT
       ========================================== */
    --header-height: 60px;
    --bottom-nav-height: 72px;
    --container-max: 480px;
    --content-max: 640px;
    --sidebar-width: 260px;

    /* ==========================================
       TRANSITIONS - Fast & Responsive
       ========================================== */
    --transition-fast: 120ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* ==========================================
       Z-INDEX
       ========================================== */
    --z-header: 100;
    --z-dropdown: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;
}

/* ==========================================
   CSS RESET & BASE
   ========================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-body);
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-base);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background-color: var(--primary-subtle);
    color: var(--primary-dark);
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

/* ==========================================
   SCROLLBAR - Modern & Thin
   ========================================== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ==========================================
   APP CONTAINER - Phone-frame Style
   ========================================== */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    width: 100%;
    max-width: var(--container-max);
    min-height: 100vh;
    background-color: var(--bg-surface);
    margin: 0 auto;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    flex: 1;
}

@media (min-width: 768px) {
    .app-shell { background: var(--bg-base); }
    .app-container {
        min-height: 100vh;
        box-shadow: 0 0 80px rgba(0, 0, 0, 0.08);
    }
}

/* ==========================================
   STICKY HEADER - Glassmorphism Effect
   ========================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 var(--space-4);
    gap: var(--space-3);
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.app-header-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.app-header-info { min-width: 0; }

.app-header-title {
    font-size: var(--text-body);
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header-sub {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: 500;
}

.app-header-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.app-header-btn:active {
    transform: scale(0.95);
    background: var(--gray-100);
    color: var(--text-primary);
}

.app-header-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.app-header-user {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    text-decoration: none;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

/* ==========================================
   PAGE CONTENT
   ========================================== */
.page-content {
    flex: 1;
    padding: var(--space-4);
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + var(--space-4));
}

@media (min-width: 768px) {
    .page-content { padding: var(--space-6); }
}

.page-section {
    margin-bottom: var(--space-6);
}

.page-section + .page-section {
    margin-top: var(--space-6);
}

/* ==========================================
   PAGE HERO - Gradient Header Card
   ========================================== */
.page-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    color: #fff;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.page-hero.compact {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.page-hero-text { flex: 1; min-width: 0; position: relative; z-index: 1; }

.page-title {
    font-size: var(--text-h3);
    font-weight: 800;
    margin: 0 0 4px;
    color: inherit;
    line-height: 1.2;
}

.page-hero.compact .page-title { font-size: var(--text-title); }

.page-subtitle {
    font-size: var(--text-sm);
    opacity: 0.9;
    margin: 0;
    font-weight: 500;
}

.page-hero-date {
    font-size: var(--text-xs);
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 500;
}

.page-hero-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.page-hero .btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    min-height: 36px;
    padding: 8px var(--space-3);
    font-size: var(--text-xs);
    backdrop-filter: blur(8px);
}

.page-hero .btn:hover {
    background: rgba(255,255,255,0.3);
}

.page-hero .btn-primary {
    background: #fff;
    color: var(--primary);
    border-color: #fff;
}

.page-hero .btn-outline {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.section-title {
    font-size: var(--text-body);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.section-title i, .section-title svg {
    font-size: 18px;
    color: var(--primary);
}

.section-link {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--primary);
    transition: color var(--transition-fast);
}

.section-link:hover { color: var(--primary-dark); }

/* ==========================================
   CARDS - Premium Card Design
   ========================================== */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.card-title {
    font-size: var(--text-body);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: var(--space-4);
}

.card-footer {
    padding: 0 var(--space-4) var(--space-4);
}

.card-pressable {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.card-pressable:active {
    transform: scale(0.99);
    box-shadow: var(--shadow-sm);
}

/* ==========================================
   STAT CARDS - Dashboard Statistics
   ========================================== */
.stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: all var(--transition-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-grid {
    display: grid;
    gap: var(--space-3);
}

@media (min-width: 640px) {
    .stat-card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
    .stat-card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
    .stat-card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .stat-card-grid.cols-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
    .stat-card-grid.cols-4-desktop { grid-template-columns: repeat(4, 1fr) !important; }
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
}

.stat-icon i, .stat-icon svg { width: 22px; height: 22px; }

.stat-icon.primary { background: var(--primary-subtle); color: var(--primary); }
.stat-icon.success { background: var(--success-subtle); color: var(--success); }
.stat-icon.warning { background: var(--warning-subtle); color: var(--warning); }
.stat-icon.error { background: var(--error-subtle); color: var(--error); }
.stat-icon.info { background: var(--info-subtle); color: var(--info); }
.stat-icon.secondary { background: var(--secondary-subtle); color: var(--secondary); }

.stat-content { flex: 1; min-width: 0; }

.stat-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

/* ==========================================
   ACTION GRID - Quick Actions
   ========================================== */
.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

.action-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    min-height: 80px;
    box-shadow: var(--shadow-xs);
    -webkit-tap-highlight-color: transparent;
}

.action-btn:active {
    transform: scale(0.97);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.action-btn:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.action-btn i {
    font-size: 24px;
    color: var(--primary);
}

.action-btn span {
    font-size: var(--text-xs);
    font-weight: 700;
    text-align: center;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* ==========================================
   LIST ITEMS - Mobile Card List
   ========================================== */
.list-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.list-item {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    min-height: 56px;
}

.list-item:last-child { border-bottom: none; }

.list-item:active {
    background: var(--gray-50);
}

.list-item:hover:not(:active) {
    background: var(--gray-50);
}

.list-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.list-icon.primary { background: var(--primary-subtle); color: var(--primary); }
.list-icon.success { background: var(--success-subtle); color: var(--success); }
.list-icon.warning { background: var(--warning-subtle); color: var(--warning); }
.list-icon.error { background: var(--error-subtle); color: var(--error); }
.list-icon.info { background: var(--info-subtle); color: var(--info); }
.list-icon.secondary { background: var(--secondary-subtle); color: var(--secondary); }

.list-content { flex: 1; min-width: 0; }

.list-title {
    font-size: var(--text-body);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-subtitle {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-meta {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.list-meta i { font-size: 12px; }

.list-end {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
    flex-shrink: 0;
}

.list-arrow {
    font-size: 16px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* ==========================================
   AVATAR - User Avatars
   ========================================== */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    text-transform: uppercase;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.avatar.sm { width: 32px; height: 32px; border-radius: var(--radius-md); font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; border-radius: var(--radius-xl); font-size: 20px; }
.avatar.xl { width: 72px; height: 72px; border-radius: var(--radius-2xl); font-size: 28px; }

/* ==========================================
   BADGES & STATUS
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-primary { background: var(--primary-subtle); color: var(--primary); }
.badge-success { background: var(--success-subtle); color: var(--success-dark); }
.badge-warning { background: var(--warning-subtle); color: var(--warning-dark); }
.badge-error { background: var(--error-subtle); color: var(--error-dark); }
.badge-info { background: var(--info-subtle); color: var(--info); }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }

/* Status Pills */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-present { background: var(--success-subtle); color: var(--success-dark); }
.status-late { background: var(--warning-subtle); color: var(--warning-dark); }
.status-absent { background: var(--error-subtle); color: var(--error-dark); }
.status-pending { background: var(--primary-subtle); color: var(--primary); }
.status-active { background: var(--success-subtle); color: var(--success-dark); }
.status-inactive { background: var(--gray-100); color: var(--gray-500); }

/* ==========================================
   BUTTONS - Touch-Optimized (min 44px)
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-sans);
    font-size: var(--text-body);
    font-weight: 600;
    line-height: 1;
    padding: 14px var(--space-4);
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg, .btn i { font-size: 18px; }

.btn-sm {
    font-size: var(--text-sm);
    padding: 10px var(--space-3);
    min-height: 40px;
    border-radius: var(--radius-md);
}

.btn-lg {
    font-size: var(--text-body-lg);
    padding: 18px var(--space-6);
    min-height: 56px;
}

.btn-block { width: 100%; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.30);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-success:hover:not(:disabled) { background: var(--success-dark); }

.btn-danger {
    background: var(--error);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover:not(:disabled) { background: var(--error-dark); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover:not(:disabled) { background: var(--primary-subtle); }

.btn-outline-danger {
    background: transparent;
    color: var(--error);
    border: 1.5px solid var(--error);
}

.btn-outline-danger:hover:not(:disabled) { background: var(--error-subtle); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--text-primary); }

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: var(--radius-lg);
}

.btn-icon.sm { width: 40px; height: 40px; }
.btn-icon.lg { width: 56px; height: 56px; }

/* ==========================================
   FORMS - Mobile-Optimized
   ========================================== */
.form-group { margin-bottom: var(--space-4); }
.form-group.col-span-2 { grid-column: 1 / -1; }

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-label .required {
    color: var(--error);
    margin-left: 2px;
}

.form-input,
.form-select,
textarea.form-input {
    width: 100%;
    padding: 14px var(--space-4);
    font-size: var(--text-body);
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1.5px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    min-height: 52px;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus,
textarea.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-subtle);
}

.form-input::placeholder { color: var(--text-tertiary); }

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

textarea.form-input { min-height: 100px; resize: vertical; line-height: 1.5; }

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--error);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-row {
    display: grid;
    gap: var(--space-3);
}

@media (min-width: 640px) {
    .form-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
    .form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ==========================================
   EMPTY STATE - Beautiful Empty State
   ========================================== */
.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-4);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    font-size: 36px;
    color: var(--primary);
}

.empty-state-title {
    font-size: var(--text-body-lg);
    font-weight: 700;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.empty-state-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.empty-state .btn {
    margin-top: var(--space-2);
}

/* ==========================================
   BOTTOM NAVIGATION - Premium Mobile Nav
   ========================================== */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-header);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-top: 1px solid var(--border-subtle);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-inner {
    height: var(--bottom-nav-height);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--space-2);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-2) var(--space-3);
    min-width: 52px;
    min-height: 48px;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i { font-size: 22px; }

.bottom-nav-item span {
    font-size: 10px;
    font-weight: 700;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    width: 32px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 var(--radius-full) var(--radius-full);
}

.bottom-nav-item:active {
    background: var(--primary-subtle);
}

.bottom-nav-item.has-notif {
    position: relative;
}

.bottom-nav-item .notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--error);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

/* FAB Container for center button */
.fab-container {
    position: relative;
    width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-center {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    text-decoration: none;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    position: absolute;
    bottom: 8px;
}

.fab-center:hover {
    transform: scale(1.05);
    color: white;
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5);
}

.fab-center:active {
    transform: scale(0.95);
}

/* ==========================================
   TOAST - Premium Toast Notifications
   ========================================== */
.toast-container {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    width: calc(100% - var(--space-8));
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--gray-900);
    color: #fff;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    box-shadow: var(--shadow-2xl);
    pointer-events: auto;
    animation: toastIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   MODAL & DIALOG - Premium Overlay
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--text-body-lg);
    font-weight: 700;
}

.modal-body {
    padding: var(--space-4);
}

.modal-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: var(--space-3);
}

.modal-footer .btn { flex: 1; }

/* ==========================================
   SKELETON LOADING - Shimmer Effect
   ========================================== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

/* ==========================================
   ALERTS - Notification Alerts
   ========================================== */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: var(--text-sm);
}

.alert i {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-success {
    background: var(--success-subtle);
    color: var(--success-dark);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: var(--error-subtle);
    color: var(--error-dark);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: var(--warning-subtle);
    color: var(--warning-dark);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: var(--info-subtle);
    color: var(--info);
    border: 1px solid rgba(14, 165, 233, 0.2);
}

/* ==========================================
   ICONS - Large Status Icons
   ========================================== */
.success-icon-lg,
.danger-icon-lg,
.info-icon-lg {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 36px;
}

.success-icon-lg {
    background: var(--success-subtle);
    color: var(--success);
}

.danger-icon-lg {
    background: var(--error-subtle);
    color: var(--error);
}

.info-icon-lg {
    background: var(--info-subtle);
    color: var(--info);
}

/* ==========================================
   PAGE HERO BACK BUTTON
   ========================================== */
.back-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    text-decoration: none;
    transition: all var(--transition-fast);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
    z-index: 2;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.back-btn:active {
    transform: scale(0.95);
}

/* ==========================================
   SEARCH BAR
   ========================================== */
.search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--gray-100);
    border: 1.5px solid transparent;
    border-radius: var(--radius-lg);
    padding: 0 var(--space-4);
    min-height: 48px;
    transition: all var(--transition-fast);
}

.search-bar:focus-within {
    background: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-subtle);
}

.search-bar i {
    color: var(--text-secondary);
    font-size: 18px;
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: var(--text-body);
    font-family: var(--font-sans);
    color: var(--text-primary);
    outline: none;
    padding: 12px 0;
}

.search-bar input::placeholder {
    color: var(--text-tertiary);
}

/* ==========================================
   FILTER BAR
   ========================================== */
.filter-bar {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.filter-bar .form-select,
.filter-bar .btn {
    min-height: 44px;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-slideUp {
    animation: slideUp 0.4s ease forwards;
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease forwards;
}

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

/* ==========================================
   CAMERA COMPONENTS
   ========================================== */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.camera-container video,
.camera-container canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.face-guide {
    width: 200px;
    height: 260px;
    border: 3px dashed rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-xl);
}

.camera-controls {
    display: flex;
    justify-content: center;
}

.selfie-preview {
    width: 120px;
    height: 160px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 3px solid var(--primary);
}

/* ==========================================
   TEXT UTILITIES
   ========================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--error); }
.text-warning { color: var(--warning); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-body); }
.text-lg { font-size: var(--text-body-lg); }
.text-xl { font-size: var(--text-title); }

/* ==========================================
   MARGIN & PADDING UTILITIES
   ========================================== */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.me-2 { margin-right: var(--space-2); }
.me-3 { margin-right: var(--space-3); }
.ms-2 { margin-left: var(--space-2); }
.ms-3 { margin-left: var(--space-3); }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

/* ==========================================
   ROW & COL UTILITIES
   ========================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: calc(var(--space-3) * -0.5);
    margin-right: calc(var(--space-3) * -0.5);
}

.col,
.col-4,
.col-6,
.col-12 {
    padding-left: calc(var(--space-3) * 0.5);
    padding-right: calc(var(--space-3) * 0.5);
}

.col { flex: 1; }
.col-4 { flex: 0 0 33.333333%; }
.col-6 { flex: 0 0 50%; }
.col-12 { flex: 0 0 100%; }

/* ==========================================
   D-FLEX UTILITIES
   ========================================== */
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-block { display: block; }
.d-none { display: none; }

.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* ==========================================
   WIDTH & HEIGHT UTILITIES
   ========================================== */
.w-100 { width: 100%; }
.w-auto { width: auto; }
.h-100 { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* ==========================================
   POSITION UTILITIES
   ========================================== */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

/* ==========================================
   OVERFLOW
   ========================================== */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }

/* ==========================================
   BORDER UTILITIES
   ========================================== */
.border { border: 1px solid var(--border-default); }
.border-0 { border: none; }
.border-bottom { border-bottom: 1px solid var(--border-subtle); }
.rounded { border-radius: var(--radius-lg); }
.rounded-lg { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ==========================================
   Z-INDEX UTILITIES
   ========================================== */
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }

/* ==========================================
   CURSOR
   ========================================== */
.cursor-pointer { cursor: pointer; }

/* ==========================================
   USER SELECT
   ========================================== */
.user-select-none {
    user-select: none;
    -webkit-user-select: none;
}

/* ==========================================
   LIST GROUP (for forms/cards)
   ========================================== */
.list-group {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-group-item {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-flush > .list-group-item {
    border-bottom: none;
}

/* ==========================================
   FORM CARD (for settings)
   ========================================== */
.form-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    padding: var(--space-5);
}

.form-card-header {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}

.form-actions {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================
   NAV TABS
   ========================================== */
.nav-tabs {
    display: flex;
    gap: var(--space-1);
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-item {
    flex-shrink: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    background: var(--gray-100);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--gray-200);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-subtle);
}

/* ==========================================
   PAGE HERO CONTENT (alternate naming)
   ========================================== */
.page-hero-content {
    flex: 1;
}

.page-hero-title {
    font-size: var(--text-h3);
    font-weight: 800;
    color: inherit;
    margin: 0 0 4px;
}

.page-hero-subtitle {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

/* ==========================================
   LIST BODY & LIST SUB (alternate naming)
   ========================================== */
.list-body {
    flex: 1;
    min-width: 0;
}

.list-sub {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.list-sub .list-meta {
    display: inline-flex;
}

/* ==========================================
   TAB CONTENT
   ========================================== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==========================================
   D-INLINE UTILITY
   ========================================== */
.d-inline {
    display: inline;
}

/* ==========================================
   MOBILE-FIRST RESPONSIVE GRID
   ========================================== */
@media (min-width: 640px) {
    .sm\:col-6 { flex: 0 0 50%; }
    .sm\:col-4 { flex: 0 0 33.333333%; }
    .sm\:col-3 { flex: 0 0 25%; }
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
    .bottom-nav,
    .app-header,
    .btn {
        display: none !important;
    }
    
    .page-content {
        padding: 0;
    }
}

.skeleton-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
}

.skeleton-card {
    padding: var(--space-4);
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
}

/* ==========================================
   TABLES - Modern Table Design
   ========================================== */
.table-container {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    background: var(--gray-50);
}

.table td {
    padding: var(--space-4);
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle);
}

.table tr:last-child td { border-bottom: none; }

.table-hover tbody tr:hover {
    background: var(--gray-50);
}

/* ==========================================
   UTILITIES
   ========================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-info { color: var(--info); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* Visibility */
.hidden { display: none; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }

@media (max-width: 639px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 640px) {
    .show-mobile-only { display: none !important; }
}

/* ==========================================
   DESKTOP LAYOUT - Sidebar
   ========================================== */
.layout-desktop {
    display: none;
}

@media (min-width: 1024px) {
    .layout-desktop {
        display: flex;
        min-height: 100vh;
    }
    
    .layout-mobile-only {
        display: none;
    }
    
    .main-desktop {
        margin-left: var(--sidebar-width);
        flex: 1;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .desktop-header {
        height: var(--header-height);
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-subtle);
        padding: 0 var(--space-6);
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        z-index: var(--z-header);
    }
    
    .sidebar {
        width: var(--sidebar-width);
        background: var(--bg-surface);
        border-right: 1px solid var(--border-subtle);
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: var(--z-header);
        overflow-y: auto;
    }
    
    .sidebar-brand {
        height: var(--header-height);
        padding: 0 var(--space-5);
        display: flex;
        align-items: center;
        gap: var(--space-3);
        border-bottom: 1px solid var(--border-subtle);
        text-decoration: none;
        flex-shrink: 0;
    }
    
    .sidebar-brand-icon {
        width: 40px;
        height: 40px;
        border-radius: var(--radius-md);
        background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        box-shadow: var(--shadow-md);
    }
    
    .sidebar-brand-text {
        font-size: var(--text-body-lg);
        font-weight: 800;
        color: var(--text-primary);
    }
    
    .sidebar-brand-sub {
        font-size: var(--text-xs);
        color: var(--text-secondary);
        font-weight: 600;
    }
    
    .sidebar-nav {
        flex: 1;
        padding: var(--space-4);
        overflow-y: auto;
    }
    
    .sidebar-section {
        margin-bottom: var(--space-5);
    }
    
    .sidebar-section-title {
        font-size: var(--text-xs);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.8px;
        color: var(--text-tertiary);
        padding: 0 var(--space-3);
        margin-bottom: var(--space-2);
    }
    
    .sidebar-link {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-3);
        border-radius: var(--radius-lg);
        text-decoration: none;
        color: var(--text-secondary);
        font-size: var(--text-sm);
        font-weight: 600;
        transition: all var(--transition-fast);
        margin-bottom: 2px;
        -webkit-tap-highlight-color: transparent;
    }
    
    .sidebar-link:hover {
        background: var(--gray-100);
        color: var(--text-primary);
    }
    
    .sidebar-link.active {
        background: var(--primary-subtle);
        color: var(--primary);
    }
    
    .sidebar-link i {
        font-size: 20px;
        width: 24px;
        text-align: center;
    }
    
    .sidebar-link .badge-count {
        margin-left: auto;
        background: var(--error);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        padding: 2px 8px;
        border-radius: var(--radius-full);
    }
    
    .desktop-content {
        flex: 1;
        padding: var(--space-6);
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-fadeIn { animation: fadeIn 0.3s ease; }
.animate-slideUp { animation: slideUp 0.3s ease; }
.animate-slideDown { animation: slideDown 0.3s ease; }
.animate-scaleIn { animation: scaleIn 0.2s ease; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Staggered animations */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* ==========================================
   MORE SHEET (Bottom Sheet Menu)
   ========================================== */
.more-sheet {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 12px);
    z-index: var(--z-modal);
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--border-subtle);
    padding: var(--space-2);
    transform: translateY(16px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    max-height: 65vh;
    overflow-y: auto;
}

.more-sheet.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.more-overlay {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal) - 1);
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    display: none;
}

.more-overlay.active {
    display: block;
}

.more-sheet-title {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-tertiary);
    padding: var(--space-2) var(--space-3);
}

.more-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: 600;
    transition: background var(--transition-fast);
}

.more-link:hover {
    background: var(--gray-100);
}

.more-link:active {
    background: var(--primary-subtle);
    color: var(--primary);
}

.more-link i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    color: var(--text-secondary);
}

.more-link:active i {
    color: var(--primary);
}

.more-link.danger {
    color: var(--error);
}

.more-link.danger i {
    color: var(--error);
}

/* ==========================================
   PRINT STYLES
   =========================================== */
@media print {
    .no-print { display: none !important; }
    
    body {
        background: white;
        color: black;
    }
    
    .card, .table-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
