:root {
    /* Unified Purple Gradient Theme */
    --primary-color: #8c52ff;
    --primary-hover: #723be8;
    --secondary-color: #5ce1e6;
    --success-color: #06d6a0;
    --danger-color: #ef476f;
    --warning-color: #ffd166;
    
    --bg-main: #120e1f; /* Deep Purple Background */
    --bg-card: #1d1830; /* Elevated Card Background */
    --bg-sidebar: #120e1f;
    --bg-hover: #2a2342;
    
    --text-main: #ffffff;
    --text-muted: #a69bbd;
    --text-light: #ffffff;
    
    --border-color: #372e54;
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 15px 35px rgba(0,0,0,0.4);
    
    --gradient-primary: linear-gradient(135deg, #8c52ff 0%, #5ce1e6 100%);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ===================================================
   NEON LIME THEME (Sport/Energetic Dark Mode)
   =================================================== */
[data-theme="neon-lime"] {
    --primary-color: #d2f22b;
    --primary-hover: #b8d620;
    --secondary-color: #f5f5f5;
    --success-color: #06d6a0;
    --danger-color: #ef476f;
    --warning-color: #ffd166;
    
    --bg-main: #1a1a24; 
    --bg-card: #23232b; 
    --bg-sidebar: #1a1a24;
    --bg-hover: #2d2d38;
    
    --text-main: #ffffff;
    --text-muted: #909099;
    --text-light: #ffffff;
    
    --border-color: #34343d;
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 15px 35px rgba(0,0,0,0.5);
    
    --gradient-primary: linear-gradient(135deg, #d2f22b 0%, #a2c11c 100%);
}

[data-theme="neon-lime"] .btn-primary {
    color: #1a1a24 !important;
    font-weight: 800;
}

[data-theme="neon-lime"] .sidebar-header h2 i, 
[data-theme="neon-lime"] .sidebar .nav-link.active i,
[data-theme="neon-lime"] .sidebar .nav-link:hover i {
    color: var(--primary-color);
}

[data-theme="neon-lime"] .sidebar .nav-link.active {
    border-right-color: var(--primary-color);
    color: #ffffff;
}

/* ===================================================
   SIMPLE PROFESSIONAL LIGHT THEME
   =================================================== */
[data-theme="light-pro"] {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    --bg-main: #f3f4f6; 
    --bg-card: #ffffff; 
    --bg-sidebar: #ffffff;
    --bg-hover: #f1f5f9;
    
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-light: #ffffff;
    
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

[data-theme="light-pro"] .btn-primary { color: #ffffff !important; }
[data-theme="light-pro"] .sidebar { border-left: 1px solid var(--border-color); }
[data-theme="light-pro"] .topbar { 
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}
[data-theme="light-pro"] .sidebar-header h2 { color: var(--primary-color); }
[data-theme="light-pro"] table th { background: #f8fafc; color: var(--text-main); }
[data-theme="light-pro"] .nav-link { color: var(--text-muted); }
[data-theme="light-pro"] .nav-link.active, [data-theme="light-pro"] .nav-link:hover {
    background: #eff6ff;
    color: var(--primary-color);
    border-right-color: var(--primary-color);
}


/* ===================================================
   WORD 2007 (Classic Vista Aero/Luna Blue)
   =================================================== */
[data-theme="word-2007"] {
    --primary-color: #184382;
    --primary-hover: #123160;
    --secondary-color: #f1b343; /* Word 2007 Orange/Gold Accent */
    --success-color: #438f29;
    --danger-color: #b5291b;
    --warning-color: #f1b343;
    
    --bg-main: #a8c0e0; /* Dimmed Aero Light Blue */
    --bg-card: #ebf3fc; /* Dimmed White-blue cards */
    --bg-sidebar: #d5e4f5;
    --bg-hover: #c4d7ed;
    
    --text-main: #1e395b; /* Classic Word 2007 Blue Text */
    --text-muted: #536c8d;
    --text-light: #ffffff;
    
    --border-color: #8faed3;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);
    
    /* Classic Aero Glass Gradient - Slightly Dimmed */
    --gradient-primary: linear-gradient(180deg, #c4d9ef 0%, #94b9df 49%, #7298ca 50%, #8caed4 100%);
}

[data-theme="word-2007"] .btn-primary {
    background: var(--gradient-primary);
    border: 1px solid #678bba !important;
    color: #1e395b !important;
    font-weight: bold;
    text-shadow: 0 1px 0 rgba(255,255,255,0.7);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 3px rgba(0,0,0,0.1) !important;
    border-radius: 4px;
}
[data-theme="word-2007"] .btn-primary:hover {
    background: linear-gradient(180deg, #e3f0fb 0%, #c4ddf5 49%, #a2c1e8 50%, #b8d2ef 100%);
}

[data-theme="word-2007"] .sidebar {
    border-left: 1px solid var(--border-color);
    background: linear-gradient(180deg, #e3effd 0%, #c4dcf5 100%);
}

[data-theme="word-2007"] .topbar {
    background: linear-gradient(180deg, #d3e5f9 0%, #a4c9f1 49%, #82a8db 50%, #9cbde4 100%);
    border-bottom: 1px solid #678bba;
    color: #1e395b;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

[data-theme="word-2007"] .card {
    border: 1px solid #9cbce1;
    border-radius: 4px; /* Less rounded, more classic */
}

[data-theme="word-2007"] table th {
    background: linear-gradient(180deg, #ebf3fb 0%, #d2e4f7 100%);
    border-bottom: 1px solid #9cbce1;
    color: #1e395b;
}

[data-theme="word-2007"] .nav-link { color: #1e395b; font-weight: 500; }
[data-theme="word-2007"] .nav-link.active, [data-theme="word-2007"] .nav-link:hover {
    background: linear-gradient(90deg, rgba(241, 179, 67, 0.15) 0%, rgba(255, 71, 126, 0.15) 100%);
    color: #b35900;
    border-right-color: #ff477e;
}
[data-theme="word-2007"] .nav-link.active i, [data-theme="word-2007"] .nav-link:hover i {
    background: linear-gradient(135deg, #C5A059, #ff477e, #7209b7, #4cc9f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* --- Safari Theme (macOS) --- */
[data-theme="safari"] {
    --bg-main: #f5f5f7;
    --bg-card: #ffffff;
    --bg-hover: #e8e8ed;
    --primary-color: #6e6e73;
    --primary-hover: #505055;
    --secondary-color: #86868b;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --danger-color: #ff3b30;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --border-color: #d2d2d7;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 28px rgba(0,0,0,0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

[data-theme="safari"] .sidebar {
    background: rgba(245, 245, 247, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(0,0,0,0.06);
}

[data-theme="safari"] .topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

[data-theme="safari"] .card {
    border: none;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="safari"] .card:hover {
    box-shadow: var(--shadow-md);
}

[data-theme="safari"] .btn-primary {
    color: #ffffff !important;
    background: var(--primary-color);
    box-shadow: none;
    border-radius: var(--radius-sm);
}

[data-theme="safari"] .btn-primary:hover {
    background: var(--primary-hover);
}

[data-theme="safari"] .nav-link {
    color: var(--text-main);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

[data-theme="safari"] .nav-link.active, [data-theme="safari"] .nav-link:hover {
    background: rgba(110, 110, 115, 0.1);
    color: var(--primary-color);
    border-right-color: var(--primary-color);
}

[data-theme="safari"] table th {
    background: rgba(245, 245, 247, 0.6);
    color: var(--text-main);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="safari"] .form-control {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

[data-theme="safari"] .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(110, 110, 115, 0.2);
}

/* ===================================================
   DARK GLASSMORPHISM (Luxury Real Estate)
   =================================================== */
[data-theme="dark-glass"] {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #10b981;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    --bg-main: #020617; 
    --bg-card: rgba(15, 23, 42, 0.7); 
    --bg-sidebar: rgba(15, 23, 42, 0.7);
    --bg-hover: rgba(30, 41, 59, 0.8);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #ffffff;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.5);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.5);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.5);
    
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

[data-theme="dark-glass"] .sidebar,
[data-theme="dark-glass"] .topbar,
[data-theme="dark-glass"] .card,
[data-theme="dark-glass"] .timeline-content,
[data-theme="dark-glass"] .file-detail-card,
[data-theme="dark-glass"] .modal {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

[data-theme="dark-glass"] .topbar {
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark-glass"] .sidebar {
    background: rgba(15, 23, 42, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark-glass"] .card,
[data-theme="dark-glass"] .modal {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.7);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

[data-theme="dark-glass"] table th {
    background: rgba(30, 41, 59, 0.5);
    color: var(--text-main);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark-glass"] .btn-primary {
    color: #ffffff !important;
    background: var(--primary-color);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark-glass"] .nav-link.active, [data-theme="dark-glass"] .nav-link:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
    border-right-color: var(--primary-color);
}


/* ===================================================
   ISLAMIC GOLD THEME (Luxury Emerald & Gold)
   =================================================== */
[data-theme="islamic-gold"] {
    --primary-color: #d4af37;
    --primary-hover: #c5a028;
    --secondary-color: #065f46;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    
    --bg-main: #f4f7f6; 
    --bg-card: #ffffff; 
    --bg-sidebar: #064e3b;
    --bg-hover: #f1f5f9;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #ffffff;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    
    --gradient-primary: linear-gradient(135deg, #d4af37 0%, #f1c40f 100%);
}

[data-theme="islamic-gold"] body {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23d4af37' fill-opacity='0.07'%3E%3Cpath fill-rule='evenodd' d='M11 0l5 20H6l5-20zm42 0l5 20h-10l5-20zM11 21L1 31l10 10 10-10-10-10zm42 0L43 31l10 10 10-10-10-10zM26 0l5 20h-10l5-20zm42 0l5 20h-10l5-20zM26 21L16 31l10 10 10-10-10-10zm42 0L58 31l10 10 10-10-10-10zM0 11l20 5V6L0 11zm0 42l20 5v-10L0 53zm21-11l10-10-10-10-10 10 10 10zm42 0l10-10-10-10-10 10 10 10zM0 26l20 5v-10L0 26zm0 42l20 5v-10L0 68zm21-11l10-10-10-10-10 10 10 10zm42 0l10-10-10-10-10 10 10 10zM11 80l5-20H6l5 20zm42 0l5-20h-10l5 20zM11 59L1 49l10-10 10 10-10 10zm42 0L43 49l10-10 10 10-10 10zM26 80l5-20h-10l5 20zm42 0l5-20h-10l5 20zM26 59L16 49l10-10 10 10-10 10zm42 0L58 49l10-10 10 10-10 10zM80 11L60 6v10l20-5zm0 42l-20-5v10l20-5zM59 42l10 10 10-10-10-10-10 10zm-42 0l10 10 10-10-10-10-10 10zM80 26L60 21v10l20-5zm0 42l-20-21v10l20 11zM59 57l10 10 10-10-10-10-10 10zm-42 0l10 10 10-10-10-10-10 10z'/%3E%3C/g%3E%3C/svg%3E");
}

[data-theme="islamic-gold"] .sidebar,
[data-theme="islamic-gold"] .topbar,
[data-theme="islamic-gold"] .card,
[data-theme="islamic-gold"] .timeline-content,
[data-theme="islamic-gold"] .file-detail-card,
[data-theme="islamic-gold"] .modal {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

[data-theme="islamic-gold"] .topbar {
    background: #ffffff;
    border-bottom: 2px solid var(--primary-color);
    color: #1e293b;
}

[data-theme="islamic-gold"] .sidebar {
    background: #064e3b;
    border-left: 2px solid var(--primary-color);
}

[data-theme="islamic-gold"] .sidebar .nav-link {
    color: #a7f3d0;
}

[data-theme="islamic-gold"] .sidebar .nav-link.active,
[data-theme="islamic-gold"] .sidebar .nav-link:hover {
    background: rgba(212, 175, 55, 0.15);
    color: #ffffff;
}

[data-theme="islamic-gold"] .sidebar-header h2 {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

[data-theme="islamic-gold"] .nav-link {
    color: var(--text-muted);
}

[data-theme="islamic-gold"] .nav-link.active, 
[data-theme="islamic-gold"] .nav-link:hover {
    background: rgba(6, 78, 59, 0.05);
    color: #064e3b;
    border-right-color: var(--primary-color);
}

[data-theme="islamic-gold"] .btn-primary {
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

[data-theme="islamic-gold"] table th {
    background: #f8fafc;
    color: #064e3b;
    border-bottom: 2px solid var(--primary-color);
}

[data-theme="islamic-gold"] .form-control {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #1e293b;
}

[data-theme="islamic-gold"] .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

[data-theme="islamic-gold"] .status-badge {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

[data-theme="islamic-gold"] .status-completed { color: #10b981; border-color: #10b981; }
[data-theme="islamic-gold"] .status-in-progress { color: var(--primary-color); border-color: var(--primary-color); }
[data-theme="islamic-gold"] .status-pending { color: #ef4444; border-color: #ef4444; }

[data-theme="islamic-gold"] .card {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='%23d4af37' fill-opacity='0.03'%3E%3Cpath d='M30 0l5 10h-10l5-10zm0 60l5-10h-10l5 10zM0 30l10 5v-10l-10 5zm60 0l-10 5v-10l10 5z'/%3E%3C/g%3E%3C/svg%3E");
}

[data-theme="islamic-gold"] .card:hover {
    box-shadow: 0 8px 32px 0 rgba(212, 175, 55, 0.15);
    border-color: var(--primary-color);
}

/* Base Body Style */
body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Cairo', sans-serif;
    transition: var(--transition);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* Premium Enhancements */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

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

.sidebar {
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    box-shadow: 2px 0 10px rgba(0,0,0,0.02);
}

.topbar {
    background: #302f2f; /* Keep Topbar dark */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light); /* Light text for topbar */
}

/* Timeline UI (Consolidated) */
.timeline {
    position: relative;
    padding: 20px 0;
    margin: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 18px;
    width: 2px;
    background: var(--border-color);
    border-radius: 3px;
}

/* Primary Button Gradient */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(140, 82, 255, 0.4);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(140, 82, 255, 0.6);
}

.timeline-dot {
    position: absolute;
    right: 7px;
    top: 5px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--border-color);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #fff;
    transition: var(--transition);
}

.timeline-step.completed .timeline-dot {
    background: var(--success-color);
    border-color: var(--success-color);
}

.timeline-step.in-progress .timeline-dot {
    background: var(--warning-color);
    border-color: var(--warning-color);
    box-shadow: 0 0 0 4px rgba(248, 150, 30, 0.2);
    animation: pulse-warning 2s infinite;
}

.timeline-step.pending .timeline-dot {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

@keyframes pulse-warning {
    0% { box-shadow: 0 0 0 0px rgba(248, 150, 30, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(248, 150, 30, 0); }
    100% { box-shadow: 0 0 0 0px rgba(248, 150, 30, 0); }
}

.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.timeline-content:hover {
    transform: translateX(-5px);
    box-shadow: var(--shadow-md);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 8px;
}

.timeline-title {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-main);
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 4px;
}

.timeline-notes {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

/* Sub-steps */
.sub-steps-container {
    margin-top: 15px;
    padding-right: 20px;
    border-right: 2px solid var(--border-color);
    display: none;
}

.sub-steps-container.open {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sub-step {
    position: relative;
    margin-bottom: 15px;
    padding-right: 20px;
}

.sub-step::before {
    content: '';
    position: absolute;
    right: -21px;
    top: 10px;
    width: 10px;
    height: 2px;
    background: var(--border-color);
}

.sub-step-dot {
    position: absolute;
    right: -5px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
}

.sub-step.completed .sub-step-dot { background: var(--success-color); }
.sub-step.in-progress .sub-step-dot { background: var(--warning-color); }
.sub-step.pending .sub-step-dot { background: var(--danger-color); }

.sub-step-content {
    background: var(--bg-hover);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.toggle-sub-steps {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    margin-top: 10px;
}

.toggle-sub-steps i {
    transition: transform 0.3s;
}

.toggle-sub-steps.open i {
    transform: rotate(180deg);
}

.timeline-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}
.status-completed { background: rgba(16, 124, 16, 0.1); color: var(--success-color); }
.status-in-progress { background: rgba(255, 185, 0, 0.1); color: var(--warning-color); }
.status-pending { background: rgba(164, 38, 44, 0.1); color: var(--danger-color); }

.btn-icon.view { background: rgba(16, 124, 16, 0.1); color: var(--success-color); border: 1px solid rgba(16, 124, 16, 0.2); }
.btn-icon.edit { background: rgba(0, 90, 158, 0.1); color: var(--primary-color); border: 1px solid rgba(0, 90, 158, 0.2); }
.btn-icon.delete { background: rgba(164, 38, 44, 0.1); color: var(--danger-color); border: 1px solid rgba(164, 38, 44, 0.2); }
.btn-icon:hover { transform: scale(1.05); background: rgba(0,0,0,0.05); }

/* File Explorer Section */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-top: 15px; }
.file-detail-card { 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-md); 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-align: center; 
    transition: var(--transition); 
}
.file-detail-card:hover { 
    transform: translateY(-4px); 
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.file-num-badge { 
    background: var(--primary-color); 
    color: #fff; 
    width: 50px; 
    height: 50px; 
    border-radius: 8px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 1.2rem; 
    font-weight: 800; 
    margin-bottom: 15px; 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    zoom: 80%;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    transition: var(--transition);
}

/* App Container Layout */
.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    z-index: 200;
    transition: right 0.3s ease, var(--transition);
    flex-shrink: 0;
}

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

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.3rem;
    padding: 4px;
    border-radius: 50%;
    transition: var(--transition);
}
.sidebar-close-btn:hover { background: var(--bg-hover); color: var(--danger-color); }

.mobile-menu-btn {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 1.1rem;
    transition: var(--transition);
    flex-shrink: 0;
}
.mobile-menu-btn i {
    background: linear-gradient(135deg, #ff007f, #7f00ff, #00f0ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}
.mobile-menu-btn:hover { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active { opacity: 1; }

@media (max-width: 768px) {
    body {
        zoom: 100% !important;
        overflow: auto !important;
        height: auto !important;
    }
    .sidebar-overlay { display: none; opacity: 0; pointer-events: none; }
    .sidebar-overlay.active { display: block; opacity: 1; pointer-events: all; }
    .mobile-menu-btn { display: flex !important; margin-left: 10px; }
    .sidebar-close-btn { display: flex; }
    .sidebar { display: flex; }

    .app-container { flex-direction: column; display: block; overflow: auto; }
    .main-content {
        height: auto;
        min-height: calc(100vh - 60px);
        min-height: calc(100dvh - 60px);
        margin-bottom: 0;
        padding-bottom: 100px;
        flex: none;
        overflow: visible;
    }
    .view-container {
        padding: 12px;
        overflow: visible;
    }
    .topbar { 
        height: 60px; 
        padding: 0 10px; 
        padding-top: constant(safe-area-inset-top);
        padding-top: env(safe-area-inset-top);
        gap: 8px;
    }
    .search-bar { 
        flex: 1; 
        width: auto; 
        max-width: 200px;
        background: var(--bg-hover);
        padding: 5px 10px;
        border-radius: 12px;
    }
    .search-bar input { font-size: 16px; }
    .topbar-actions { gap: 8px; }
    .theme-toggle { width: 34px; height: 34px; font-size: 1rem; }
    .role-badge-topbar { display: none; } /* Hide role badge on very small screens to save space */
    .avatar { width: 34px; height: 34px; font-size: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .page-header h1 { font-size: 1.4rem; }
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    margin: 4px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    border-right: 4px solid transparent;
    border-radius: var(--radius-sm);
}

.nav-link i {
    width: 20px;
    font-size: 1.1rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.nav-link:hover {
    background: linear-gradient(90deg, rgba(255, 71, 126, 0.08) 0%, rgba(76, 201, 240, 0.08) 100%);
    color: #ff477e;
    transform: translateX(-4px);
}

.nav-link:hover i {
    transform: scale(1.15) rotate(5deg);
    background: linear-gradient(135deg, #C5A059, #ff477e, #7209b7, #4cc9f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(255, 71, 126, 0.12) 0%, rgba(76, 201, 240, 0.12) 100%);
    color: #7209b7;
    border-right-color: #ff477e;
    font-weight: 700;
    box-shadow: inset -4px 0 12px rgba(197, 160, 89, 0.06);
}

.nav-link.active i {
    background: linear-gradient(135deg, #C5A059, #ff477e, #7209b7, #4cc9f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: 70px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    z-index: 5;
    transition: var(--transition);
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 16px;
    width: 350px;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.search-bar i {
    color: var(--text-muted);
    margin-left: 12px;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--text-main);
    font-size: 16px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--bg-hover);
    color: var(--primary-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: var(--text-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.topbar-logo-avatar:hover {
    transform: scale(1.08);
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 12px rgba(188, 150, 85, 0.55) !important;
}

/* View Container */
.view-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* General Layouts for Views */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.75rem;
    color: var(--text-main);
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid transparent;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn:active {
    transform: scale(0.96) translateY(1px);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 30%, transparent);
    border: 1px solid color-mix(in srgb, white 20%, transparent);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--primary-color) 45%, transparent);
}

.btn-secondary {
    background-color: var(--bg-hover);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--danger-color) 30%, transparent);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--danger-color) 45%, transparent);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--success-color) 30%, transparent);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--success-color) 45%, transparent);
}

.btn-back-highlight {
    background-color: #ff0000 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.4);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); box-shadow: 0 4px 20px rgba(255, 0, 0, 0.6); }
    100% { transform: scale(1); }
}

.btn-back-highlight:hover {
    background-color: #cc0000 !important;
    transform: translateY(-2px) scale(1.05) !important;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

/* Grid System */
.grid {
    display: grid;
    gap: 20px;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

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

/* Dashboard Specifics */
.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.1);
}

.stat-details h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-details p {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Tables */
.table-container {
    overflow-x: auto;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    display: block;
}

table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

th { white-space: nowrap; font-weight: 700; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; background-color: rgba(0, 0, 0, 0.03); }
td { white-space: nowrap; vertical-align: middle; }

/* Removed Dark Mode Override */

tr:hover {
    background-color: var(--bg-hover);
}

td {
    color: var(--text-main);
    font-weight: 500;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

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

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

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-main);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

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

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-success { background-color: rgba(76, 201, 240, 0.1); color: var(--success-color); }
.badge-warning { background-color: rgba(248, 150, 30, 0.1); color: var(--warning-color); }
.badge-danger { background-color: rgba(247, 37, 133, 0.1); color: var(--danger-color); }

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    min-width: 250px;
    background-color: var(--bg-card);
    color: var(--text-main);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    border-right: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

.toast.success { border-right-color: var(--success-color); }
.toast.error { border-right-color: var(--danger-color); }

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

/* File Upload Display */
.image-preview-container {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}

.image-preview {
    width: 120px;
    height: 120px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background-size: cover;
    background-position: center;
}

.image-preview i {
    font-size: 2rem;
    color: var(--text-muted);
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(67, 97, 238, 0.3) 0%, transparent 70%);
    top: -150px;
    right: -150px;
    border-radius: 50%;
    animation: floatOrb 8s ease-in-out infinite;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(247, 37, 133, 0.2) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    animation: floatOrb 10s ease-in-out infinite reverse;
}

@keyframes floatOrb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -30px) scale(1.1); }
}

.login-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 50px 40px;
    width: 420px;
    max-width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    z-index: 1;
    animation: cardEntrance 0.6s ease-out;
}

@keyframes cardEntrance {
    from { transform: translateY(30px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.login-logo {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo .icon-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4361ee, #7209b7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    box-shadow: 0 10px 30px rgba(67, 97, 238, 0.4);
}

.login-logo .icon-circle i {
    font-size: 2.2rem;
    color: #fff;
}

.login-logo h1 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.login-logo p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 22px;
    position: relative;
}

.login-form .form-group label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: block;
}

.login-form .login-input {
    width: 100%;
    padding: 14px 18px 14px 45px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #ffffff;
    font-size: 1rem;
    transition: all 0.3s ease;
    direction: ltr;
    text-align: left;
}

.login-form .login-input:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.25);
    background: rgba(255, 255, 255, 0.1);
}

.login-form .login-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-form .input-icon {
    position: absolute;
    left: 15px;
    bottom: 15px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 1.1rem;
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #4361ee, #7209b7);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    font-family: 'Cairo', sans-serif;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(67, 97, 238, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.login-error {
    background: rgba(247, 37, 133, 0.15);
    border: 1px solid rgba(247, 37, 133, 0.3);
    color: #f72585;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: none;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* ===== Client Action Buttons ===== */
.client-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-icon:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-icon.view { background-color: rgba(67, 97, 238, 0.12); color: var(--primary-color); }
.btn-icon.view:hover { background-color: var(--primary-color); color: #fff; }
.btn-icon.edit { background-color: rgba(248, 150, 30, 0.12); color: var(--warning-color); }
.btn-icon.edit:hover { background-color: var(--warning-color); color: #fff; }
.btn-icon.delete { background-color: rgba(247, 37, 133, 0.12); color: var(--danger-color); }
.btn-icon.delete:hover { background-color: var(--danger-color); color: #fff; }

/* ===== ID Card Display in Details ===== */
.id-card-section {
    margin-top: 24px;
}

.id-card-section h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-weight: 700;
}

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

.id-card-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-main);
    transition: var(--transition);
}

.id-card-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.id-card-label {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(67, 97, 238, 0.06);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.id-card-item img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    display: block;
    cursor: pointer;
    padding: 8px;
    background: var(--bg-card);
}

.id-card-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    background: var(--bg-card);
}

.id-card-placeholder i {
    font-size: 2.5rem;
    opacity: 0.3;
}

.id-card-placeholder span {
    font-size: 0.85rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    .id-cards-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        right: -260px;
        top: 0;
        height: 100vh;
        height: 100dvh;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        z-index: 205; /* Must be higher than sidebar-overlay (199) */
    }
    .sidebar.open {
        right: 0;
    }
    .login-card {
        padding: 35px 25px;
    }
}

/* ===================================================
   STATS GRID (6-col for dashboard)
=================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

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

/* ===================================================
   DASHBOARD — Calendar + Sidebar layout
=================================================== */

/* Main Dashboard Layout */
.dash-main-grid { 
    display: grid; 
    grid-template-columns: 3fr 1fr; 
    gap: 20px; 
}
@media (max-width: 1024px) {
    .dash-main-grid { grid-template-columns: 1fr; }
}

/* ===================================================
   MODULE-SPECIFIC THEMES (COLOR CODING)
   Overriding --primary-color applies the color to all buttons & icons!
=================================================== */

/* Shared Table & Header Theme using the overridden primary color */
.view-container[class*="page-"] th {
    color: var(--primary-color) !important;
}
.view-container[class*="page-"] .page-header h1 {
    color: var(--primary-color);
}

/* Make secondary buttons inherit the page's color */
.view-container[class*="page-"] .btn-secondary {
    border: 1px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
    background-color: transparent !important;
}
.view-container[class*="page-"] .btn-secondary:hover {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

/* Make view icons inherit the page's color */
.view-container[class*="page-"] .btn-icon.view {
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent) !important;
    color: var(--primary-color) !important;
}
.view-container[class*="page-"] .btn-icon.view:hover {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

/* Clients (Blue) */
.page-clients { --primary-color: #4361ee; --primary-hover: #3a56d4; }
.page-clients th { background-color: rgba(67, 97, 238, 0.1) !important; border-bottom: 2px solid rgba(67, 97, 238, 0.3) !important; }

/* Cases (Orange) */
.page-cases { --primary-color: #f77f00; --primary-hover: #e07300; }
.page-cases th { background-color: rgba(247, 127, 0, 0.1) !important; border-bottom: 2px solid rgba(247, 127, 0, 0.3) !important; }

/* Tasks (Yellow/Gold) */
.page-tasks { --primary-color: #d49a00; --primary-hover: #b88500; }
.page-tasks th { background-color: rgba(252, 191, 73, 0.15) !important; border-bottom: 2px solid rgba(252, 191, 73, 0.3) !important; }

/* Finances (Green) */
.page-finances { --primary-color: #05a077; --primary-hover: #048a66; }
.page-finances th { background-color: rgba(6, 214, 160, 0.15) !important; border-bottom: 2px solid rgba(6, 214, 160, 0.3) !important; }

/* Documents (Red) */
.page-documents { --primary-color: #e63946; --primary-hover: #d62828; }
.page-documents th { background-color: rgba(230, 57, 70, 0.1) !important; border-bottom: 2px solid rgba(230, 57, 70, 0.3) !important; }

/* Sessions (Black / Dark Slate) */
.page-sessions { --primary-color: #2b2d42; --primary-hover: #1a1b29; }
.page-sessions th { background-color: rgba(43, 45, 66, 0.1) !important; border-bottom: 2px solid rgba(43, 45, 66, 0.3) !important; }

/* Government Work (Brown) */
.page-government-work { --primary-color: #bc6c25; --primary-hover: #9c5c1d; }
.page-government-work th { background-color: rgba(188, 108, 37, 0.1) !important; border-bottom: 2px solid rgba(188, 108, 37, 0.3) !important; }

/* Real Estate (Purple) */
.page-real-estate { --primary-color: #7209b7; --primary-hover: #560bad; }
.page-real-estate th { background-color: rgba(114, 9, 183, 0.1) !important; border-bottom: 2px solid rgba(114, 9, 183, 0.3) !important; }

/* Reports (Teal) */
.page-reports { --primary-color: #457b9d; --primary-hover: #1d3557; }
.page-reports th { background-color: rgba(69, 123, 157, 0.1) !important; border-bottom: 2px solid rgba(69, 123, 157, 0.3) !important; }

/* Dark mode overrides for these colors */
[data-theme="neon-lime"] th[class*="page-"],
[data-theme="neon-lime"] .page-header h1,
body.dark-mode th[class*="page-"],
body.dark-mode .page-header h1 {
    filter: brightness(1.5);
}


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

.cal-nav-btn {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-main);
    transition: var(--transition);
    font-size: 1rem;
}
.cal-nav-btn:hover { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 4px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    min-height: 48px;
}

.cal-cell:hover { background: var(--bg-hover); }
.cal-cell.empty { cursor: default; }
.cal-cell.today { background: rgba(67,97,238,.1); border-color: var(--primary-color); }
.cal-cell.today .cal-day-num { color: var(--primary-color); font-weight:800; }
.cal-cell.has-events { cursor: pointer; }
.cal-cell.has-events:hover { background: var(--bg-hover); transform: scale(1.05); }

.cal-day-num { font-size: .85rem; font-weight: 600; }
.cal-dots { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.session-dot { background: var(--primary-color); }
.task-dot { background: var(--warning-color); }

.calendar-day-details {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    animation: slideDown .3s ease;
}

@keyframes slideDown {
    from { opacity:0; transform: translateY(-10px); }
    to { opacity:1; transform: translateY(0); }
}

.day-detail-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: var(--transition);
}
.day-detail-item:hover { transform: translateX(-3px); }
.session-item { background: rgba(67,97,238,.07); border-right: 3px solid var(--primary-color); }
.task-item { background: rgba(248,150,30,.07); border-right: 3px solid var(--warning-color); }

.dash-event-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}
.dash-event-item:hover { background: var(--bg-hover); transform: translateX(-3px); }
.dash-event-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink:0; }

/* ===================================================
   ATTACHMENTS SYSTEM
=================================================== */
.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.attachment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.attachment-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.attachment-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
    display: block;
}

.attachment-icon.pdf { color: #f40f02; }
.attachment-icon.word { color: #2b579a; }
.attachment-icon.image { color: #4361ee; }

.attachment-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.attachment-date {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.attachment-actions {
    position: absolute;
    top: 5px;
    left: 5px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.attachment-card:hover .attachment-actions {
    opacity: 1;
}

.attachment-btn-small {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-main);
}

.attachment-btn-small:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.attachment-btn-small.delete:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.attachment-preview-img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.btn-upload-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.btn-upload-wrapper input[type=file] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.sessions-agenda-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -8px;
}

.sessions-agenda-table th {
    padding: 12px 20px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border: none;
    background: transparent;
}

.sessions-agenda-table tr {
    transition: all 0.3s ease;
}

.sessions-agenda-table tbody tr {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
}

.sessions-agenda-table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--bg-hover);
}

.sessions-agenda-table td {
    padding: 16px 20px;
    border: none;
    color: var(--text-main);
    vertical-align: middle;
}

.sessions-agenda-table td:first-child {
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    border-right: 4px solid var(--primary-color);
}

.sessions-agenda-table td:last-child {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

.session-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.session-stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.session-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.session-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.session-stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.session-stat-info p {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 4px 0 0;
    color: var(--text-main);
}
.tab-bar {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-weight: 600;
}
.tab-btn:hover { color: var(--primary-color); background: var(--bg-hover); }
.tab-btn.active-tab { color: var(--primary-color); border-bottom-color: var(--primary-color); }

/* ===================================================
   ACCORDION / TIMELINE (Sessions)
=================================================== */
.sessions-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    padding-right: 40px;
    margin-top: 10px;
}

.sessions-timeline::before {
    content: '';
    position: absolute;
    right: 11px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-color), var(--border-color) 70%, transparent);
    z-index: 1;
}

.timeline-accordion-item {
    position: relative;
    z-index: 2;
}

.timeline-dot {
    position: absolute;
    right: -33px;
    top: 20px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--border-color);
    z-index: 5;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 0 0 rgba(67, 97, 238, 0);
}

.timeline-accordion-item.active .timeline-dot {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.15);
    transform: scale(1.1);
}

.timeline-accordion-item.next-session .timeline-dot {
    background: var(--success-color);
    border-color: var(--success-color);
    animation: pulse-success 2s infinite;
}

@keyframes pulse-success {
    0% { box-shadow: 0 0 0 0 rgba(76, 201, 240, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(76, 201, 240, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 201, 240, 0); }
}

.timeline-accordion-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.timeline-accordion-header::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--border-color);
    transition: all 0.3s ease;
}

.timeline-accordion-item.active .timeline-accordion-header::before {
    background: var(--primary-color);
}

.timeline-accordion-item.next-session .timeline-accordion-header::before {
    background: var(--success-color);
}

.timeline-accordion-header:hover {
    border-color: var(--primary-color);
    background: var(--bg-hover);
    transform: translateX(-5px);
    box-shadow: var(--shadow-md);
}

.timeline-accordion-item.active .timeline-accordion-header {
    border-color: var(--primary-color);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background: rgba(67, 97, 238, 0.03);
}

.timeline-date-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-date-info strong {
    font-size: 1.05rem;
    color: var(--text-main);
    transition: color 0.3s ease;
}

.timeline-accordion-item.active .timeline-date-info strong {
    color: var(--primary-color);
}

.timeline-date-info span {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 8px;
}

.timeline-badge-next {
    background: var(--success-color);
    color: #fff;
}

.accordion-chevron {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-accordion-item.active .accordion-chevron {
    transform: rotate(180deg);
    color: var(--primary-color);
}

.timeline-accordion-body {
    background: var(--bg-card);
    border: 1px solid var(--primary-color);
    border-top: none;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-accordion-item.active .timeline-accordion-body {
    max-height: 800px;
}

.timeline-content-inner {
    padding: 20px;
    background: linear-gradient(to bottom, rgba(67, 97, 238, 0.02), transparent);
    line-height: 1.6;
    position: relative;
}

.timeline-actions {
    position: absolute;
    left: 20px;
    top: 20px;
    display: flex;
    gap: 8px;
}

.timeline-content-inner p {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.timeline-content-inner i {
    width: 20px;
    text-align: center;
    margin-top: 4px;
    color: var(--primary-color);
}

.timeline-content-inner strong {
    color: var(--text-muted);
    font-weight: 700;
    min-width: 90px;
}

/* ===================================================
   CASE DETAIL GRID
=================================================== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
}
.detail-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.detail-value { font-size: .95rem; font-weight: 600; color: var(--text-main); }

/* ===================================================
   CLIENT DETAIL — Case Cards
=================================================== */
.case-card-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
}
.case-card-item:hover { border-color: var(--primary-color); box-shadow: var(--shadow-md); transform: translateY(-2px); }

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

.case-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.case-info-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: .9rem;
}

.case-fee-summary {
    display: flex;
    gap: 24px;
    padding: 10px 16px;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
}

/* ===================================================
   EXTERNAL WORKS
=================================================== */
.ext-categories {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ext-cat-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-card);
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: .85rem;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}
.ext-cat-btn:hover, .ext-cat-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.ext-works-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ext-work-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    transition: var(--transition);
}
.ext-work-card:hover { border-color: var(--primary-color); box-shadow: var(--shadow-md); }
.ext-work-card.ext-work-done { opacity: .6; }

.ext-work-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.ext-work-info { flex: 1; min-width: 0; }

/* ===================================================
   DOCUMENTS / FILE SYSTEM
=================================================== */
.folder-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--bg-card);
    transition: var(--transition);
}
.folder-card:hover { border-color: var(--warning-color); }

.folder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    background: var(--bg-hover);
    transition: var(--transition);
}
.folder-header:hover { background: rgba(248,150,30,.08); }

.folder-body {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.sub-folder {
    margin-bottom: 20px;
}

.sub-folder-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: .9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-color);
}

.docs-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.doc-thumb {
    width: 110px;
    height: 110px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: var(--bg-main);
    transition: var(--transition);
    gap: 6px;
}
.doc-thumb:hover { border-color: var(--primary-color); box-shadow: var(--shadow-md); transform: scale(1.03); }
.doc-thumb img { width: 100%; height: 80px; object-fit: cover; }
.doc-thumb span { font-size: .75rem; text-align: center; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }

.add-doc-btn {
    border: 2px dashed var(--border-color);
    background: transparent;
    cursor: pointer;
}
.add-doc-btn:hover { border-color: var(--primary-color); background: rgba(67,97,238,.05); }

.doc-delete-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(247,37,133,.9);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}
.doc-thumb:hover .doc-delete-btn { opacity: 1; }
.doc-icon-placeholder { display:flex;align-items:center;justify-content:center;width:100%;height:80px; }

.doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 6px;
}
.doc-item:hover { background: var(--bg-hover); border-color: var(--primary-color); }

/* ===================================================
   BADGE extra variants
=================================================== */
.badge-warning {
    background: rgba(248,150,30,.15);
    color: var(--warning-color);
    border: 1px solid rgba(248,150,30,.3);
}

/* ===================================================
   IMPROVED RESPONSIVE
=================================================== */
@media (max-width: 1024px) {
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .case-fee-summary { gap: 12px; }
}

@media (max-width: 768px) {
    .main-content { padding: 12px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .tab-bar { flex-wrap: wrap; }
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; gap: 12px; }
    .case-card-body { flex-direction: column; align-items: flex-start; }
    .case-fee-summary { width: 100%; justify-content: space-between; }
    .ext-categories { gap: 6px; }
    .ext-cat-btn { padding: 6px 12px; font-size: .8rem; }
    .docs-grid { gap: 8px; }
    .doc-thumb { width: 90px; height: 90px; }
    .dash-main-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    table { font-size: .85rem; }
    .modal-container { padding: 12px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .calendar-weekdays span { font-size: .65rem; }
    .cal-day-num { font-size: .75rem; }
}

/* File System Styles */
.fs-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); 
    gap: 20px; 
    padding: 10px;
}
.fs-item { 
    text-align: center; 
    cursor: pointer; 
    padding: 15px 10px; 
    border-radius: var(--radius-md); 
    transition: var(--transition); 
    border: 1px solid transparent; 
    position: relative;
    user-select: none;
}
.fs-item:hover { 
    background: var(--bg-hover); 
    border-color: rgba(67, 97, 238, 0.2); 
    box-shadow: var(--shadow-sm);
}
.fs-icon { 
    font-size: 3.5rem; 
    margin-bottom: 12px; 
    color: var(--primary-color);
    transition: transform 0.2s ease;
}
.fs-item:hover .fs-icon { transform: scale(1.05); }
.fs-folder-icon { color: var(--warning-color); }
.fs-thumb {
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}
.fs-item:hover .fs-thumb { transform: scale(1.05); }
.fs-name { 
    font-size: 0.85rem; 
    font-weight: 600; 
    color: var(--text-main); 
    word-break: break-all;
    line-height: 1.3;
}
.fs-item-actions { 
    position: absolute;
    top: -10px;
    right: -10px;
    display: none; 
    gap: 5px; 
    background: var(--bg-card);
    padding: 4px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}
.fs-item:hover .fs-item-actions { display: flex; }

/* ===================================================
   TOPBAR PROFILE DROPDOWN
=================================================== */
.profile-dropdown {
    position: absolute;
    top: 52px;
    left: 0;
    width: 230px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-15px) scale(0.95);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0,0,0,0.1);
}
.profile-dropdown.show {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}
.dropdown-header {
    padding: 16px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.dropdown-header b { color: var(--text-main); font-size: 1rem; }
.dropdown-header span { color: var(--text-muted); font-size: 0.8rem; }
.dropdown-item {
    padding: 12px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}
.dropdown-item i { width: 16px; text-align: center; color: var(--text-muted); }
.dropdown-item:hover { background: var(--bg-hover); color: var(--primary-color); }
.dropdown-item.text-danger:hover { color: var(--danger-color); }
.dropdown-item.text-danger i { color: var(--danger-color); }
.dropdown-divider { border-bottom: 1px solid var(--border-color); }

/* ===================================================
   MOBILE NATIVE NAVIGATION SYSTEM
=================================================== */
.mobile-app-nav {
    display: none; /* hidden on desktop */
}
.mobile-sheet-overlay {
    display: none;
}
.mobile-more-sheet {
    display: none;
}

@media (max-width: 768px) {
    .mobile-app-nav {
        display: flex;
        position: fixed;
        bottom: 10px;
        left: 10px;
        right: 10px;
        height: 66px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 20px;
        box-shadow: var(--shadow-lg);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: constant(safe-area-inset-bottom);
        padding-bottom: env(safe-area-inset-bottom);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        transition: var(--transition);
    }
    
    .bnav-link {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-decoration: none;
        color: var(--text-muted);
        gap: 3px;
        width: 20%;
        height: 100%;
        transition: var(--transition);
        position: relative;
        border-radius: 12px;
    }
    
    .bnav-link i { 
        font-size: 1.3rem; 
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s; 
    }
    .bnav-link span { font-size: 0.72rem; font-weight: 700; transition: color 0.3s; }
    
    .bnav-link.active { 
        color: var(--primary-color); 
    }
    .bnav-link.active i { 
        transform: translateY(-4px) scale(1.15); 
        background: linear-gradient(135deg, #ff007f, #7f00ff, #00f0ff);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        display: inline-block;
    }
    .bnav-link.active::after {
        content: '';
        position: absolute;
        bottom: 6px;
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background-color: var(--primary-color);
        box-shadow: 0 0 8px var(--primary-color);
    }
    
    /* Bottom Sheet Modal Overlay */
    .mobile-sheet-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1001;
        opacity: 0;
        pointer-events: none;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .mobile-sheet-overlay.active { 
        display: block;
        opacity: 1; 
        pointer-events: all; 
    }
    
    .mobile-more-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: -100%;
        left: 10px;
        right: 10px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 28px 28px 20px 20px;
        z-index: 1002;
        padding: 18px 20px 30px;
        transition: bottom 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.15), visibility 0.45s;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
        max-height: 80vh;
        overflow-y: auto;
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        visibility: hidden;
        pointer-events: none;
    }
    .mobile-more-sheet.open { 
        bottom: 86px; 
        visibility: visible;
        pointer-events: all;
    }
    
    .sheet-handle {
        width: 45px;
        height: 5px;
        background: var(--border-color);
        opacity: 0.6;
        border-radius: 10px;
        margin: 0 auto 18px;
    }
    .sheet-title {
        font-size: 1.2rem;
        font-weight: 800;
        margin-bottom: 20px;
        color: var(--text-main);
    }
    .sheet-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    .sheet-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-decoration: none;
        color: var(--text-main);
        padding: 12px 10px;
        border-radius: var(--radius-md);
        transition: background 0.2s, transform 0.2s;
    }
    .sheet-item:active { 
        background: var(--bg-hover); 
        transform: scale(0.95);
    }
    .sheet-icon {
        width: 50px;
        height: 50px;
        border-radius: 15px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 1.5rem;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }
    .sheet-item span { font-size: 0.8rem; font-weight: 600; text-align: center; }
}

/* Sidebar Logo Styling */


/* Print Specific Styles - Pyramidal Logo and Custom Header */
@media print {
    .print-office-header {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        margin-bottom: 12px !important;
        direction: rtl !important;
    }
    
    .print-logo {
        width: 100px !important;
        height: 100px !important;
        object-fit: cover !important;
        clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%) !important;
        background: #f8f9fa !important;
        margin-left: 0 !important;
    }
    
    .print-office-info {
        text-align: right !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
    }
    
    .print-office-info h2 {
        order: 10 !important; /* Move Office Name to bottom */
        margin-top: 10px !important;
        font-size: 18pt !important;
        color: #2c3e8c !important;
        font-weight: 800 !important;
    }
    
    .print-office-info span {
        order: 1 !important;
        font-size: 10pt !important;
        color: #444 !important;
    }
}

/* Modern Session Timeline Accordion */
.sessions-timeline {
    position: relative;
    padding-right: 35px;
    margin-top: 10px;
}

.sessions-timeline::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 20px;
    right: 8px;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary-color), var(--border-color));
    border-radius: 2px;
}

/* Removed redundant classes, unified above */

/* ====================================================
   v3.0 — NEW STYLES: Multi-Role Login, Portal, Users
   ==================================================== */

/* ----- Login Background Shapes ----- */
.login-bg-shapes { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.shape { position: absolute; border-radius: 50%; opacity: 0.15; animation: floatOrb 12s ease-in-out infinite; }
.shape-1 { width: 500px; height: 500px; background: radial-gradient(circle, #4361ee 0%, transparent 70%); top: -200px; right: -200px; }
.shape-2 { width: 400px; height: 400px; background: radial-gradient(circle, #7209b7 0%, transparent 70%); bottom: -150px; left: -150px; animation-delay: -4s; }
.shape-3 { width: 250px; height: 250px; background: radial-gradient(circle, #f72585 0%, transparent 70%); top: 50%; left: 40%; animation-delay: -8s; }

/* ----- Login Role Tabs ----- */
.login-role-tabs { display: flex; gap: 8px; margin-bottom: 24px; background: rgba(255,255,255,0.06); border-radius: 12px; padding: 6px; }
.role-tab { flex: 1; padding: 10px; border: none; border-radius: 8px; background: transparent; color: rgba(255,255,255,0.55); font-family: 'Cairo', sans-serif; font-weight: 600; font-size: .9rem; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; gap: 7px; }
.role-tab:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.08); }
.role-tab.active { background: linear-gradient(135deg, #4361ee, #7209b7); color: #fff; box-shadow: 0 4px 15px rgba(67,97,238,0.4); }

/* ----- Login Footer Note ----- */
.login-footer-note { text-align: center; margin-top: 20px; color: rgba(255,255,255,0.4); font-size: .85rem; }

/* ----- Role Badge in Topbar ----- */
.role-badge-topbar { display: flex; align-items: center; }
.role-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; font-size: .8rem; font-weight: 700; }
.role-badge.admin { background: rgba(247,37,133,0.1); color: var(--danger-color); border: 1px solid rgba(247,37,133,0.25); }
.role-badge.lawyer { background: rgba(67,97,238,0.1); color: var(--primary-color); border: 1px solid rgba(67,97,238,0.25); }

/* ----- Client Portal ----- */
.client-portal-sidebar { position: relative; }
.client-portal-wrapper { animation: fadeInUp 0.4s ease-out; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.client-portal-header { margin-bottom: 28px; padding: 28px; background: linear-gradient(135deg, var(--primary-color) 0%, #7209b7 100%); border-radius: var(--radius-lg); color: #fff; box-shadow: 0 8px 24px rgba(67,97,238,0.35); }
.portal-welcome-badge { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; background: rgba(255,255,255,0.2); border-radius: 20px; font-size: .85rem; font-weight: 700; margin-bottom: 12px; }
.portal-greeting { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.portal-subtitle { color: rgba(255,255,255,0.75); font-size: .95rem; }

/* ----- Portal Case Cards ----- */
.portal-case-card { border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 16px; transition: var(--transition); }
.portal-case-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-color); }
.portal-case-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 16px; background: var(--bg-main); border-bottom: 1px solid var(--border-color); }
.portal-case-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
@media (max-width: 768px) { .portal-case-body { grid-template-columns: 1fr; } }
.portal-sessions-section, .portal-fees-section { padding: 16px; border-left: 1px solid var(--border-color); }
.portal-sessions-section:last-child, .portal-fees-section:last-child { border-left: none; }
.portal-sessions-section h4, .portal-fees-section h4 { font-size: .9rem; color: var(--text-muted); font-weight: 700; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--border-color); }
.portal-session-row { display: flex; flex-direction: column; gap: 3px; padding: 8px 0; border-bottom: 1px solid var(--border-color); }
.portal-session-row:last-child { border-bottom: none; }
.portal-session-date { font-weight: 700; font-size: .9rem; }
.portal-session-decision { color: var(--text-muted); font-size: .85rem; }
.portal-session-notes { color: var(--primary-color); font-size: .8rem; }
.portal-fees-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.portal-fee-item { flex: 1; min-width: 80px; }
.portal-fee-item .label { font-size: .8rem; color: var(--text-muted); margin-bottom: 4px; }
.portal-fee-item .value { font-weight: 800; font-size: 1rem; }
.portal-case-notes { padding: 12px 16px; background: var(--bg-main); border-top: 1px dashed var(--border-color); font-size: .9rem; color: var(--text-muted); }
.portal-notice { margin-top: 24px; padding: 14px 20px; background: rgba(247,37,133,0.05); border: 1px solid rgba(247,37,133,0.15); border-radius: var(--radius-sm); color: var(--danger-color); font-size: .9rem; text-align: center; }

/* ===================================================
   UNIFIED DASHBOARD RESPONSIVENESS (V4.0)
=================================================== */

/* Stats Grid Logic */
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 16px; 
    margin-bottom: 24px;
}

/* Quick Action Buttons */
.quick-action-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.quick-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
    background: var(--bg-hover);
}
.qa-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    transition: var(--transition);
}
.quick-action-btn:hover .qa-icon {
    transform: scale(1.1);
}


/* Main Dashboard Layout */
.dash-main-grid { 
    display: grid; 
    grid-template-columns: 340px 1fr; 
    gap: 24px; 
    margin-top: 24px;
}

/* File Explorer Grid */
.file-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); 
    gap: 20px; 
    margin-top: 15px; 
}

/* Responsiveness Queries */
@media (max-width: 1200px) {
    .dash-main-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
    .calendar-weekdays { font-size: 0.7rem; }
    .cal-day-num { font-size: 0.75rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .file-grid { grid-template-columns: 1fr; }
    .calendar-grid { gap: 2px; }
    .cal-cell { min-height: 40px; padding: 4px 2px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .page-header h1 { font-size: 1.3rem; }
    .stat-card { padding: 15px; }
    .stat-icon { width: 40px; height: 40px; font-size: 1rem; }
}

/* ----- Profile Dropdown ----- */
/* Combined and styled above under TOPBAR PROFILE DROPDOWN */
.dropdown-header { padding: 16px; border-bottom: 1px solid var(--border-color); }
.dropdown-header b { display: block; font-weight: 700; }
.dropdown-header span { font-size: .85rem; color: var(--text-muted); }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text-main); text-decoration: none; font-size: .9rem; font-weight: 600; transition: var(--transition); }
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.text-danger { color: var(--danger-color); }
.dropdown-divider { height: 1px; background: var(--border-color); }

/* ----- Nav admin-only separator ----- */
.nav-link.admin-only { border-top: 1px solid var(--border-color); margin-top: 6px; padding-top: 16px; }

/* ===================================================
   CLIENT MESSAGING / CHAT BOX
=================================================== */
.portal-chat-section { margin-top: 24px; border-top: 1px solid var(--border-color); padding-top: 20px; }
.portal-chat-container { display: flex; flex-direction: column; gap: 12px; max-height: 400px; overflow-y: auto; padding: 10px; background: rgba(0,0,0,0.02); border-radius: var(--radius-md); margin-bottom: 12px; }
.chat-msg { max-width: 85%; padding: 10px 14px; border-radius: var(--radius-md); font-size: .9rem; position: relative; word-wrap: break-word; }
.chat-msg.sent { align-self: flex-end; background: var(--primary-color); color: #fff; border-bottom-right-radius: 2px; }
.chat-msg.received { align-self: flex-start; background: var(--bg-hover); color: var(--text-main); border: 1px solid var(--border-color); border-bottom-left-radius: 2px; }
.chat-msg-time { font-size: 0.7rem; opacity: 0.7; margin-top: 4px; display: block; }

.chat-input-group { display: flex; gap: 10px; }
.chat-input-group input { flex: 1; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: var(--radius-md); outline: none; }
.chat-input-group input:focus { border-color: var(--primary-color); }

/* Accordion Specific */
.portal-case-accordion { margin-bottom: 16px; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-card); transition: var(--transition); }
.portal-case-accordion:hover { border-color: var(--primary-color); }
.portal-case-accordion.active .acc-body { display: block; }
.acc-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; cursor: pointer; background: var(--bg-hover); border-bottom: 1px solid transparent; }
.portal-case-accordion.active .acc-header { border-bottom-color: var(--border-color); }
.acc-header h3 { font-size: 1rem; margin: 0; display: flex; align-items: center; gap: 10px; }
.acc-body { display: none; padding: 20px; }
.acc-toggle-icon { transition: transform 0.3s ease; }
.portal-case-accordion.active .acc-toggle-icon { transform: rotate(180deg); }
/* Registration Sections */
.reg-project-card {
    border-right: 5px solid var(--primary-color);
}

.reg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

@media (max-width: 768px) {
    .reg-grid { grid-template-columns: 1fr; }
}

/* ===================================================
   CUSTOM MODULE ACTION BUTTON COLOUR UTILITIES
=================================================== */
.btn-custom-blue {
    background: linear-gradient(135deg, #005a9e, #0078d4) !important;
    border-color: #005a9e !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(0, 90, 158, 0.2) !important;
}
.btn-custom-blue:hover {
    background: #004578 !important;
    transform: translateY(-1px) !important;
}

.btn-custom-green {
    background: linear-gradient(135deg, #107c10, #10b981) !important;
    border-color: #107c10 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(16, 124, 16, 0.2) !important;
}
.btn-custom-green:hover {
    background: #0b590b !important;
    transform: translateY(-1px) !important;
}

.btn-custom-red {
    background: linear-gradient(135deg, #a4262c, #ef4444) !important;
    border-color: #a4262c !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(164, 38, 44, 0.2) !important;
}
.btn-custom-red:hover {
    background: #7d1c20 !important;
    transform: translateY(-1px) !important;
}

.btn-custom-gold {
    background: linear-gradient(135deg, #b7791f, #d97706) !important;
    border-color: #b7791f !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(183, 121, 31, 0.2) !important;
}
.btn-custom-gold:hover {
    background: #975a16 !important;
    transform: translateY(-1px) !important;
}

.btn-custom-purple {
    background: linear-gradient(135deg, #6b21a8, #8b5cf6) !important;
    border-color: #6b21a8 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(107, 33, 168, 0.2) !important;
}
.btn-custom-purple:hover {
    background: #581c87 !important;
    transform: translateY(-1px) !important;
}

.btn-custom-brown {
    background: linear-gradient(135deg, #78350f, #92400e) !important;
    border-color: #78350f !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(120, 53, 15, 0.2) !important;
}
.btn-custom-brown:hover {
    background: #451a03 !important;
    transform: translateY(-1px) !important;
}

.btn-custom-black {
    background: linear-gradient(135deg, #18181b, #27272a) !important;
    border-color: #09090b !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(24, 24, 27, 0.2) !important;
}
.btn-custom-black:hover {
    background: #000000 !important;
    transform: translateY(-1px) !important;
}

/* ===================================================
   MOBILE TOUCH FIXES
   On touch devices there is no hover, so reveal
   hover-only actions and prevent stuck hover states.
   =================================================== */
@media (hover: none), (pointer: coarse) {
    .attachment-actions { opacity: 1; }
    .doc-delete-btn { opacity: 1; }
    .fs-item-actions { display: flex; }

    /* Prevent hover transforms from sticking after tap */
    .attachment-card:hover { transform: none; }
    .doc-thumb:hover { transform: none; }
    .fs-item:hover .fs-icon { transform: none; }
    .timeline-accordion-header:hover { transform: none; }
}

/* Prevent iOS double-tap zoom on interactive elements */
button, a, input, select, textarea {
    touch-action: manipulation;
}

/* ===================================================
   VIEW FADE-IN (portal route change)
   =================================================== */
.view-container.view-enter {
    animation: viewFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===================================================
   REDUCED MOTION
   =================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
