/*
 * HMS NEW THEME — consolidated stylesheet (CityCare)
 * BASE = dashboard.html (canonical, per handover Sec 3). Table/toolbar/page-header
 * components merged from Patients.html. Custom (Sec 5.3) components appended.
 * No old-UI CSS is present.
 */

/* ================= CANONICAL BASE: dashboard.html ================= */
        /* --- Dark Theme (Default) --- */
        :root {
            --bg-body: #050b14; 
            
            /* Glassmorphism translucent backgrounds */
            --bg-surface: rgba(17, 24, 39, 0.7); 
            --bg-surface-hover: rgba(30, 38, 61, 0.85);
            --border-color: rgba(255, 255, 255, 0.08); 
            
            /* Brand Theme Gradient Colors (Reduced by 60%) */
            --theme-gradient-start: rgba(13, 164, 135, 0.088); /* was 0.22 */
            --theme-gradient-mid: rgba(13, 164, 135, 0.024);   /* was 0.06 */
            --theme-gradient-end: transparent;

            /* Card Inner Glow (Reduced by 60%) */
            --card-glow: linear-gradient(to top left, rgba(13, 164, 135, 0.048) 0%, transparent 60%); /* was 0.12 */
            
            --text-main: #f8fafc;
            --text-muted: #9ca3af;
            --text-dark: #cbd5e1;
            
            --brand-primary: #0da487;
            --brand-primary-light: rgba(13, 164, 135, 0.15);
            
            --accent-purple: #818cf8;
            --accent-purple-light: rgba(99, 102, 241, 0.15);
            --accent-blue: #60a5fa;
            --accent-blue-light: rgba(59, 130, 246, 0.15);
            --accent-green: #34d399;
            --accent-green-light: rgba(16, 185, 129, 0.15);
            --accent-orange: #fb923c;
            --accent-orange-light: rgba(249, 115, 22, 0.15);
            --accent-red: #ef4444;
            --accent-red-light: rgba(239, 68, 68, 0.15);

            --radius-md: 8px;
            --radius-lg: 12px;
            --radius-xl: 16px;

            --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
        }

        /* --- Light Theme Overrides --- */
        body.light-mode {
            --bg-body: #f1f5f9; 
            
            --bg-surface: rgba(255, 255, 255, 0.75);
            --bg-surface-hover: rgba(255, 255, 255, 0.95);
            --border-color: rgba(0, 0, 0, 0.08);
            
            /* Lighter Gradient for Light Mode (Reduced by 60%) */
            --theme-gradient-start: rgba(13, 164, 135, 0.06);  /* was 0.15 */
            --theme-gradient-mid: rgba(13, 164, 135, 0.012);   /* was 0.03 */
            --theme-gradient-end: transparent;

            /* Card Glow for Light Mode (Reduced by 60%) */
            --card-glow: linear-gradient(to top left, rgba(13, 164, 135, 0.024) 0%, transparent 60%); /* was 0.06 */
            
            --text-main: #0f172a;
            --text-muted: #64748b;
            --text-dark: #334155;
            
            --brand-primary: #0da487;
            --brand-primary-light: rgba(13, 164, 135, 0.1);
            
            --accent-purple: #6366f1;
            --accent-purple-light: rgba(99, 102, 241, 0.1);
            --accent-blue: #3b82f6;
            --accent-blue-light: rgba(59, 130, 246, 0.1);
            --accent-green: #10b981;
            --accent-green-light: rgba(16, 185, 129, 0.1);
            --accent-orange: #f97316;
            --accent-orange-light: rgba(249, 115, 22, 0.1);
            --accent-red: #ef4444;
            --accent-red-light: rgba(239, 68, 68, 0.1);

            --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
        }

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

        body {
            background-color: var(--bg-body);
            color: var(--text-main);
            display: flex;
            height: 100vh;
            overflow: hidden;
            font-size: 14px;
            transition: background-color 0.4s ease, color 0.4s ease;
        }

        /* --- Unified Background Gradient --- */
        .bg-gradient {
            position: fixed;
            top: 0; left: 0; width: 100vw; height: 100vh;
            z-index: -1;
            pointer-events: none;
            transition: background 0.4s ease;
        }

        /* --- Smooth color transitions --- */
        .sidebar, .top-header, .card, .stat-card, input, .filter-btn, .action-card, .donut-hole {
            transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
        }

        /* --- Glassmorphism Utility --- */
        .glass-effect {
            background: var(--card-glow), var(--bg-surface);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
        }

        /* --- Scrollbar Customization --- */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); border-radius: 4px; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.6); }

        /* --- Global Utilities --- */
        .text-muted { color: var(--text-muted); }
        .min-w-0 { min-width: 0; }
        
        .badge {
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 11px;
            font-weight: 500;
            white-space: nowrap;
        }
        .badge-success { background: var(--accent-green-light); color: var(--accent-green); border: 1px solid var(--border-color); }
        .badge-primary { background: var(--accent-blue-light); color: var(--accent-blue); border: 1px solid var(--border-color); }
        .badge-purple { background: var(--accent-purple-light); color: var(--accent-purple); border: 1px solid var(--border-color); }
        .badge-warning { background: var(--accent-orange-light); color: var(--accent-orange); border: 1px solid var(--border-color); }

        .card {
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-color);
            padding: 24px;
            box-shadow: var(--card-shadow);
        }
        
        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border-color);
        }
        
        .view-all-btn {
            background: rgba(255,255,255,0.02);
            border: 1px solid var(--border-color);
            color: var(--text-muted);
            padding: 4px 12px;
            border-radius: 16px;
            font-size: 11px;
            cursor: pointer;
            transition: 0.2s;
            white-space: nowrap;
        }
        .view-all-btn:hover { background: var(--border-color); color: var(--text-main); }

        /* --- Sidebar & Overlay --- */
        .sidebar {
            width: 260px;
            border-right: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            z-index: 20;
            transition: width 0.3s ease, left 0.3s ease;
            flex-shrink: 0;
            background: var(--bg-surface);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            overflow-y: auto;
        }

        /* Mobile overlay */
        .sidebar-overlay {
            position: fixed;
            top: 0; left: 0; width: 100vw; height: 100vh;
            background: rgba(0,0,0,0.6);
            backdrop-filter: blur(4px);
            z-index: 15;
            display: none;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        .sidebar-overlay.active { display: block; opacity: 1; }

        .brand {
            height: 95px; min-height: 95px; padding: 0 24px;
            display: flex; align-items: center; gap: 12px;
            font-size: 19px; font-weight: 700;
            border-bottom: 1px solid var(--border-color);
            white-space: nowrap; overflow: hidden; flex-shrink: 0;
        }
        .brand i { color: var(--brand-primary); font-size: 26px; flex-shrink: 0; }

        .nav-section { margin-top: 20px; margin-bottom: 20px; }
        .nav-title {
            padding: 0 24px; font-size: 11px; color: var(--text-muted);
            font-weight: 600; margin-bottom: 12px; letter-spacing: 0.5px;
            white-space: nowrap; overflow: hidden;
        }

        .nav-list { list-style: none; }
        .nav-item {
            padding: 12px 24px; display: flex; align-items: center; gap: 12px;
            color: var(--text-dark); text-decoration: none; transition: all 0.2s;
            cursor: pointer; margin: 2px 16px; border-radius: var(--radius-md);
            position: relative; white-space: nowrap;
        }
        .nav-item:hover { background-color: var(--bg-surface-hover); color: var(--text-main); }
        .nav-item.active { background-color: var(--brand-primary-light); color: var(--brand-primary); font-weight: 600; }
        .nav-item i { width: 16px; text-align: center; font-size: 16px; flex-shrink: 0; }
        .nav-item span { transition: opacity 0.2s; }
        
        .nav-badge {
            margin-left: auto; background-color: var(--brand-primary); color: #fff;
            padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;
        }

        .sidebar-footer {
            margin-top: auto; padding: 24px 24px; border-top: 1px solid var(--border-color);
            font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden;
        }

        /* Collapsed Sidebar Styles (Desktop) */
        .sidebar.collapsed { width: 84px; }
        .sidebar.collapsed .brand { padding: 0; justify-content: center; }
        .sidebar.collapsed .brand span { display: none; }
        .sidebar.collapsed .nav-title { text-align: center; padding: 0; font-size: 9px; }
        .sidebar.collapsed .nav-item { padding: 14px; margin: 2px 14px; justify-content: center; }
        .sidebar.collapsed .nav-item .nav-text { display: none; }
        .sidebar.collapsed .nav-badge { position: absolute; top: 4px; right: 4px; padding: 2px 4px; font-size: 9px; }
        .sidebar.collapsed .sidebar-footer .footer-text { display: none; }
        .sidebar.collapsed .sidebar-footer { padding: 24px 0; display: flex; justify-content: center; }

        /* --- Main Content Area --- */
        .main-wrapper {
            flex: 1; display: flex; flex-direction: column;
            overflow-y: auto; overflow-x: hidden; min-width: 0;
        }

        .top-header {
            height: 95px; min-height: 95px; display: flex; align-items: center; justify-content: space-between;
            padding: 0 32px; border-bottom: 1px solid var(--border-color);
            position: sticky; top: 0; z-index: 10; gap: 16px;
        }

        .header-left { display: flex; align-items: center; flex: 1; min-width: 0; gap: 16px; }
        
        .mobile-menu-btn { display: none; } /* Hidden on desktop */

        .search-bar { position: relative; width: 100%; max-width: 400px; }
        .search-bar i {
            position: absolute; left: 18px; top: 50%;
            transform: translateY(-50%); color: var(--text-muted);
        }
        .search-bar input {
            width: 100%; background-color: var(--bg-body); 
            border: 1px solid var(--border-color); color: var(--text-main);
            padding: 12px 16px 12px 48px; border-radius: 24px;
            outline: none; font-size: 13px;
        }
        .search-bar input:focus { border-color: var(--brand-primary); }
        .search-shortcut {
            position: absolute; right: 14px; top: 50%;
            transform: translateY(-50%); background-color: var(--bg-surface);
            border: 1px solid var(--border-color); padding: 3px 8px;
            border-radius: 4px; font-size: 10px; color: var(--text-muted);
        }

        .header-actions { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
        
        .icon-btn {
            position: relative; background: var(--bg-surface);
            border: 1px solid var(--border-color); color: var(--text-muted);
            width: 44px; height: 44px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 18px; cursor: pointer; transition: 0.2s; flex-shrink: 0;
        }
        .icon-btn:hover { color: var(--text-main); border-color: var(--text-muted); }
        .icon-badge {
            position: absolute; top: -2px; right: -2px; width: 18px; height: 18px;
            border-radius: 50%; font-size: 10px; font-weight: 600;
            display: flex; align-items: center; justify-content: center;
            color: white; border: 2px solid var(--bg-body);
        }
        .badge-red { background-color: var(--accent-red); }
        .badge-green { background-color: var(--brand-primary); }

        .user-profile { 
            display: flex; align-items: center; gap: 12px; cursor: pointer; 
            padding-left: 12px; border-left: 1px solid var(--border-color); margin-left: 8px;
        }
        .user-profile img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--border-color);}
        .user-info .name { font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--text-main); }
        .user-info .role { font-size: 12px; color: var(--text-muted); }

        .dashboard-content { padding: 24px 32px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }

        /* Welcome Section */
        .welcome-section { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 4px; }
        .welcome-text h1 { font-size: 24px; font-weight: 600; margin-bottom: 6px; color: var(--text-main); }
        .welcome-text p { color: var(--text-muted); font-size: 14px; }
        .date-filters { display: flex; gap: 12px; flex-wrap: wrap; }
        .filter-btn {
            border: 1px solid var(--border-color); color: var(--text-main);
            padding: 10px 18px; border-radius: var(--radius-md);
            font-size: 13px; font-weight: 500; display: flex;
            align-items: center; gap: 8px; cursor: pointer; white-space: nowrap;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        }

        /* --- Dashboard Grid Layout --- */
        .main-grid {
            display: grid;
            grid-template-columns: minmax(0, 1fr) 340px;
            gap: 16px; align-items: start;
        }
        .left-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

        /* --- STATS CARDS --- */
        .stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
        .stat-card {
            border-radius: var(--radius-lg); border: 1px solid var(--border-color);
            padding: 20px; display: flex; justify-content: space-between;
            align-items: center; box-shadow: var(--card-shadow); min-width: 0;
        }
        .stat-content { display: flex; flex-direction: column; min-width: 0; }
        .stat-title {
            color: var(--text-muted); font-size: 13px; font-weight: 500;
            margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .stat-value { color: var(--text-main); font-size: 26px; font-weight: 600; margin-bottom: 8px; line-height: 1; }
        .stat-subtext { color: var(--text-muted); font-size: 11px; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
        .trend-up { color: var(--accent-green); font-weight: 600; }

        .icon-wrapper {
            width: 48px; height: 48px; border-radius: 50%; display: flex;
            justify-content: center; align-items: center; flex-shrink: 0; margin-left: 12px;
        }
        .icon-wrapper svg { width: 24px; height: 24px; }
        .icon-purple { background-color: var(--accent-purple-light); color: var(--accent-purple); }
        .icon-green { background-color: var(--accent-green-light); color: var(--accent-green); }
        .icon-orange { background-color: var(--accent-orange-light); color: var(--accent-orange); }
        .icon-blue { background-color: var(--accent-blue-light); color: var(--accent-blue); }

        /* Middle Row */
        .middle-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }

        /* Appointments List */
        .appointment-list { display: flex; flex-direction: column; gap: 16px; }
        .appointment-item {
            display: flex; align-items: center; justify-content: space-between;
            padding-bottom: 12px; border-bottom: 1px solid var(--border-color); gap: 12px;
        }
        .appointment-item:last-child { border-bottom: none; padding-bottom: 0; }
        .apt-time { font-size: 12px; font-weight: 500; color: var(--text-dark); width: 65px; flex-shrink: 0; }
        .apt-patient { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
        .apt-patient img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
        .apt-info { min-width: 0; }
        .apt-info h4 { font-size: 13px; font-weight: 600; margin-bottom: 3px; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .apt-info p { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

        /* Patient Flow Chart */
        .chart-container { display: flex; align-items: center; justify-content: center; gap: 30px; padding: 10px 0; flex-wrap: wrap; }
        
        .donut-wrapper {
            position: relative; width: 150px; height: 150px; border-radius: 50%; flex-shrink: 0;
            background: conic-gradient(
                var(--accent-purple) 0% 45%, var(--accent-blue) 45% 65%,
                var(--accent-green) 65% 75%, var(--accent-orange) 75% 85%,
                var(--accent-red) 85% 100%
            );
            display: flex; align-items: center; justify-content: center; box-shadow: 0 0 20px rgba(0,0,0,0.1);
        }
        .donut-hole { width: 110px; height: 110px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
        .donut-hole h2 { font-size: 22px; font-weight: 700; line-height: 1; color: var(--text-main); margin-bottom: 2px;}
        .donut-hole p { font-size: 11px; color: var(--text-muted); }

        .chart-legend { display: flex; flex-direction: column; gap: 14px; flex: 1; min-width: 150px; }
        .legend-item { display: flex; align-items: center; justify-content: space-between; font-size: 12px; gap: 8px;}
        .legend-label { display: flex; align-items: center; gap: 8px; color: var(--text-dark); white-space: nowrap; }
        .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

        /* Data Table */
        .table-responsive { width: 100%; overflow-x: auto; }
        .data-table { width: 100%; border-collapse: collapse; min-width: 700px; }
        .data-table th, .data-table td {
            padding: 16px 12px; text-align: left; font-size: 13px;
            border-bottom: 1px solid var(--border-color); white-space: nowrap;
        }
        .data-table th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;}
        .data-table tr:last-child td { border-bottom: none; }
        .data-table td { color: var(--text-dark); }
        .action-link { color: var(--accent-blue); text-decoration: none; font-size: 12px; font-weight: 500; padding: 4px 10px; background: var(--accent-blue-light); border-radius: 4px; transition: 0.2s;}
        .action-link:hover { filter: brightness(1.2); }

        /* --- Right Column Widgets --- */
        .right-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

        /* Quick Actions */
        .quick-actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
        .action-card {
            background-color: rgba(0,0,0,0.1); border: 1px solid var(--border-color);
            border-radius: var(--radius-lg); padding: 16px 8px; display: flex;
            flex-direction: column; align-items: center; justify-content: center;
            gap: 10px; cursor: pointer; transition: 0.2s;
        }
        body.light-mode .action-card { background-color: rgba(255,255,255,0.4); }
        .action-card:hover { border-color: var(--brand-primary); transform: translateY(-2px); }
        .action-card i { font-size: 20px; color: var(--text-muted); }
        .action-card span { font-size: 12px; text-align: center; color: var(--text-dark); font-weight: 500; line-height: 1.2; }
        .action-card:hover i { color: var(--brand-primary); }

        /* Alerts List */
        .alerts-list { display: flex; flex-direction: column; gap: 18px; }
        .alert-item { display: flex; gap: 14px; align-items: flex-start; }
        .alert-icon {
            width: 36px; height: 36px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 14px; flex-shrink: 0;
        }
        .alert-content { flex: 1; min-width: 0; }
        .alert-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
        .alert-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .alert-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
        .alert-desc { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center;}
        
        .alert-badge {
            width: 18px; height: 18px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 10px; font-weight: bold; color: white; flex-shrink: 0;
        }
        
        .text-red { color: var(--accent-red); }
        .text-orange { color: var(--accent-orange); }
        .text-green { color: var(--accent-green); }
        .text-yellow { color: #f59e0b; }
        .bg-red-light { background-color: var(--accent-red-light); }
        .bg-yellow-light { background-color: rgba(245, 158, 11, 0.15); }
        .bg-orange-light { background-color: var(--accent-orange-light); }
        .bg-green-light { background-color: var(--accent-green-light); }

        /* Bed Occupancy */
        .bed-list { display: flex; flex-direction: column; gap: 18px; }
        .bed-item { display: flex; flex-direction: column; gap: 8px; }
        .bed-info { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--text-dark); }
        .progress-bar { width: 100%; height: 6px; background-color: rgba(148, 163, 184, 0.2); border-radius: 3px; overflow: hidden; }
        .progress-fill { height: 100%; border-radius: 3px; }

        /* ================================
           Responsive Media Queries 
           ================================ */
        @media (max-width: 1400px) {
            .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        }
        @media (max-width: 1100px) {
            .main-grid { grid-template-columns: 1fr; }
            .right-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
            .quick-actions-grid { grid-template-columns: repeat(3, 1fr); }
        }
        @media (max-width: 850px) {
            .middle-grid { grid-template-columns: 1fr; }
            .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .quick-actions-grid { grid-template-columns: repeat(3, 1fr); }
            .top-header { padding: 0 16px; }
            .dashboard-content { padding: 20px; }
        }
        
        /* Mobile Breakpoint */
        @media (max-width: 768px) {
            .mobile-menu-btn { display: flex !important; }
            
            /* Sidebar off-canvas setup */
            .sidebar {
                position: fixed; top: 0; left: -260px; height: 100vh;
                box-shadow: 2px 0 15px rgba(0,0,0,0.5);
            }
            .sidebar.mobile-open { left: 0; }
            .sidebar.collapsed { width: 260px; } /* Reset desktop collapse behavior */
            .sidebar.collapsed .brand span, .sidebar.collapsed .nav-item .nav-text, .sidebar.collapsed .sidebar-footer .footer-text { display: inline-block; }
            .sidebar.collapsed .nav-title { text-align: left; padding: 0 24px; font-size: 11px; }
            .sidebar.collapsed .nav-item { padding: 12px 24px; margin: 2px 16px; justify-content: flex-start; }
            .sidebar.collapsed .brand { justify-content: flex-start; padding: 0 24px; }
            .sidebar.collapsed .nav-badge { position: static; padding: 2px 8px; font-size: 11px; }
            
            #collapseBtn { display: none; } /* Hide collapse button inside mobile menu */
            
            .top-header { height: 80px; min-height: 80px; padding: 0 16px; }
            .brand { height: 80px; min-height: 80px; }
            
            .dashboard-content { padding: 16px; gap: 16px; }
            .search-shortcut { display: none; }
            .card { padding: 16px; }
        }

        /* Smaller Mobiles */
        @media (max-width: 600px) {
            .stats-grid { grid-template-columns: 1fr; }
            .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
            
            /* Compact Top Header */
            .header-actions { gap: 10px; }
            .user-profile { padding-left: 0; border-left: none; margin-left: 0; }
            .user-info { display: none; }
            .user-profile i { display: none; }
            .icon-btn { width: 38px; height: 38px; font-size: 16px; }
            .user-profile img { width: 38px; height: 38px; }
            
            .search-bar input { padding: 10px 14px 10px 36px; font-size: 12px; }
            .search-bar i { left: 14px; font-size: 13px; }
            
            .welcome-text h1 { font-size: 20px; }
            
            /* Compact Chart */
            .chart-container { gap: 20px; }
            .donut-wrapper { width: 130px; height: 130px; }
            .donut-hole { width: 95px; height: 95px; }
            .donut-hole h2 { font-size: 18px; }
            
            /* Alerts text wrap prevention */
            .alert-header { flex-direction: column; align-items: flex-start; gap: 2px; }
            .alert-time { font-size: 10px; }
        }
    

/* ========== SHARED COMPONENTS: Patients.html (tables/toolbar/page-header) ========== */
        /* --- Dark Theme (Default) --- */
        :root {
            --bg-body: #050b14; 
            --bg-surface: rgba(17, 24, 39, 0.7); 
            --bg-surface-hover: rgba(30, 38, 61, 0.85);
            --border-color: rgba(255, 255, 255, 0.08); 
            
            --theme-gradient-start: rgba(13, 164, 135, 0.088); 
            --theme-gradient-mid: rgba(13, 164, 135, 0.024);   
            --theme-gradient-end: transparent;
            --card-glow: linear-gradient(to top left, rgba(13, 164, 135, 0.048) 0%, transparent 60%); 
            
            --text-main: #f8fafc;
            --text-muted: #9ca3af;
            --text-dark: #cbd5e1;
            
            --brand-primary: #0da487;
            --brand-primary-hover: #0b8a71;
            --brand-primary-light: rgba(13, 164, 135, 0.15);
            
            --accent-purple: #818cf8;
            --accent-purple-light: rgba(99, 102, 241, 0.15);
            --accent-blue: #60a5fa;
            --accent-blue-light: rgba(59, 130, 246, 0.15);
            --accent-green: #34d399;
            --accent-green-light: rgba(16, 185, 129, 0.15);
            --accent-orange: #fb923c;
            --accent-orange-light: rgba(249, 115, 22, 0.15);
            --accent-red: #ef4444;
            --accent-red-light: rgba(239, 68, 68, 0.15);

            --radius-sm: 6px;
            --radius-md: 8px;
            --radius-lg: 12px;
            --radius-xl: 16px;

            --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
        }

        /* --- Light Theme Overrides --- */
        body.light-mode {
            --bg-body: #f1f5f9; 
            --bg-surface: rgba(255, 255, 255, 0.75);
            --bg-surface-hover: rgba(255, 255, 255, 0.95);
            --border-color: rgba(0, 0, 0, 0.08);
            
            --theme-gradient-start: rgba(13, 164, 135, 0.06);  
            --theme-gradient-mid: rgba(13, 164, 135, 0.012);   
            --card-glow: linear-gradient(to top left, rgba(13, 164, 135, 0.024) 0%, transparent 60%); 
            
            --text-main: #0f172a;
            --text-muted: #64748b;
            --text-dark: #334155;
            
            --brand-primary-light: rgba(13, 164, 135, 0.1);
            --accent-purple-light: rgba(99, 102, 241, 0.1);
            --accent-blue-light: rgba(59, 130, 246, 0.1);
            --accent-green-light: rgba(16, 185, 129, 0.1);
            --accent-orange-light: rgba(249, 115, 22, 0.1);
            --accent-red-light: rgba(239, 68, 68, 0.1);

            --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
        }

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

        body {
            background-color: var(--bg-body);
            color: var(--text-main);
            display: flex;
            height: 100vh;
            overflow: hidden;
            font-size: 14px;
            transition: background-color 0.4s ease, color 0.4s ease;
        }

        /* --- Unified Background Gradient --- */
        .bg-gradient {
            position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
            z-index: -1; pointer-events: none; transition: background 0.4s ease;
        }

        /* --- Glassmorphism Utility --- */
        .glass-effect {
            background: var(--card-glow), var(--bg-surface);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
        }
        
        .sidebar, .top-header, .card, .stat-card, input, select, .btn, .pagination-btn, .action-icon-btn {
            transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
        }

        /* --- Scrollbar Customization --- */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); border-radius: 4px; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.6); }

        /* --- Global Utilities --- */
        .text-muted { color: var(--text-muted); }
        .text-main { color: var(--text-main); }
        .min-w-0 { min-width: 0; }
        
        .badge {
            padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 500; white-space: nowrap;
        }
        .badge-success { background: var(--accent-green-light); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.2); }
        .badge-purple { background: var(--accent-purple-light); color: var(--accent-purple); border: 1px solid rgba(99, 102, 241, 0.2); }
        .badge-inactive { background: rgba(255, 255, 255, 0.05); color: var(--text-muted); border: 1px solid var(--border-color); }
        
        body.light-mode .badge-inactive { background: rgba(0, 0, 0, 0.05); }

        .card { border-radius: var(--radius-lg); border: 1px solid var(--border-color); padding: 24px; box-shadow: var(--card-shadow); }

        /* --- Sidebar & Overlay --- */
        .sidebar {
            width: 260px; border-right: 1px solid var(--border-color); display: flex; flex-direction: column;
            z-index: 20; transition: width 0.3s ease, left 0.3s ease; flex-shrink: 0;
            background: var(--bg-surface); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); overflow-y: auto;
        }

        .sidebar-overlay {
            position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6);
            backdrop-filter: blur(4px); z-index: 15; display: none; opacity: 0; transition: opacity 0.3s ease;
        }
        .sidebar-overlay.active { display: block; opacity: 1; }

        .brand {
            height: 95px; min-height: 95px; padding: 0 24px; display: flex; align-items: center; gap: 12px;
            font-size: 19px; font-weight: 700; border-bottom: 1px solid var(--border-color); white-space: nowrap; overflow: hidden; flex-shrink: 0;
        }
        .brand i { color: var(--brand-primary); font-size: 26px; flex-shrink: 0; }

        .nav-section { margin-top: 20px; margin-bottom: 20px; }
        .nav-title { padding: 0 24px; font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 12px; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; }
        /* Inline group divider inside a nav-list (separates sub-groups without a full section break) */
        li.nav-section-divider { padding: 14px 24px 4px; list-style: none; }
        li.nav-section-divider .nav-section-label { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.8px; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
        .sidebar.collapsed li.nav-section-divider { padding: 10px 0 4px; text-align: center; }
        .sidebar.collapsed li.nav-section-divider .nav-section-label { font-size: 0; display: block; border-top: 1px solid var(--border-color); margin: 0 12px; }

        .nav-list { list-style: none; }
        .nav-item {
            padding: 12px 24px; display: flex; align-items: center; gap: 12px; color: var(--text-dark); text-decoration: none;
            transition: all 0.2s; cursor: pointer; margin: 2px 16px; border-radius: var(--radius-md); position: relative; white-space: nowrap;
        }
        .nav-item:hover { background-color: var(--bg-surface-hover); color: var(--text-main); }
        .nav-item.active { background-color: var(--brand-primary-light); color: var(--brand-primary); font-weight: 600; }
        .nav-item i { width: 16px; text-align: center; font-size: 16px; flex-shrink: 0; }
        .nav-item span { transition: opacity 0.2s; }
        
        .nav-badge { margin-left: auto; background-color: var(--brand-primary); color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }

        .sidebar-footer { margin-top: auto; padding: 24px 24px; border-top: 1px solid var(--border-color); font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }

        /* Collapsed Sidebar */
        .sidebar.collapsed { width: 84px; }
        .sidebar.collapsed .brand { padding: 0; justify-content: center; }
        .sidebar.collapsed .brand span { display: none; }
        .sidebar.collapsed .nav-title { text-align: center; padding: 0; font-size: 9px; }
        .sidebar.collapsed .nav-item { padding: 14px; margin: 2px 14px; justify-content: center; }
        .sidebar.collapsed .nav-item .nav-text { display: none; }
        .sidebar.collapsed .nav-badge { position: absolute; top: 4px; right: 4px; padding: 2px 4px; font-size: 9px; }
        .sidebar.collapsed .sidebar-footer .footer-text { display: none; }
        .sidebar.collapsed .sidebar-footer { padding: 24px 0; display: flex; justify-content: center; }

        /* --- Main Content Area --- */
        .main-wrapper { flex: 1; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; min-width: 0; }

        /* Top Header */
        .top-header {
            height: 95px; min-height: 95px; display: flex; align-items: center; justify-content: space-between;
            padding: 0 32px; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 10; gap: 16px;
        }

        .header-left { display: flex; align-items: center; flex: 1; min-width: 0; gap: 16px; }
        .mobile-menu-btn { display: none; } 

        .search-bar { position: relative; width: 100%; max-width: 500px; }
        .search-bar i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
        .search-bar input {
            width: 100%; background-color: var(--bg-body); border: 1px solid var(--border-color); color: var(--text-main);
            padding: 12px 16px 12px 48px; border-radius: 24px; outline: none; font-size: 13px;
        }
        .search-bar input:focus { border-color: var(--brand-primary); }
        .search-shortcut {
            position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background-color: var(--bg-surface);
            border: 1px solid var(--border-color); padding: 3px 8px; border-radius: 4px; font-size: 10px; color: var(--text-muted);
        }

        .header-actions { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
        
        .icon-btn {
            position: relative; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-muted);
            width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
            font-size: 18px; cursor: pointer; transition: 0.2s; flex-shrink: 0;
        }
        .icon-btn:hover { color: var(--text-main); border-color: var(--text-muted); }
        .icon-badge {
            position: absolute; top: -2px; right: -2px; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; font-weight: 600;
            display: flex; align-items: center; justify-content: center; color: white; border: 2px solid var(--bg-body);
        }
        .badge-red { background-color: var(--accent-red); }
        .badge-green { background-color: var(--brand-primary); }

        .user-profile { 
            display: flex; align-items: center; gap: 12px; cursor: pointer; padding-left: 12px; border-left: 1px solid var(--border-color); margin-left: 8px;
        }
        .user-profile img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--border-color);}
        .user-info .name { font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--text-main); }
        .user-info .role { font-size: 12px; color: var(--text-muted); }

        .dashboard-content { padding: 24px 32px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }

        /* --- Page Header (Breadcrumbs, Title, Actions) --- */
        .page-header-wrapper { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 4px; }
        .page-header-text { display: flex; flex-direction: column; gap: 6px; }
        .breadcrumbs { font-size: 12px; color: var(--text-muted); font-weight: 500; }
        .breadcrumbs span { color: var(--text-main); }
        .page-header-text h1 { font-size: 24px; font-weight: 600; color: var(--text-main); line-height: 1.2; }
        .page-header-text p { color: var(--text-muted); font-size: 14px; }
        
        .page-header-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
        .btn {
            display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: var(--radius-sm); font-size: 13px;
            font-weight: 500; cursor: pointer; transition: all 0.2s; white-space: nowrap; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        }
        .btn i { font-size: 14px; }
        .btn-outline { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); }
        .btn-outline:hover { background: rgba(255, 255, 255, 0.05); }
        body.light-mode .btn-outline:hover { background: rgba(0,0,0,0.05); }
        .btn-primary { background: var(--brand-primary); border: 1px solid var(--brand-primary); color: white; }
        .btn-primary:hover { background: var(--brand-primary-hover); border-color: var(--brand-primary-hover); }

        /* --- Stats Grid --- */
        .stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
        .stat-card {
            border-radius: var(--radius-md); border: 1px solid var(--border-color); padding: 20px; display: flex; 
            justify-content: space-between; align-items: center; box-shadow: var(--card-shadow); min-width: 0;
        }
        .stat-content { display: flex; flex-direction: column; min-width: 0; }
        .stat-title { color: var(--text-muted); font-size: 12px; font-weight: 500; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .stat-value { color: var(--text-main); font-size: 26px; font-weight: 600; margin-bottom: 8px; line-height: 1; }
        .stat-subtext { color: var(--text-muted); font-size: 11px; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
        .trend-up { color: var(--accent-green); font-weight: 600; }
        .trend-down { color: var(--accent-red); font-weight: 600; }

        .icon-wrapper {
            width: 48px; height: 48px; border-radius: 50%; display: flex; justify-content: center; align-items: center; flex-shrink: 0; margin-left: 12px;
        }
        .icon-wrapper i { font-size: 20px; }
        .icon-purple { background-color: var(--accent-purple-light); color: var(--accent-purple); }
        .icon-green { background-color: var(--accent-green-light); color: var(--accent-green); }
        .icon-orange { background-color: var(--accent-orange-light); color: var(--accent-orange); }
        .icon-blue { background-color: var(--accent-blue-light); color: var(--accent-blue); }
        .icon-red { background-color: var(--accent-red-light); color: var(--accent-red); }

        /* --- Table Section --- */
        .table-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
        
        .table-toolbar {
            display: flex; justify-content: space-between; align-items: center; padding: 20px 24px;
            border-bottom: 1px solid var(--border-color); flex-wrap: wrap; gap: 16px;
        }
        
        .toolbar-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; flex: 1; }
        .toolbar-search { position: relative; width: 100%; max-width: 320px; }
        .toolbar-search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px;}
        .toolbar-search input {
            width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-main);
            padding: 10px 16px 10px 42px; border-radius: var(--radius-sm); outline: none; font-size: 13px; transition: border 0.3s;
        }
        body.light-mode .toolbar-search input { background: rgba(255,255,255,0.4); }
        .toolbar-search input:focus { border-color: var(--brand-primary); }

        .toolbar-filters { display: flex; gap: 12px; flex-wrap: wrap; }
        .filter-select {
            appearance: none; -webkit-appearance: none; background: rgba(0,0,0,0.2) url('data:image/svg+xml;utf8,<svg fill="%239ca3af" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>') no-repeat right 8px center;
            border: 1px solid var(--border-color); color: var(--text-dark); padding: 10px 32px 10px 16px; border-radius: var(--radius-sm);
            font-size: 13px; outline: none; cursor: pointer; transition: 0.2s;
        }
        body.light-mode .filter-select { background-color: rgba(255,255,255,0.4); }
        .filter-select:hover { border-color: var(--text-muted); }
        .filter-select option { background: var(--bg-body); color: var(--text-main); }

        .toolbar-right { display: flex; gap: 12px; align-items: center; }

        /* Data Table Styling */
        .table-responsive { width: 100%; overflow-x: auto; }
        .data-table { width: 100%; border-collapse: collapse; min-width: 1050px; }
        
        .data-table th, .data-table td {
            padding: 16px 24px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border-color); white-space: nowrap;
        }
        
        .data-table th { color: var(--text-muted); font-weight: 500; font-size: 12px; cursor: pointer; }
        .data-table th:hover { color: var(--text-main); }
        .data-table th i { margin-left: 4px; font-size: 10px; }
        .data-table tr:hover td { background-color: rgba(255,255,255,0.015); }
        body.light-mode .data-table tr:hover td { background-color: rgba(0,0,0,0.015); }
        .data-table tr:last-child td { border-bottom: none; }
        
        .data-table td { color: var(--text-dark); vertical-align: middle; }
        
        .patient-cell { display: flex; align-items: center; gap: 12px; }
        .patient-cell img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); }
        
        /* Custom Checkbox */
        .custom-checkbox {
            appearance: none; background-color: transparent; border: 1px solid var(--text-muted);
            width: 16px; height: 16px; border-radius: 4px; display: inline-block; position: relative; cursor: pointer;
        }
        .custom-checkbox:checked { background-color: var(--brand-primary); border-color: var(--brand-primary); }
        .custom-checkbox:checked::after {
            content: ''; position: absolute; left: 5px; top: 1px; width: 4px; height: 9px;
            border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg);
        }

        .action-group { display: flex; gap: 8px; }
        .action-icon-btn {
            width: 32px; height: 32px; border-radius: var(--radius-sm); background: rgba(0,0,0,0.2); border: 1px solid var(--border-color);
            color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px;
        }
        body.light-mode .action-icon-btn { background: rgba(255,255,255,0.4); }
        .action-icon-btn:hover { background: var(--bg-surface-hover); color: var(--text-main); border-color: var(--text-muted); }

        /* Pagination Footer */
        .pagination-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-top: 1px solid var(--border-color); flex-wrap: wrap; gap: 16px; }
        .pagination-info { font-size: 13px; color: var(--text-muted); }
        
        .pagination-controls { display: flex; align-items: center; gap: 8px; }
        .page-btn {
            width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm);
            background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-muted); cursor: pointer; font-size: 13px; text-decoration: none;
        }
        body.light-mode .page-btn { background: rgba(255,255,255,0.4); }
        .page-btn:hover:not(.active) { background: var(--bg-surface-hover); color: var(--text-main); }
        .page-btn.active { background: var(--brand-primary); border-color: var(--brand-primary); color: white; }
        .page-dots { color: var(--text-muted); }

        /* ================================
           Responsive Media Queries 
           ================================ */
        @media (max-width: 1400px) {
            .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        }
        @media (max-width: 992px) {
            .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .toolbar-left, .toolbar-right { width: 100%; justify-content: flex-start; }
            .toolbar-search { max-width: 100%; }
        }
        
        /* Mobile Breakpoint */
        @media (max-width: 768px) {
            .mobile-menu-btn { display: flex !important; }
            
            /* Sidebar off-canvas */
            .sidebar { position: fixed; top: 0; left: -260px; height: 100vh; box-shadow: 2px 0 15px rgba(0,0,0,0.5); }
            .sidebar.mobile-open { left: 0; }
            .sidebar.collapsed { width: 260px; } 
            .sidebar.collapsed .brand span, .sidebar.collapsed .nav-item .nav-text, .sidebar.collapsed .sidebar-footer .footer-text { display: inline-block; }
            .sidebar.collapsed .nav-title { text-align: left; padding: 0 24px; font-size: 11px; }
            .sidebar.collapsed .nav-item { padding: 12px 24px; margin: 2px 16px; justify-content: flex-start; }
            .sidebar.collapsed .brand { justify-content: flex-start; padding: 0 24px; }
            .sidebar.collapsed .nav-badge { position: static; padding: 2px 8px; font-size: 11px; }
            
            #collapseBtn { display: none; }
            
            .top-header { height: 80px; min-height: 80px; padding: 0 16px; }
            .brand { height: 80px; min-height: 80px; }
            
            .dashboard-content { padding: 16px; gap: 16px; }
            .search-shortcut { display: none; }
            .card { padding: 16px; }
            
            .page-header-wrapper { flex-direction: column; align-items: flex-start; gap: 16px; }
            .page-header-actions { width: 100%; justify-content: flex-start; }
            
            .pagination-footer { flex-direction: column; align-items: center; text-align: center; }
        }

        /* Smaller Mobiles */
        @media (max-width: 600px) {
            .stats-grid { grid-template-columns: 1fr; }
            .header-actions { gap: 10px; }
            .user-profile { padding-left: 0; border-left: none; margin-left: 0; }
            .user-info { display: none; }
            .user-profile i { display: none; }
            .icon-btn { width: 38px; height: 38px; font-size: 16px; }
            .user-profile img { width: 38px; height: 38px; }
            .search-bar input { padding: 10px 14px 10px 36px; font-size: 12px; }
            .search-bar i { left: 14px; font-size: 13px; }
            .page-header-text h1 { font-size: 20px; }
            
            .toolbar-filters { flex-direction: column; width: 100%; }
            .filter-select { width: 100%; }
            .btn { width: 100%; justify-content: center; }
        }
    

/* --- Additive tokens harvested from other theme files (Appointments.html) --- */
:root { --accent-teal: #14b8a6; --accent-teal-light: rgba(20, 184, 166, 0.15); }



/* ================================================================
   NEW COMPONENTS (built to theme standards — handover Sec 5.3 / 6)
   Not present in the theme HTML files; created in the theme's visual
   language (tokens, radii, brand color) for HMS needs.
   ================================================================ */

/* Toggle switch — used for status columns (e.g. patient active/inactive) */
.ax-switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.ax-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.ax-switch .ax-switch-slider {
    position: absolute; inset: 0; border-radius: 999px;
    background: rgba(148, 163, 184, 0.3); border: 1px solid var(--border-color);
    transition: background-color 0.25s ease, border-color 0.25s ease;
}
.ax-switch .ax-switch-slider::before {
    content: ''; position: absolute; height: 16px; width: 16px; left: 2px; top: 2px;
    border-radius: 50%; background: #fff; transition: transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.ax-switch input:checked + .ax-switch-slider { background: var(--brand-primary); border-color: var(--brand-primary); }
.ax-switch input:checked + .ax-switch-slider::before { transform: translateX(18px); }
.ax-switch input:focus-visible + .ax-switch-slider { box-shadow: 0 0 0 3px var(--brand-primary-light); }

/* Ensure toolbar action buttons in the table header align nicely */
.table-toolbar .toolbar-right .btn { text-decoration: none; }
.table-toolbar .toolbar-left .filter-select { min-width: 140px; }


/* ================================================================
   SHELL SUPPORT — header dropdown panels, footer, modal shim.
   New components built to theme standards (handover Sec 5.3 / 6).
   ================================================================ */

[x-cloak] { display: none !important; }

/* Header dropdown panels (notifications / profile) */
.ax-menu-panel {
    position: absolute; top: calc(100% + 10px);
    background: var(--card-glow), var(--bg-surface);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color); border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow); z-index: 50; overflow: hidden;
}
.ax-menu-panel__head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--border-color);
    font-weight: 600; font-size: .9rem; color: var(--text-main);
}
.ax-menu-panel__head a { color: var(--brand-primary); text-decoration: none; font-size: .78rem; }
.ax-menu-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 11px 16px; background: transparent; border: none;
    color: var(--text-dark); font-size: .85rem; text-align: left;
    cursor: pointer; text-decoration: none; transition: background-color .15s ease;
}
.ax-menu-item:hover { background: var(--bg-surface-hover); color: var(--text-main); }
.ax-menu-item i { width: 16px; text-align: center; color: var(--text-muted); }
.ax-menu-item:hover i { color: var(--brand-primary); }

/* Footer */
.ax-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 32px; border-top: 1px solid var(--border-color);
    font-size: 12px; gap: 12px; flex-wrap: wrap; margin-top: auto;
}

/* Modal shim (Bootstrap-modal markup, no Bootstrap JS/CSS) */
.ax-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px); z-index: 1040;
}
body.ax-modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 1050; overflow-y: auto; display: none; }
.modal.show { display: block; }
.modal .modal-dialog {
    max-width: 560px; margin: 6vh auto; padding: 0 16px;
    position: relative; z-index: 1051;
}
.modal .modal-dialog.modal-lg { max-width: 800px; }
.modal .modal-dialog.modal-dialog-centered { margin: 10vh auto; }
.modal .modal-content {
    background: var(--card-glow), var(--bg-surface);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color); border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow); color: var(--text-main); overflow: hidden;
}
.modal .modal-header,
.modal .modal-footer {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--border-color);
}
.modal .modal-footer { border-bottom: none; border-top: 1px solid var(--border-color); justify-content: flex-end; }
.modal .modal-title { font-size: 16px; font-weight: 600; }
.modal .modal-body { padding: 20px; }
.modal .btn-close {
    margin-left: auto; background: transparent; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 18px; line-height: 1;
}
.modal .btn-close::before { content: '\00d7'; }


/* Loading skeleton pulse */
@keyframes ax-pulse { 0%,100% { opacity: .55; } 50% { opacity: .2; } }
.sk-pulse {
    background: rgba(148, 163, 184, 0.25);
    animation: ax-pulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .sk-pulse { animation: none; } }


/* ================================================================
   PAGE: Appointments  (scoped under .ax-appointments — Lesson 3)
   Source: /root/theme_study/Appointments.html. Class names here
   (stat-card, table-toolbar, patient-cell, data-table, filter-select,
   action-icon-btn, page-btn...) intentionally DIFFER from the global
   base, so they are scoped to this page only.
   ================================================================ */
.ax-appointments .text-teal { color: var(--accent-teal); }
.ax-appointments .text-blue { color: var(--accent-blue); }
.ax-appointments .text-purple { color: var(--accent-purple); }
.ax-appointments .font-semibold { font-weight: 600; }

.ax-appointments .badge-blue { background: var(--accent-blue-light); color: var(--accent-blue); border: 1px solid rgba(59,130,246,.2); }
.ax-appointments .badge-orange { background: var(--accent-orange-light); color: var(--accent-orange); border: 1px solid rgba(245,158,11,.2); }
.ax-appointments .badge-teal { background: var(--accent-teal-light); color: var(--accent-teal); border: 1px solid rgba(20,184,166,.2); }
.ax-appointments .badge-red { background: var(--accent-red-light); color: var(--accent-red); border: 1px solid rgba(239,68,68,.2); }

.ax-appointments .layout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.ax-appointments .main-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.ax-appointments .right-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.ax-appointments .stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.ax-appointments .stat-card { border-radius: var(--radius-md); border: 1px solid var(--border-color); padding: 16px; display: flex; align-items: flex-start; gap: 14px; box-shadow: var(--card-shadow); }
.ax-appointments .stat-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 18px; flex-shrink: 0; }
.ax-appointments .stat-content { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.ax-appointments .stat-title { color: var(--text-muted); font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1; }
.ax-appointments .stat-value { color: var(--text-main); font-size: 24px; font-weight: 600; line-height: 1; }
.ax-appointments .stat-subtext { font-size: 11px; display: flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--text-muted); }

.ax-appointments .table-card { padding: 0; overflow: hidden; }
.ax-appointments .table-toolbar { padding: 24px 24px 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.ax-appointments .toolbar-search { position: relative; width: 100%; max-width: none; }
.ax-appointments .toolbar-search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.ax-appointments .toolbar-search input { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-main); padding: 12px 16px 12px 42px; border-radius: var(--radius-sm); outline: none; font-size: 13px; }
body.light-mode .ax-appointments .toolbar-search input { background: rgba(255,255,255,0.4); }
.ax-appointments .toolbar-search input:focus { border-color: var(--brand-primary); }
.ax-appointments .toolbar-filters-row { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; }
.ax-appointments .filters-group-wrap { display: flex; gap: 12px; flex-wrap: wrap; flex: 1; }
.ax-appointments .filter-col { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; max-width: 200px; }
.ax-appointments .filter-col label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.ax-appointments .filter-select { appearance: none; -webkit-appearance: none; background: rgba(0,0,0,0.2) url('data:image/svg+xml;utf8,<svg fill="%239ca3af" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>') no-repeat right 12px center; border: 1px solid var(--border-color); color: var(--text-main); padding: 10px 32px 10px 16px; border-radius: var(--radius-sm); font-size: 13px; outline: none; cursor: pointer; width: 100%; }
body.light-mode .ax-appointments .filter-select { background-color: rgba(255,255,255,0.4); }
.ax-appointments .filter-select option { background: var(--bg-body); color: var(--text-main); }
.ax-appointments .toolbar-actions { display: flex; gap: 10px; align-items: center; }

.ax-appointments .table-tabs { display: flex; gap: 24px; padding: 0 24px; border-bottom: 1px solid var(--border-color); overflow-x: auto; white-space: nowrap; }
.ax-appointments .tab-item { padding: 12px 0; color: var(--text-muted); font-weight: 500; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; text-decoration: none; transition: 0.2s; background: none; border-left: none; border-right: none; border-top: none; }
.ax-appointments .tab-item:hover { color: var(--text-main); }
.ax-appointments .tab-item.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }

.ax-appointments .table-responsive { width: 100%; overflow-x: auto; }
.ax-appointments .data-table { width: 100%; border-collapse: collapse; min-width: 1050px; }
.ax-appointments .data-table th, .ax-appointments .data-table td { padding: 16px 24px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border-color); white-space: nowrap; vertical-align: middle; }
.ax-appointments .data-table th { color: var(--text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.ax-appointments .data-table tr:hover td { background-color: rgba(255,255,255,0.015); }
body.light-mode .ax-appointments .data-table tr:hover td { background-color: rgba(0,0,0,0.015); }
.ax-appointments .data-table tr:last-child td { border-bottom: none; }
.ax-appointments .data-table tr { cursor: pointer; }

.ax-appointments .time-cell { display: flex; flex-direction: column; gap: 4px; }
.ax-appointments .time-primary { font-size: 13px; font-weight: 600; color: var(--text-main); }
.ax-appointments .time-secondary { font-size: 11px; font-weight: 500; }
.ax-appointments .patient-cell { display: flex; align-items: center; gap: 14px; }
.ax-appointments .patient-cell img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); flex-shrink: 0; }
.ax-appointments .patient-info { display: flex; flex-direction: column; gap: 3px; }
.ax-appointments .p-name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.ax-appointments .p-meta, .ax-appointments .p-phone { font-size: 11px; color: var(--text-muted); }
.ax-appointments .doc-cell { display: flex; align-items: center; gap: 10px; }
.ax-appointments .doc-icon { color: var(--brand-primary); font-size: 16px; }
.ax-appointments .doc-info { display: flex; flex-direction: column; gap: 3px; }
.ax-appointments .doc-name { font-size: 13px; font-weight: 500; color: var(--text-main); }
.ax-appointments .doc-spec { font-size: 11px; color: var(--text-muted); }
.ax-appointments .dept-cell { display: flex; align-items: center; gap: 10px; }
.ax-appointments .dept-icon-wrap { width: 32px; height: 32px; border-radius: 8px; display: flex; justify-content: center; align-items: center; font-size: 14px; flex-shrink: 0; background: var(--brand-primary-light); color: var(--brand-primary); }
.ax-appointments .dept-name { font-size: 13px; font-weight: 500; color: var(--text-main); }
.ax-appointments .action-group { display: flex; gap: 6px; }
.ax-appointments .action-icon-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; text-decoration: none; }
.ax-appointments .action-icon-btn:hover { background: var(--bg-surface-hover); color: var(--text-main); border-color: var(--text-muted); }

.ax-appointments .pagination-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-top: 1px solid var(--border-color); flex-wrap: wrap; gap: 16px; }
.ax-appointments .pagination-info { font-size: 12px; color: var(--text-muted); }
.ax-appointments .pagination-controls { display: flex; align-items: center; gap: 6px; }
.ax-appointments .page-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-muted); cursor: pointer; font-size: 12px; }
body.light-mode .ax-appointments .page-btn { background: rgba(255,255,255,0.4); }
.ax-appointments .page-btn:hover:not(.active) { background: var(--bg-surface-hover); color: var(--text-main); }
.ax-appointments .page-btn.active { background: var(--brand-primary); border-color: var(--brand-primary); color: white; }
.ax-appointments .page-dots { color: var(--text-muted); margin: 0 4px; }

.ax-appointments .calendar-card { padding: 20px; }
.ax-appointments .calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-weight: 600; color: var(--text-main); font-size: 14px; }
.ax-appointments .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 10px 4px; font-size: 12px; margin-bottom: 16px; }
.ax-appointments .calendar-day-header { color: var(--text-muted); font-size: 11px; font-weight: 500; }
.ax-appointments .calendar-day { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; margin: 0 auto; border-radius: 50%; cursor: pointer; color: var(--text-dark); }
.ax-appointments .calendar-day:hover:not(.empty):not(.active) { background: rgba(255,255,255,0.1); color: var(--text-main); }
body.light-mode .ax-appointments .calendar-day:hover:not(.empty):not(.active) { background: rgba(0,0,0,0.05); }
.ax-appointments .calendar-day.empty { color: transparent; cursor: default; }
.ax-appointments .calendar-day.muted { color: var(--text-muted); opacity: 0.5; }
.ax-appointments .calendar-day.active { background: var(--brand-primary); color: white; font-weight: 600; box-shadow: 0 4px 10px rgba(13,164,135,0.4); }
.ax-appointments .calendar-day.booked { border: 1px solid var(--accent-teal); }
.ax-appointments .calendar-legend { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--text-muted); border-top: 1px solid var(--border-color); padding-top: 12px; }
.ax-appointments .legend-item { display: flex; align-items: center; gap: 4px; }
.ax-appointments .legend-dot { width: 8px; height: 8px; border-radius: 50%; }

.ax-appointments .details-card { padding: 20px; position: relative; }
.ax-appointments .details-title { font-size: 14px; font-weight: 600; color: var(--text-main); margin-bottom: 20px; }
.ax-appointments .details-profile { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.ax-appointments .details-profile img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color); }
.ax-appointments .details-p-info { display: flex; flex-direction: column; gap: 4px; }
.ax-appointments .details-p-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ax-appointments .details-p-mrn { font-size: 11px; color: var(--text-muted); }
.ax-appointments .details-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.ax-appointments .details-item { display: flex; gap: 12px; align-items: flex-start; }
.ax-appointments .details-icon { width: 20px; color: var(--text-muted); font-size: 13px; text-align: center; margin-top: 2px; }
.ax-appointments .details-text-group { display: flex; flex-direction: column; gap: 2px; }
.ax-appointments .details-label { font-size: 11px; color: var(--text-muted); }
.ax-appointments .details-value { font-size: 12px; color: var(--text-main); font-weight: 500; line-height: 1.4; }
.ax-appointments .details-actions { display: flex; gap: 10px; }
.ax-appointments .action-box { flex: 1; border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; background: rgba(0,0,0,0.2); text-decoration: none; }
body.light-mode .ax-appointments .action-box { background: rgba(255,255,255,0.4); }
.ax-appointments .action-box:hover { background: var(--bg-surface-hover); border-color: currentColor; }
.ax-appointments .action-box i { font-size: 16px; }
.ax-appointments .action-box span { font-size: 11px; font-weight: 500; text-align: center; }
.ax-appointments .box-teal { color: var(--accent-teal); }
.ax-appointments .box-blue { color: var(--accent-blue); }
.ax-appointments .box-red { color: var(--accent-red); }

.ax-appointments .quick-actions-wrap { display: flex; flex-direction: column; gap: 16px; }
.ax-appointments .quick-actions-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ax-appointments .quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ax-appointments .qa-box { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; background: rgba(0,0,0,0.2); transition: 0.2s; text-decoration: none; }
body.light-mode .ax-appointments .qa-box { background: rgba(255,255,255,0.4); }
.ax-appointments .qa-box:hover { background: var(--bg-surface-hover); border-color: currentColor; transform: translateY(-2px); }
.ax-appointments .qa-box i { font-size: 18px; }
.ax-appointments .qa-box span { font-size: 10px; font-weight: 500; text-align: center; }
.ax-appointments .qa-teal { color: var(--accent-teal); }
.ax-appointments .qa-orange { color: var(--accent-orange); }
.ax-appointments .qa-purple { color: var(--accent-purple); }
.ax-appointments .qa-green { color: var(--accent-green); }

@media (max-width: 1400px) {
    .ax-appointments .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .ax-appointments .layout-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1200px) {
    .ax-appointments .layout-grid { grid-template-columns: 1fr; }
    .ax-appointments .right-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
}
@media (max-width: 768px) {
    .ax-appointments .toolbar-filters-row { flex-direction: column; align-items: stretch; }
    .ax-appointments .filter-col { max-width: 100%; }
}


/* ================================================================
   THEME FORMS (create/edit modals + form pages) — Sec 5.3
   ================================================================ */
.ax-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ax-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ax-field-full { grid-column: 1 / -1; }
.ax-field label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.ax-field input,
.ax-field select,
.ax-field textarea {
    width: 100%; background: var(--bg-body); border: 1px solid var(--border-color);
    color: var(--text-main); padding: 10px 14px; border-radius: var(--radius-md);
    outline: none; font-size: 13px; font-family: inherit; transition: border-color .2s;
}
.ax-field textarea { resize: vertical; min-height: 72px; }
.ax-field input:focus,
.ax-field select:focus,
.ax-field textarea:focus { border-color: var(--brand-primary); }
.ax-field select option { background: var(--bg-body); color: var(--text-main); }
.ax-field-error { color: var(--accent-red); font-size: 11px; }
@media (max-width: 640px) { .ax-form-grid { grid-template-columns: 1fr; } }

/* ===== Theme form sections (create/edit pages) ===== */
.ax-form-section {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 22px 0 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.ax-form-section:first-child { margin-top: 0; }
.ax-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

/* ===== Patient Profile (from theme_study/PatientProfile.html), scoped ===== */
.ax-patient-profile { display: flex; flex-direction: column; gap: 24px; }
.ax-patient-profile .profile-header-card { display: flex; gap: 32px; align-items: stretch; flex-wrap: wrap; padding: 32px; border-radius: var(--radius-lg); border: 1px solid var(--border-color); }
.ax-patient-profile .profile-main { display: flex; gap: 24px; align-items: center; flex-shrink: 0; }
.ax-patient-profile .profile-avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--bg-surface); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.ax-patient-profile .profile-name-sec h1 { font-size: 26px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; color: var(--text-main); line-height: 1; }
.ax-patient-profile .profile-name-sec h1 i { color: var(--accent-blue); font-size: 20px; }
.ax-patient-profile .profile-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.ax-patient-profile .profile-details-grid { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; border-left: 1px solid var(--border-color); padding-left: 32px; }
.ax-patient-profile .detail-item { display: flex; flex-direction: column; gap: 4px; }
.ax-patient-profile .detail-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.ax-patient-profile .detail-value { font-size: 13px; color: var(--text-main); font-weight: 500; }
.ax-patient-profile .allergy-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ax-patient-profile .allergy-tag { padding: 2px 8px; border-radius: 4px; font-size: 11px; background: rgba(239, 68, 68, 0.1); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.2); }

.ax-patient-profile .pp-stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.ax-patient-profile .stat-box { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-surface); }
.ax-patient-profile .stat-icon { width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.ax-patient-profile .stat-info { display: flex; flex-direction: column; gap: 4px; }
.ax-patient-profile .stat-info span { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.ax-patient-profile .stat-info h4 { font-size: 15px; font-weight: 600; color: var(--text-main); }
.ax-patient-profile .icon-bg-blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.ax-patient-profile .icon-bg-purple { background: var(--accent-purple-light); color: var(--accent-purple); }
.ax-patient-profile .icon-bg-green { background: var(--accent-green-light); color: var(--accent-green); }
.ax-patient-profile .icon-bg-orange { background: var(--accent-orange-light); color: var(--accent-orange); }
.ax-patient-profile .icon-bg-red { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }

.ax-patient-profile .tabs-container { display: flex; gap: 32px; border-bottom: 1px solid var(--border-color); margin-top: 8px; overflow-x: auto; white-space: nowrap; }
.ax-patient-profile .tab-item { padding: 12px 0; color: var(--text-muted); font-weight: 500; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; text-decoration: none; background: none; }
.ax-patient-profile .tab-item:hover { color: var(--text-main); }
.ax-patient-profile .tab-item.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }
.ax-patient-profile .ax-tab-pane { display: none; }
.ax-patient-profile .ax-tab-pane.active { display: block; }
.ax-patient-profile .pp-content-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }

.ax-patient-profile .simple-table { width: 100%; border-collapse: collapse; }
.ax-patient-profile .simple-table th { padding: 8px 0; font-size: 11px; text-align: left; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border-color); text-transform: uppercase; }
.ax-patient-profile .simple-table td { padding: 10px 0; font-size: 12px; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.ax-patient-profile .simple-table tr:last-child td { border-bottom: none; }
.ax-patient-profile .contact-box { display: flex; justify-content: space-between; align-items: center; }
.ax-patient-profile .contact-box .btn-call { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--accent-red); color: #fff; border: none; display: flex; justify-content: center; align-items: center; cursor: pointer; font-size: 14px; text-decoration: none; transition: 0.2s; }
.ax-patient-profile .contact-box .btn-call:hover { filter: brightness(1.1); }
.ax-patient-profile .insurance-box { display: flex; justify-content: space-between; align-items: flex-end; }
.ax-patient-profile .insurance-verified { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--accent-green-light); color: var(--accent-green); display: flex; justify-content: center; align-items: center; font-size: 14px; }

/* Overview grid + Vitals card — exact match to PatientProfile.html */
.ax-patient-profile .overview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; align-items: start; }
.ax-patient-profile .col-stack { display: flex; flex-direction: column; gap: 20px; }
.ax-patient-profile .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.ax-patient-profile .card-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ax-patient-profile .view-all { font-size: 12px; color: var(--brand-primary); text-decoration: none; font-weight: 500; }
.ax-patient-profile .vitals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.ax-patient-profile .vital-item { display: flex; flex-direction: column; gap: 4px; }
.ax-patient-profile .vital-label { font-size: 11px; color: var(--text-muted); }
.ax-patient-profile .vital-val { font-size: 16px; font-weight: 600; color: var(--text-main); display: flex; align-items: baseline; gap: 4px; }
.ax-patient-profile .vital-unit { font-size: 10px; color: var(--text-muted); font-weight: 400; }
.ax-patient-profile .vitals-footer { display: flex; justify-content: space-between; border-top: 1px solid var(--border-color); padding-top: 12px; font-size: 11px; color: var(--text-muted); }
.ax-patient-profile .item-list { display: flex; flex-direction: column; gap: 16px; }
.ax-patient-profile .list-item { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.ax-patient-profile .list-item-left { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.ax-patient-profile .item-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.ax-patient-profile .item-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ax-patient-profile .item-sub { font-size: 11px; color: var(--text-muted); }
.ax-patient-profile .visit-date { font-size: 12px; font-weight: 500; color: var(--text-main); }
.ax-patient-profile .action-arrow { color: var(--text-muted); font-size: 12px; padding-left: 8px; cursor: pointer; }
.ax-patient-profile .action-arrow:hover { color: var(--text-main); }
.ax-patient-profile .notes-content { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 12px; }
.ax-patient-profile .notes-author { display: flex; gap: 10px; align-items: center; }
.ax-patient-profile .notes-author img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.ax-patient-profile .text-green { color: var(--accent-green); }
.ax-patient-profile .font-semibold { font-weight: 600; }
.ax-patient-profile .badge-purple { background: var(--accent-purple-light); color: var(--accent-purple); border: 1px solid rgba(99, 102, 241, 0.2); }

@media (max-width: 1200px) { .ax-patient-profile .overview-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .ax-patient-profile .overview-grid { grid-template-columns: 1fr; } .ax-patient-profile .vitals-grid { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 1024px) {
    .ax-patient-profile .profile-header-card { flex-direction: column; padding: 24px; gap: 24px; }
    .ax-patient-profile .profile-details-grid { border-left: none; padding-left: 0; padding-top: 24px; border-top: 1px solid var(--border-color); }
    .ax-patient-profile .pp-stats-grid { grid-template-columns: repeat(3, 1fr); }
    .ax-patient-profile .pp-content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .ax-patient-profile .profile-details-grid { grid-template-columns: 1fr; gap: 16px; }
    .ax-patient-profile .pp-stats-grid { grid-template-columns: 1fr 1fr; }
    .ax-patient-profile .profile-main { flex-direction: column; text-align: center; }
    .ax-patient-profile .profile-badges { justify-content: center; }
}

/* ===== Bed Management (from theme_study/BedManagement.html), scoped ===== */
.ax-bed-status { display: flex; flex-direction: column; gap: 24px; }
.ax-bed-status .stat-subtext { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.ax-bed-status .icon-yellow { background-color: var(--accent-orange-light); color: var(--accent-orange); }
.ax-bed-status .content-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.ax-bed-status .overview-card { padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.ax-bed-status .overview-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ax-bed-status .donut-container { display: flex; justify-content: center; align-items: center; padding: 10px 0; }
.ax-bed-status .donut-chart { position: relative; width: 140px; height: 140px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.ax-bed-status .donut-hole { width: 100px; height: 100px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg-surface); }
.ax-bed-status .donut-hole span:first-child { font-size: 24px; font-weight: 700; color: var(--text-main); line-height: 1.1; }
.ax-bed-status .donut-hole span:last-child { font-size: 11px; color: var(--text-muted); }
.ax-bed-status .legend-list { display: flex; flex-direction: column; gap: 12px; }
.ax-bed-status .legend-row { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.ax-bed-status .legend-left { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.ax-bed-status .legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ax-bed-status .legend-val { color: var(--text-main); }
.ax-bed-status .table-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ax-bed-status .table-tabs { display: flex; gap: 24px; padding: 0 24px; border-bottom: 1px solid var(--border-color); overflow-x: auto; white-space: nowrap; margin-top: 12px; }
.ax-bed-status .table-tabs .tab-item { padding: 14px 0; color: var(--text-muted); font-weight: 500; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; text-decoration: none; }
.ax-bed-status .table-tabs .tab-item:hover { color: var(--text-main); }
.ax-bed-status .table-tabs .tab-item.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }
.ax-bed-status .badge-blue { background: var(--accent-blue-light); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.2); }
.ax-bed-status .badge-yellow { background: var(--accent-orange-light); color: var(--accent-orange); border: 1px solid rgba(245, 158, 11, 0.2); }
.ax-bed-status .badge-purple { background: var(--accent-purple-light); color: var(--accent-purple); border: 1px solid rgba(99, 102, 241, 0.2); }
.ax-bed-status .btn-full { width: 100%; }
.ax-bed-status .p-name { font-size: 12px; color: var(--text-main); font-weight: 500; }
.ax-bed-status .p-mrn { font-size: 10px; color: var(--text-muted); }
.ax-bed-status .p-info { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 900px) { .ax-bed-status .content-grid { grid-template-columns: 1fr; } }

/* ===== Queue & Triage (from theme_study/QueueTriage.html), scoped ===== */
.ax-queue-triage { display: flex; flex-direction: column; gap: 24px; }
.ax-queue-triage .stat-subtext { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.ax-queue-triage .icon-red { background: var(--accent-red-light); color: var(--accent-red); }
/* 8-card stats row scoped to queue-triage page */
.ax-queue-triage .stats-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
/* Full-width table — no sidebar needed now that priority cards are in the stats bar */
.ax-queue-triage .triage-layout { display: block; }
.ax-queue-triage .table-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ax-queue-triage .table-tabs { display: flex; gap: 24px; padding: 0 24px; border-bottom: 1px solid var(--border-color); overflow-x: auto; white-space: nowrap; margin-top: 12px; }
.ax-queue-triage .table-tabs .tab-item { padding: 14px 0; color: var(--text-muted); font-weight: 500; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; text-decoration: none; }
.ax-queue-triage .table-tabs .tab-item:hover { color: var(--text-main); }
.ax-queue-triage .table-tabs .tab-item.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }
.ax-queue-triage .table-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; flex-wrap: wrap; gap: 12px; border-bottom: 1px solid var(--border-color); }
.ax-queue-triage .toolbar-search { position: relative; width: 100%; max-width: 320px; }
.ax-queue-triage .toolbar-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 12px; }
.ax-queue-triage .toolbar-search input { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-main); padding: 10px 14px 10px 36px; border-radius: var(--radius-sm); outline: none; font-size: 12px; }
body.light-mode .ax-queue-triage .toolbar-search input { background: rgba(255,255,255,0.4); }
.ax-queue-triage .p-name { font-size: 12px; color: var(--text-main); font-weight: 500; }
.ax-queue-triage .p-sub { font-size: 10px; color: var(--text-muted); }
.ax-queue-triage .p-info { display: flex; flex-direction: column; gap: 2px; }
.ax-queue-triage .badge-critical { background: var(--accent-red-light); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.2); }
.ax-queue-triage .badge-urgent { background: var(--accent-orange-light); color: var(--accent-orange); border: 1px solid rgba(249, 115, 22, 0.2); }
.ax-queue-triage .badge-normal { background: var(--accent-green-light); color: var(--accent-green); border: 1px solid rgba(16, 185, 129, 0.2); }
.ax-queue-triage .badge-status-waiting { background: rgba(59, 130, 246, 0.1); color: var(--accent-blue); }
.ax-queue-triage .badge-status-triage { background: var(--accent-orange-light); color: var(--accent-orange); }
.ax-queue-triage .badge-status-called { background: var(--accent-purple-light); color: var(--accent-purple); }
.ax-queue-triage .badge-status-consultation { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); }
.ax-queue-triage .badge-status-completed { background: var(--accent-green-light); color: var(--accent-green); }
.ax-queue-triage .action-btn { background: transparent; border: 1px solid var(--brand-primary); color: var(--brand-primary); padding: 5px 12px; border-radius: 4px; font-size: 11px; font-weight: 500; cursor: pointer; text-decoration: none; }
.ax-queue-triage .action-btn:hover { background: var(--brand-primary); color: #fff; }
.ax-queue-triage .section-title { font-size: 13px; font-weight: 600; color: var(--text-main); }
.ax-queue-triage .vitals-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ax-queue-triage .widget-card { padding: 20px; }
.ax-queue-triage .priority-overview { display: flex; flex-direction: column; gap: 12px; }
.ax-queue-triage .priority-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
/* Triage slide-over modal */
.triage-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1040; display: flex; justify-content: flex-end; animation: triage-fade-in 0.18s ease; }
.triage-modal-panel { width: 100%; max-width: 520px; height: 100vh; overflow-y: auto; background: var(--bg-surface); box-shadow: -8px 0 40px rgba(0,0,0,0.3); display: flex; flex-direction: column; animation: triage-slide-in 0.22s ease; }
.triage-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.triage-modal-header h2 { font-size: 15px; font-weight: 600; color: var(--text-main); margin: 0; }
.triage-modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 4px; }
.triage-modal-close:hover { background: var(--border-color); color: var(--text-main); }
.triage-modal-body { padding: 24px; display: flex; flex-direction: column; gap: 20px; flex: 1; }
.triage-selected-patient { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: rgba(0,0,0,0.06); }
body.light-mode .triage-selected-patient { background: rgba(0,0,0,0.03); }
.triage-selected-patient img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.triage-selected-patient .p-name { font-size: 14px; font-weight: 600; }
.triage-selected-patient .p-sub { font-size: 11px; }
@keyframes triage-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes triage-slide-in { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@media (max-width: 1400px) { .ax-queue-triage .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 860px) { .ax-queue-triage .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ax-queue-triage .vitals-list { grid-template-columns: 1fr; } .triage-modal-panel { max-width: 100%; } }

/* ===== Reports & Analytics (from theme_study/ReportsAnalysis.html), scoped ===== */
.ax-reports { display: flex; flex-direction: column; gap: 24px; }
.ax-reports .controls-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; flex-wrap: wrap; gap: 16px; }
.ax-reports .stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.ax-reports .stat-card { background: var(--bg-surface); padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 12px; }
.ax-reports .stat-header { display: flex; align-items: center; gap: 12px; }
.ax-reports .stat-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; background: rgba(255,255,255,0.05); }
body.light-mode .ax-reports .stat-icon { background: rgba(0,0,0,0.04); }
.ax-reports .stat-icon.icon-blue { color: var(--accent-blue); }
.ax-reports .stat-icon.icon-purple { color: var(--accent-purple); }
.ax-reports .stat-icon.icon-teal { color: var(--brand-primary); }
.ax-reports .stat-icon.icon-green { color: var(--accent-green); }
.ax-reports .stat-icon.icon-orange { color: var(--accent-orange); }
.ax-reports .stat-title { font-size: 11.5px; color: var(--text-muted); }
.ax-reports .stat-value { font-size: 22px; font-weight: 600; color: var(--text-main); line-height: 1; margin-bottom: 4px; }
.ax-reports .stat-trend { font-size: 10px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.ax-reports .trend-up { color: var(--accent-green); font-size: 10px; font-weight: 500; }
.ax-reports .trend-down { color: var(--accent-red); font-size: 10px; font-weight: 500; }
.ax-reports .reports-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.ax-reports .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.ax-reports .card-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ax-reports .trend-chart-area { flex: 1; display: flex; flex-direction: column; position: relative; margin-top: 10px; }
.ax-reports .chart-legend { display: flex; justify-content: center; gap: 16px; margin-bottom: 12px; font-size: 10px; color: var(--text-muted); }
.ax-reports .chart-legend-item { display: flex; align-items: center; gap: 4px; }
.ax-reports .dot-blue { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-blue); }
.ax-reports .dot-green { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-primary); }
.ax-reports .chart-svg-container { width: 100%; height: 130px; position: relative; margin-bottom: 10px; }
.ax-reports .chart-y-axis { position: absolute; left: 0; top: 0; bottom: 15px; display: flex; flex-direction: column; justify-content: space-between; font-size: 9px; color: var(--text-muted); width: 25px; }
.ax-reports .chart-x-axis { position: absolute; left: 30px; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: 9px; color: var(--text-muted); }
.ax-reports .chart-lines { position: absolute; left: 30px; right: 0; top: 5px; bottom: 15px; }
.ax-reports .trend-totals { display: flex; gap: 32px; border-top: 1px solid var(--border-color); padding-top: 12px; margin-top: auto; }
.ax-reports .tot-box { display: flex; flex-direction: column; gap: 2px; }
.ax-reports .tot-label { font-size: 10px; color: var(--accent-blue); }
.ax-reports .tot-label.green { color: var(--brand-primary); }
.ax-reports .tot-val { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ax-reports .donut-container { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 20px; flex: 1; }
.ax-reports .donut-wrapper { position: relative; width: 130px; height: 130px; flex-shrink: 0; }
.ax-reports .donut-chart { width: 100%; height: 100%; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.ax-reports .donut-inner { width: 90px; height: 90px; background: var(--bg-surface); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ax-reports .donut-inner .num { font-size: 18px; font-weight: 600; color: var(--text-main); line-height: 1; margin-bottom: 2px; }
.ax-reports .donut-inner .text { font-size: 9px; color: var(--text-muted); }
.ax-reports .custom-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ax-reports .c-leg-item { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.ax-reports .c-leg-label { display: flex; align-items: center; gap: 6px; color: var(--text-dark); }
.ax-reports .c-leg-dot { width: 8px; height: 8px; border-radius: 50%; }
.ax-reports .c-leg-val { color: var(--text-muted); }
.ax-reports .view-link { font-size: 11px; color: var(--brand-primary); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.ax-reports .view-link:hover { text-decoration: underline; }
.ax-reports .simple-table { width: 100%; border-collapse: collapse; }
.ax-reports .simple-table th { padding: 8px 0; font-size: 10px; text-align: left; color: var(--text-muted); font-weight: 600; text-transform: uppercase; border-bottom: 1px solid var(--border-color); }
.ax-reports .simple-table td { padding: 10px 0; font-size: 12px; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.ax-reports .simple-table tr:last-child td { border-bottom: none; }
.ax-reports .diag-bar { height: 6px; border-radius: 3px; background: var(--accent-blue); }
.ax-reports .diag-track { height: 6px; border-radius: 3px; background: var(--border-color); overflow: hidden; }
/* controls bar + tabs */
.ax-reports .header-actions-row { display: flex; gap: 12px; }
.ax-reports .controls-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; flex-wrap: wrap; gap: 16px; }
.ax-reports .tabs { display: flex; gap: 20px; overflow-x: auto; white-space: nowrap; }
.ax-reports .tab-btn { background: none; border: none; color: var(--text-muted); font-size: 12.5px; font-weight: 500; cursor: pointer; padding-bottom: 12px; position: relative; margin-bottom: -13px; }
.ax-reports .tab-btn:hover { color: var(--text-main); }
.ax-reports .tab-btn.active { color: var(--brand-primary); }
.ax-reports .tab-btn.active::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: var(--brand-primary); border-radius: 2px 2px 0 0; }
.ax-reports .filters-group { display: flex; gap: 12px; align-items: center; }
.ax-reports .date-picker { display: flex; align-items: center; gap: 8px; background: var(--bg-surface); border: 1px solid var(--border-color); padding: 6px 12px; border-radius: var(--radius-sm); font-size: 11px; color: var(--text-main); cursor: pointer; }
.ax-reports .date-picker i { color: var(--text-muted); }
/* flex-list cards */
.ax-reports .flex-list { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.ax-reports .f-item { display: flex; align-items: center; justify-content: space-between; }
.ax-reports .f-item-left { display: flex; align-items: center; gap: 12px; }
.ax-reports .f-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; background: rgba(148,163,184,0.08); border: 1px solid var(--border-color); }
.ax-reports .f-title { font-size: 12px; color: var(--text-main); font-weight: 500; }
.ax-reports .f-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.ax-reports .f-val { font-size: 13px; font-weight: 600; color: var(--text-main); text-align: right; margin-right: 12px; }
.ax-reports .arrow-link { color: var(--text-muted); cursor: pointer; font-size: 12px; }
.ax-reports .arrow-link:hover { color: var(--text-main); }
.ax-reports .format-text { font-size: 10px; color: var(--text-muted); margin-right: 12px; font-weight: 500; }
.ax-reports .icon-bg-blue { background: rgba(59, 130, 246, 0.1); color: var(--accent-blue); border-color: rgba(59, 130, 246, 0.2); }
.ax-reports .icon-bg-purple { background: rgba(139, 92, 246, 0.1); color: var(--accent-purple); border-color: rgba(139, 92, 246, 0.2); }
.ax-reports .icon-bg-pink { background: rgba(236, 72, 153, 0.1); color: #ec4899; border-color: rgba(236, 72, 153, 0.2); }
.ax-reports .icon-bg-orange { background: rgba(245, 158, 11, 0.1); color: var(--accent-orange); border-color: rgba(245, 158, 11, 0.2); }
.ax-reports .icon-bg-teal { background: rgba(13, 164, 135, 0.1); color: var(--brand-primary); border-color: rgba(13, 164, 135, 0.2); }
.ax-reports .icon-bg-green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); border-color: rgba(16, 185, 129, 0.2); }
@media (max-width: 1100px) { .ax-reports .reports-grid { grid-template-columns: repeat(2, 1fr); } .ax-reports .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .ax-reports .reports-grid { grid-template-columns: 1fr; } .ax-reports .stats-grid { grid-template-columns: 1fr 1fr; } .ax-reports .donut-container { flex-direction: column; } }

/* ===== System Settings (from theme_study/SystemSettings.html), scoped ===== */
.ax-settings { display: flex; flex-direction: column; gap: 20px; }
.ax-settings .settings-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border-color); overflow-x: auto; white-space: nowrap; }
.ax-settings .settings-tabs .tab-item { padding: 12px 0; color: var(--text-muted); font-weight: 500; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; text-decoration: none; }
.ax-settings .settings-tabs .tab-item:hover { color: var(--text-main); }
.ax-settings .settings-tabs .tab-item.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }
.ax-settings .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.ax-settings .form-group { display: flex; flex-direction: column; gap: 8px; }
.ax-settings .form-group-single { margin-bottom: 24px; }
.ax-settings .form-label { font-size: 12px; color: var(--text-main); font-weight: 500; }
.ax-settings .form-control { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-main); padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; outline: none; transition: 0.2s; font-family: inherit; }
body.light-mode .ax-settings .form-control { background: rgba(255,255,255,0.4); }
.ax-settings .form-control:focus { border-color: var(--brand-primary); }
.ax-settings select.form-control { appearance: none; background-image: url('data:image/svg+xml;utf8,<svg fill="%239ca3af" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>'); background-repeat: no-repeat; background-position: right 10px center; padding-right: 36px; cursor: pointer; }
.ax-settings textarea.form-control { resize: vertical; min-height: 90px; }
.ax-settings .settings-section-title { font-size: 14px; font-weight: 600; color: var(--text-main); margin: 8px 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.ax-settings .save-bar { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--border-color); }
.ax-settings .setting-toggle-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.ax-settings .file-input-row { display: flex; align-items: center; gap: 14px; }
.ax-settings .file-preview { width: 56px; height: 56px; border-radius: 10px; object-fit: contain; border: 1px solid var(--border-color); background: var(--bg-surface); padding: 4px; }
@media (max-width: 700px) { .ax-settings .form-grid { grid-template-columns: 1fr; gap: 16px; } }

/* ===== AI Clinical Assistant chat (ported from aurora-shell.css .ax-aichat, remapped to theme tokens) ===== */
.ax-aichat{ display:flex; height:72vh; min-height:480px; border-radius:14px; overflow:hidden;
    background:var(--bg-surface); border:1px solid var(--border-color); position:relative; }
.ax-aichat.is-disabled{ opacity:.75; }

/* side / conversation list */
.ax-aichat__side{ width:270px; flex:0 0 270px; display:flex; flex-direction:column;
    background:var(--bg-surface); border-right:1px solid var(--border-color); }
.ax-aichat__side-head{ display:flex; align-items:center; justify-content:space-between;
    padding:.85rem 1rem; font-weight:600; color:var(--text-main); border-bottom:1px solid var(--border-color); }
.ax-aichat__new{ border:0; width:30px; height:30px; border-radius:8px; cursor:pointer;
    background:var(--brand-primary); color:#fff; }
.ax-aichat__new:hover{ background:var(--brand-primary-hover); }
.ax-aichat__list{ overflow-y:auto; padding:.5rem; flex:1; }
.ax-aichat__empty{ color:var(--text-muted); padding:.75rem; text-align:center; }
.ax-aichat__conv{ display:flex; flex-direction:column; gap:2px; width:100%; text-align:left;
    border:0; background:transparent; color:var(--text-main); padding:.55rem .65rem; border-radius:9px; cursor:pointer; }
.ax-aichat__conv:hover{ background:rgba(32,130,133,.12); }
.ax-aichat__conv.active{ background:rgba(32,130,133,.12); box-shadow:inset 3px 0 0 var(--brand-primary); }
.ax-aichat__conv-title{ font-size:.86rem; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ax-aichat__conv-when{ font-size:.72rem; color:var(--text-muted); }

/* main thread */
.ax-aichat__main{ flex:1; display:flex; flex-direction:column; min-width:0; }
.ax-aichat__main-head{ display:flex; align-items:center; justify-content:space-between;
    padding:.7rem 1rem; border-bottom:1px solid var(--border-color); }
.ax-aichat__title{ font-weight:600; color:var(--text-main); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ax-aichat__head-actions{ display:flex; align-items:center; gap:.25rem; position:relative; }
.ax-aichat__refs{ padding:.4rem 1rem; border-bottom:1px solid var(--border-color); font-size:.78rem; color:var(--text-muted); }
.ax-aichat__refs-label{ color:var(--brand-primary); font-weight:600; }

.ax-aichat__thread{ flex:1; overflow-y:auto; padding:1.1rem; display:flex; flex-direction:column; gap:1rem; }
.ax-aichat__welcome{ margin:auto; text-align:center; color:var(--text-muted); max-width:420px; }
.ax-aichat__welcome i{ font-size:2.2rem; color:var(--brand-primary); }
.ax-aichat__welcome h5{ color:var(--text-main); margin:.6rem 0 .3rem; }
.ax-aichat__suggestions{ display:flex; flex-wrap:wrap; gap:.5rem; justify-content:center; margin-top:1rem; }
.ax-aichat__suggestions button{ border:1px solid var(--border-color); background:var(--bg-surface); color:var(--text-main);
    border-radius:999px; padding:.4rem .9rem; font-size:.82rem; cursor:pointer; }
.ax-aichat__suggestions button:hover{ border-color:var(--brand-primary); color:var(--brand-primary); }

.ax-aichat__msg{ display:flex; gap:.7rem; max-width:88%; }
.ax-aichat__msg.is-user{ flex-direction:row-reverse; margin-left:auto; }
.ax-aichat__avatar{ flex:0 0 32px; width:32px; height:32px; border-radius:50%; display:flex;
    align-items:center; justify-content:center; font-size:.85rem; }
.ax-aichat__msg.is-ai .ax-aichat__avatar{ background:rgba(32,130,133,.12); color:var(--brand-primary); }
.ax-aichat__msg.is-user .ax-aichat__avatar{ background:var(--brand-primary); color:#fff; }
.ax-aichat__bubble{ background:var(--bg-surface); border:1px solid var(--border-color); border-radius:14px;
    padding:.7rem .95rem; color:var(--text-main); }
.ax-aichat__msg.is-user .ax-aichat__bubble{ background:var(--brand-primary); border-color:var(--brand-primary); color:#fff; }
.ax-aichat__bubble-body{ font-size:.9rem; line-height:1.55; }
.ax-aichat__bubble-body p:last-child{ margin-bottom:0; }
.ax-aichat__bubble-body h4{ font-size:.92rem; color:var(--brand-primary); margin:.6rem 0 .3rem; }
.ax-aichat__msg.is-user .ax-aichat__bubble-body h4{ color:#fff; }
.ax-aichat__bubble-body ul{ padding-left:1.1rem; margin:.3rem 0; }
.ax-aichat__stamp{ font-size:.68rem; color:var(--text-muted); margin-top:.35rem; }
.ax-aichat__msg.is-user .ax-aichat__stamp{ color:rgba(255,255,255,.8); }

.ax-aichat__typing{ display:flex; gap:4px; padding:4px 2px; }
.ax-aichat__typing span{ width:7px; height:7px; border-radius:50%; background:var(--text-muted); animation:axTyping 1s infinite; }
.ax-aichat__typing span:nth-child(2){ animation-delay:.15s; }
.ax-aichat__typing span:nth-child(3){ animation-delay:.3s; }
@keyframes axTyping{ 0%,60%,100%{ opacity:.3; transform:translateY(0);} 30%{ opacity:1; transform:translateY(-3px);} }

/* composer */
.ax-aichat__composer{ display:flex; gap:.6rem; align-items:flex-end; padding:.75rem 1rem; border-top:1px solid var(--border-color); }
.ax-aichat__composer textarea{ flex:1; resize:none; max-height:160px; min-height:44px; border:1px solid var(--border-color);
    background:var(--input-bg); color:var(--text-main); border-radius:12px; padding:.6rem .9rem; font-size:.9rem; line-height:1.4; }
.ax-aichat__composer textarea:focus{ outline:0; border-color:var(--brand-primary); box-shadow:0 0 0 3px rgba(32,130,133,.2); }
.ax-aichat__send{ flex:0 0 44px; width:44px; height:44px; border:0; border-radius:12px; cursor:pointer;
    background:var(--brand-primary); color:#fff; font-size:1rem; }
.ax-aichat__send:hover{ background:var(--brand-primary-hover); }
.ax-aichat__send:disabled{ opacity:.5; cursor:not-allowed; }
.ax-aichat__disclaimer{ padding:.4rem 1rem .7rem; font-size:.72rem; font-style:italic; color:var(--text-muted); text-align:center; }

/* export menu */
.ax-aichat__export{ position:relative; }
.ax-aichat__export-menu{ display:none; position:absolute; right:0; top:110%; z-index:30; min-width:150px;
    background:var(--bg-surface); border:1px solid var(--border-color); border-radius:10px; box-shadow:0 18px 40px rgba(2,6,23,.25); padding:.35rem; }
.ax-aichat__export-menu.open{ display:block; }
.ax-aichat__export-menu a{ display:block; padding:.45rem .7rem; color:var(--text-main); text-decoration:none; border-radius:7px; font-size:.86rem; }
.ax-aichat__export-menu a:hover{ background:rgba(32,130,133,.12); color:var(--brand-primary); }

/* reference picker */
.ax-aichat__refpick{ position:absolute; inset:0; background:rgba(2,6,23,.45); display:flex; align-items:center; justify-content:center; z-index:40; }
.ax-aichat__refpick-card{ width:min(440px,92%); background:var(--bg-surface); border:1px solid var(--border-color); border-radius:14px; padding:1rem; }
.ax-aichat__refpick-head{ display:flex; align-items:center; justify-content:space-between; color:var(--text-main); margin-bottom:.5rem; }
.ax-aichat__refpick-list{ max-height:300px; overflow-y:auto; display:flex; flex-direction:column; gap:.3rem; }
.ax-aichat__refpick-item{ display:flex; align-items:center; gap:.55rem; padding:.5rem .6rem; border:1px solid var(--border-color); border-radius:9px; color:var(--text-main); cursor:pointer; }
.ax-aichat__refpick-item small{ margin-left:auto; color:var(--text-muted); }
.ax-aichat__refpick-foot{ display:flex; justify-content:flex-end; gap:.5rem; margin-top:.8rem; }

@media (max-width: 768px){
    .ax-aichat{ height:80vh; }
    .ax-aichat__side{ width:200px; flex-basis:200px; }
}

/* attachments: composer button, chips, picker grid, message thumbnails */
.ax-aichat__attach{ flex:0 0 44px; width:44px; height:44px; border:1px solid var(--border-color); border-radius:12px;
    background:var(--bg-surface); color:var(--text-muted); cursor:pointer; font-size:1rem; }
.ax-aichat__attach:hover{ border-color:var(--brand-primary); color:var(--brand-primary); }
.ax-aichat__attach:disabled{ opacity:.5; cursor:not-allowed; }
.ax-aichat__attach-chips{ display:flex; flex-wrap:wrap; gap:.45rem; padding:.5rem 1rem 0; }
.ax-aichat__chip{ display:inline-flex; align-items:center; gap:.4rem; background:var(--bg-surface); border:1px solid var(--border-color);
    border-radius:999px; padding:.2rem .5rem .2rem .25rem; font-size:.76rem; color:var(--text-main); max-width:230px; }
.ax-aichat__chip img{ width:26px; height:26px; border-radius:50%; object-fit:cover; }
.ax-aichat__chip span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ax-aichat__chip button{ border:0; background:transparent; color:var(--text-muted); cursor:pointer; padding:0 .15rem; }
.ax-aichat__chip button:hover{ color:#ef4444; }

.ax-aichat__attach-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(110px,1fr)); gap:.6rem; max-height:340px; overflow-y:auto; padding:.25rem; }
.ax-aichat__attach-sec{ grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:.5rem; font-size:.78rem; font-weight:600; color:var(--brand-primary); margin-top:.4rem; }
.ax-aichat__3dbtn{ border:1px solid var(--brand-primary); background:rgba(32,130,133,.12); color:var(--brand-primary); border-radius:8px; padding:.2rem .55rem; font-size:.74rem; font-weight:600; cursor:pointer; }
.ax-aichat__3dbtn:hover{ background:var(--brand-primary); color:#fff; }
.ax-aichat__3dna{ font-size:.7rem; font-weight:500; color:var(--text-muted); font-style:italic; }
.ax-aichat__attach-cell{ border:2px solid var(--border-color); background:var(--bg-surface); border-radius:10px; padding:0; cursor:pointer; overflow:hidden; display:flex; flex-direction:column; }
.ax-aichat__attach-cell img{ width:100%; height:84px; object-fit:cover; background:#000; }
.ax-aichat__attach-cell span{ font-size:.7rem; color:var(--text-main); padding:.25rem .35rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ax-aichat__attach-cell.sel{ border-color:var(--brand-primary); box-shadow:0 0 0 2px rgba(32,130,133,.3); }

.ax-aichat__msg-thumbs{ display:flex; flex-wrap:wrap; gap:.4rem; margin-bottom:.5rem; }
.ax-aichat__thumb img{ width:120px; height:120px; object-fit:cover; border-radius:8px; border:1px solid var(--border-color); background:#000; }
.ax-aichat .btn-sm{ padding:4px 10px; font-size:12px; }
.ax-aichat .btn-light{ background:var(--bg-surface); border:1px solid var(--border-color); color:var(--text-main); }
.ax-aichat .btn-light:hover{ background:rgba(148,163,184,0.12); }
.ax-aichat .text-muted{ color:var(--text-muted) !important; }
.ax-aichat .small{ font-size:12px; }
.ax-aichat .ax-iconbtn{ border:1px solid var(--border-color); background:var(--bg-surface); color:var(--text-main); width:32px;height:32px;border-radius:8px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center; }
.ax-aichat .ax-iconbtn:hover{ background:rgba(148,163,184,0.12); }

/* ===== AI Clinical Analysis cards (from theme_study/AIClinicalAssistant.html), scoped ===== */
.ax-ai-analysis { display: flex; flex-direction: column; gap: 20px; }
.ax-ai-analysis .text-red { color: var(--accent-red); } .ax-ai-analysis .text-green { color: var(--accent-green); }
.ax-ai-analysis .text-orange { color: var(--accent-orange); } .ax-ai-analysis .text-blue { color: var(--accent-blue); } .ax-ai-analysis .text-purple { color: var(--accent-purple); }
.ax-ai-analysis .badge-outline { background: transparent; border: 1px solid currentColor; padding: 2px 8px; font-size: 10px; border-radius: 4px; white-space: nowrap; }
.ax-ai-analysis .view-all { font-size: 12px; color: var(--brand-primary); text-decoration: none; font-weight: 500; }
.ax-ai-analysis .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.ax-ai-analysis .card-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ax-ai-analysis .patient-info-panel { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; padding: 24px; background: rgba(0,0,0,0.15); border-radius: var(--radius-lg); border: 1px solid var(--border-color); }
body.light-mode .ax-ai-analysis .patient-info-panel { background: rgba(255,255,255,0.5); }
.ax-ai-analysis .profile-col-1 { display: flex; gap: 16px; min-width: 260px; }
.ax-ai-analysis .profile-avatar-large { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color); }
.ax-ai-analysis .profile-name-area h2 { font-size: 18px; font-weight: 600; color: var(--text-main); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.ax-ai-analysis .mrn-badge { display: inline-block; background: var(--brand-primary); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; margin-bottom: 8px; }
.ax-ai-analysis .profile-demographics { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.ax-ai-analysis .kv-list { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 200px; }
.ax-ai-analysis .kv-item { display: flex; font-size: 12px; align-items: flex-start; }
.ax-ai-analysis .kv-key { width: 110px; color: var(--text-muted); flex-shrink: 0; }
.ax-ai-analysis .kv-val { color: var(--text-main); font-weight: 500; }
.ax-ai-analysis .allergy-pill { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; border: 1px solid rgba(239, 68, 68, 0.3); display: inline-block; margin: 0 4px 4px 0; }
.ax-ai-analysis .ai-grid { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 20px; align-items: start; }
.ax-ai-analysis .col-stack { display: flex; flex-direction: column; gap: 20px; }
.ax-ai-analysis .summary-text { font-size: 12.5px; color: var(--text-dark); line-height: 1.6; margin-bottom: 16px; }
.ax-ai-analysis .risk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; border-top: 1px solid var(--border-color); padding-top: 16px; }
.ax-ai-analysis .risk-item .label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.ax-ai-analysis .risk-item .val { font-size: 13px; font-weight: 600; }
.ax-ai-analysis .vitals-mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.ax-ai-analysis .vital-box { display: flex; flex-direction: column; gap: 4px; }
.ax-ai-analysis .vital-box .label { font-size: 11px; color: var(--text-muted); }
.ax-ai-analysis .vital-box .val-wrap { font-size: 20px; font-weight: 600; color: var(--text-main); display: flex; align-items: baseline; gap: 4px; }
.ax-ai-analysis .vital-box .unit { font-size: 10px; color: var(--text-muted); font-weight: 400; }
.ax-ai-analysis .simple-table { width: 100%; border-collapse: collapse; }
.ax-ai-analysis .simple-table td { padding: 9px 0; font-size: 12px; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.ax-ai-analysis .simple-table tr:last-child td { border-bottom: none; }
.ax-ai-analysis .insight-list { display: flex; flex-direction: column; gap: 16px; }
.ax-ai-analysis .insight-item { display: flex; gap: 12px; align-items: flex-start; font-size: 12.5px; color: var(--text-dark); line-height: 1.5; }
.ax-ai-analysis .insight-icon { width: 24px; height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; background: rgba(148,163,184,0.08); border: 1px solid var(--border-color); }
.ax-ai-analysis .ai-rec-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.ax-ai-analysis .brain-icon-wrap { width: 48px; height: 48px; border-radius: 50%; background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); color: var(--accent-blue); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.ax-ai-analysis .ai-rec-text { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.ax-ai-analysis .rec-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ax-ai-analysis .rec-stat-box { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 4px; border-radius: var(--radius-sm); background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); text-align: center; }
body.light-mode .ax-ai-analysis .rec-stat-box { background: rgba(0,0,0,0.02); }
.ax-ai-analysis .rec-stat-box .num { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.ax-ai-analysis .rec-stat-box .label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ax-ai-analysis .conf-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
.ax-ai-analysis .conf-val { font-size: 28px; font-weight: 600; color: var(--text-main); line-height: 1; }
.ax-ai-analysis .progress-bg { width: 100%; height: 6px; background: rgba(148,163,184,0.2); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.ax-ai-analysis .progress-fill { height: 100%; background: var(--accent-blue); border-radius: 3px; }
.ax-ai-analysis .conf-text { font-size: 11px; color: var(--text-muted); }
.ax-ai-analysis .rec-group { margin-bottom: 24px; } .ax-ai-analysis .rec-group:last-child { margin-bottom: 0; }
.ax-ai-analysis .rec-group-title { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.ax-ai-analysis .rec-group-title span { display: flex; align-items: center; gap: 8px; }
.ax-ai-analysis .rec-list { list-style: none; counter-reset: custom-counter; display: flex; flex-direction: column; gap: 12px; padding: 0; margin: 0; }
.ax-ai-analysis .rec-list li { position: relative; padding-left: 18px; display: flex; justify-content: space-between; align-items: flex-start; font-size: 12.5px; color: var(--text-dark); line-height: 1.4; gap: 16px; }
.ax-ai-analysis .rec-list li::before { content: counter(custom-counter) "."; counter-increment: custom-counter; position: absolute; left: 0; top: 0; color: var(--text-muted); font-weight: 500; font-size: 11px; margin-top: 2px; }
.ax-ai-analysis .rec-list li .text { flex: 1; }
.ax-ai-analysis .disclaimer-banner { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: rgba(139, 92, 246, 0.05); border: 1px solid rgba(139, 92, 246, 0.15); border-radius: var(--radius-md); flex-wrap: wrap; gap: 16px; }
.ax-ai-analysis .disclaimer-text h4 { color: var(--accent-purple); font-size: 13px; margin-bottom: 4px; font-weight: 600; }
.ax-ai-analysis .disclaimer-text p { font-size: 11px; color: var(--text-muted); }
.ax-ai-analysis .feedback-actions { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); }
.ax-ai-analysis .feedback-btn { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; }
.ax-ai-analysis .feedback-btn:hover { background: rgba(148,163,184,0.12); color: var(--text-main); }
@media (max-width: 1100px) { .ax-ai-analysis .ai-grid { grid-template-columns: repeat(2, 1fr); } .ax-ai-analysis .col-stack:last-child { grid-column: span 2; } }
@media (max-width: 720px) { .ax-ai-analysis .ai-grid { grid-template-columns: 1fr; } .ax-ai-analysis .col-stack:last-child { grid-column: span 1; } .ax-ai-analysis .vitals-mini-grid, .ax-ai-analysis .risk-grid, .ax-ai-analysis .rec-stat-grid { grid-template-columns: 1fr 1fr; } }

/* ===== Fullscreen DICOM/OHIF viewer modal (theme-driven, no Bootstrap JS) ===== */
#dicomViewerModal { position: fixed; inset: 0; z-index: 1200; display: none; }
#dicomViewerModal.show { display: block; }
#dicomViewerModal .modal-dialog { width: 100%; height: 100%; max-width: 100%; margin: 0; }
#dicomViewerModal .modal-content { width: 100%; height: 100%; background: var(--bg-surface); display: flex; flex-direction: column; border-radius: 0; border: 0; }
#dicomViewerModal .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border-color); }
#dicomViewerModal .modal-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
#dicomViewerModal .modal-body { flex: 1; min-height: 0; }
#dicomViewerModal .btn-close { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
#dicomViewerModal .btn-close::before { content: "\00d7"; font-size: 18px; }

/* Standard HTML [hidden] behavior (old UI got this from Bootstrap; theme must provide it).
   Without this, components that rely on the `hidden` attribute to toggle visibility
   (e.g. the AI chat attach/reference pickers, chips) stay visible and overlay the UI. */
[hidden] { display: none !important; }

/* ===== Patient Results & Imaging tab (tests_tab) — theme reskin ===== */
.ax-tests-tab { display: flex; flex-direction: column; gap: 24px; }
.ax-tests-tab .card { padding: 24px; }
.ax-tests-tab .section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.ax-tests-tab .section-title { font-size: 14px; font-weight: 600; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.ax-tests-tab .t-table { width: 100%; border-collapse: collapse; }
.ax-tests-tab .t-table thead th { padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); text-align: left; border-bottom: 1px solid var(--border-color); font-weight: 600; }
.ax-tests-tab .t-table tbody td { padding: 12px; font-size: 12.5px; color: var(--text-main); border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.ax-tests-tab .t-table tbody tr:last-child td { border-bottom: none; }
.ax-tests-tab .t-right { text-align: right; }
.ax-tests-tab .muted-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ax-tests-tab .empty-row td { text-align: center; color: var(--text-muted); padding: 20px; }
.ax-tests-tab .badge-blue { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.ax-tests-tab .badge-danger { background: var(--accent-red-light); color: var(--accent-red); }
.ax-tests-tab .badge-neutral { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.ax-tests-tab .text-danger { color: var(--accent-red); }
.ax-tests-tab .order-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.ax-tests-tab .order-form-grid .full { grid-column: 1 / -1; }
.ax-tests-tab .ff { display: flex; flex-direction: column; gap: 6px; }
.ax-tests-tab .ff label { font-size: 12px; color: var(--text-main); font-weight: 500; }
.ax-tests-tab .ff input, .ax-tests-tab .ff select, .ax-tests-tab .ff textarea { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-main); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; outline: none; font-family: inherit; }
body.light-mode .ax-tests-tab .ff input, body.light-mode .ax-tests-tab .ff select, body.light-mode .ax-tests-tab .ff textarea { background: rgba(255,255,255,0.4); }
.ax-tests-tab .ff input:focus, .ax-tests-tab .ff select:focus, .ax-tests-tab .ff textarea:focus { border-color: var(--brand-primary); }
.ax-tests-tab tr.ax-collapse { display: none; }
.ax-tests-tab tr.ax-collapse.show { display: table-row; }
.ax-tests-tab .btn-xs { padding: 4px 10px; font-size: 11px; }
.ax-tests-tab .cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ax-tests-tab .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .ax-tests-tab .cols-2 { grid-template-columns: 1fr; } }

/* ===== Pediatric Development (from theme_study/Pediatric.html), scoped ===== */
.ax-pediatric { display: flex; flex-direction: column; gap: 20px; }
.ax-pediatric .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.ax-pediatric .card-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ax-pediatric .view-link { font-size: 11px; color: var(--brand-primary); text-decoration: none; cursor: pointer; }
.ax-pediatric .status-badge { padding: 4px 8px; border-radius: 4px; font-size: 10px; font-weight: 500; display: inline-block; }
.ax-pediatric .badge-green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.ax-pediatric .dev-header { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; padding: 24px; }
.ax-pediatric .patient-dev-status { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 250px; }
.ax-pediatric .status-header-row { display: flex; align-items: center; gap: 12px; }
.ax-pediatric .status-title { font-size: 13px; font-weight: 600; color: var(--text-main); }
.ax-pediatric .status-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.ax-pediatric .overall-score-container { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ax-pediatric .circular-chart { width: 72px; height: 72px; }
.ax-pediatric .circle-bg { fill: none; stroke: rgba(148,163,184,0.15); stroke-width: 2.5; }
.ax-pediatric .circle { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.ax-pediatric .circular-chart.teal .circle { stroke: var(--brand-primary); }
.ax-pediatric .percentage { fill: var(--text-main); font-size: 8px; font-weight: bold; text-anchor: middle; }
.ax-pediatric .score-label { font-size: 10px; color: var(--text-muted); }
.ax-pediatric .grid-row { display: grid; gap: 20px; }
.ax-pediatric .grid-col-2 { grid-template-columns: 1fr 1fr; }
.ax-pediatric .grid-col-3 { grid-template-columns: 1fr 1fr 1fr; }
.ax-pediatric .dev-overview-list { display: flex; flex-direction: column; gap: 16px; }
.ax-pediatric .dev-domain-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ax-pediatric .domain-name { width: 140px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-dark); }
.ax-pediatric .domain-icon { width: 24px; height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; background: rgba(148,163,184,0.08); color: var(--brand-primary); }
.ax-pediatric .domain-icon.icon-orange { color: var(--accent-orange); }
.ax-pediatric .domain-icon.icon-purple { color: var(--accent-purple); }
.ax-pediatric .progress-container { flex: 1; height: 4px; background: rgba(148,163,184,0.15); border-radius: 2px; overflow: hidden; }
.ax-pediatric .progress-fill { height: 100%; border-radius: 2px; }
.ax-pediatric .fill-teal { background-color: var(--brand-primary); }
.ax-pediatric .fill-orange { background-color: var(--accent-orange); }
.ax-pediatric .domain-status { width: 80px; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.ax-pediatric .dot { width: 6px; height: 6px; border-radius: 50%; }
.ax-pediatric .dot-green { background-color: var(--accent-green); } .ax-pediatric .dot-orange { background-color: var(--accent-orange); }
.ax-pediatric .domain-score { width: 30px; text-align: right; font-size: 12px; font-weight: 500; color: var(--text-main); }
.ax-pediatric .milestones-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 10px; }
.ax-pediatric .milestone-col { display: flex; flex-direction: column; gap: 10px; }
.ax-pediatric .m-col-title { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.ax-pediatric .m-item { font-size: 11.5px; color: var(--text-dark); display: flex; align-items: flex-start; gap: 8px; line-height: 1.4; }
.ax-pediatric .m-item i { margin-top: 2px; }
.ax-pediatric .m-item i.checked { color: var(--accent-green); }
.ax-pediatric .m-item i.progress { color: var(--accent-orange); }
.ax-pediatric .m-item i.pending { color: var(--text-muted); opacity: .5; }
.ax-pediatric .growth-chart-area { display: flex; flex-direction: column; flex: 1; margin-top: 10px; min-height: 160px; }
.ax-pediatric .chart-svg-container { width: 100%; height: 140px; position: relative; }
.ax-pediatric .chart-y-axis { position: absolute; left: 0; top: 0; bottom: 15px; display: flex; flex-direction: column; justify-content: space-between; font-size: 9px; color: var(--text-muted); width: 25px; }
.ax-pediatric .chart-x-axis { position: absolute; left: 30px; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: 9px; color: var(--text-muted); }
.ax-pediatric .chart-lines { position: absolute; left: 30px; right: 0; top: 5px; bottom: 15px; }
.ax-pediatric .chart-legend-bottom { display: flex; justify-content: center; gap: 16px; margin-top: auto; font-size: 10px; color: var(--text-muted); padding-top: 15px; flex-wrap: wrap; }
.ax-pediatric .chart-legend-bottom .l-item { display: flex; align-items: center; gap: 6px; }
.ax-pediatric .line-solid { width: 16px; height: 2px; background: var(--accent-blue); }
.ax-pediatric .line-dash { width: 16px; height: 0; border-top: 2px dashed var(--text-muted); }
.ax-pediatric .simple-table { width: 100%; border-collapse: collapse; }
.ax-pediatric .simple-table th { padding: 8px 0; font-size: 10px; text-align: left; color: var(--text-muted); font-weight: 600; text-transform: uppercase; border-bottom: 1px solid var(--border-color); }
.ax-pediatric .simple-table td { padding: 10px 0; font-size: 12px; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.ax-pediatric .simple-table tr:last-child td { border-bottom: none; }
@media (max-width: 1000px) { .ax-pediatric .grid-col-2, .ax-pediatric .grid-col-3 { grid-template-columns: 1fr; } .ax-pediatric .milestones-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .ax-pediatric .milestones-grid { grid-template-columns: 1fr; } }

/* ===== Appointment create/edit form (theme, Alpine-driven cascade) ===== */
.ax-appt .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ax-appt .fg { display: flex; flex-direction: column; gap: 8px; }
.ax-appt .fg.full { grid-column: 1 / -1; }
.ax-appt label { font-size: 12px; font-weight: 500; color: var(--text-main); }
.ax-appt .req { color: var(--accent-red); }
.ax-appt input, .ax-appt select, .ax-appt textarea { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-main); padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13px; outline: none; font-family: inherit; }
body.light-mode .ax-appt input, body.light-mode .ax-appt select, body.light-mode .ax-appt textarea { background: rgba(255,255,255,0.4); }
.ax-appt input:focus, .ax-appt select:focus, .ax-appt textarea:focus { border-color: var(--brand-primary); }
.ax-appt .field-err { color: var(--accent-red); font-size: 11px; }
.ax-appt .booked-times { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ax-appt .booked-chip { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--accent-red-light); color: var(--accent-red); }
.ax-appt .form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border-color); }
@media (max-width: 700px) { .ax-appt .form-grid { grid-template-columns: 1fr; } }

/* Global detail label/value fallback (used by simple show pages outside scoped wrappers) */
.detail-value { font-size: 13px; color: var(--text-main); font-weight: 500; }
.detail-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ===== Users create/edit form (theme) ===== */
.ax-user-form .ax-separator { height: 1px; background: var(--border-color); margin: 22px 0; }
.ax-user-form .perm-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.ax-user-form .perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 16px; }
.ax-user-form .perm-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dark); }
.ax-user-form .perm-item input { width: 15px; height: 15px; accent-color: var(--brand-primary); }
.ax-user-form .section-label { font-size: 13px; font-weight: 700; color: var(--text-main); }
.ax-user-form .section-help { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== Bill / Invoice line-item forms (theme) ===== */
.ax-lineform .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.ax-lineform .fg { display: flex; flex-direction: column; gap: 6px; }
.ax-lineform label { font-size: 12px; font-weight: 500; color: var(--text-main); }
.ax-lineform .req { color: var(--accent-red); }
.ax-lineform input, .ax-lineform select, .ax-lineform textarea { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-main); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; outline: none; font-family: inherit; }
body.light-mode .ax-lineform input, body.light-mode .ax-lineform select, body.light-mode .ax-lineform textarea { background: rgba(255,255,255,0.4); }
.ax-lineform input:focus, .ax-lineform select:focus { border-color: var(--brand-primary); }
.ax-lineform input[readonly] { opacity: .7; cursor: not-allowed; }
.ax-lineform .items-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 12px; }
.ax-lineform .items-title { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ax-lineform .item-table { width: 100%; border-collapse: collapse; }
.ax-lineform .item-table th { padding: 10px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); text-align: left; border-bottom: 1px solid var(--border-color); }
.ax-lineform .item-table td { padding: 8px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.ax-lineform .item-table td.num, .ax-lineform .item-table th.num { text-align: right; }
.ax-lineform .item-table input { padding: 8px 10px; }
.ax-lineform .row-del { background: transparent; border: 1px solid var(--border-color); color: var(--accent-red); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.ax-lineform .row-del:hover { background: var(--accent-red-light); }
.ax-lineform .total-row { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 16px; font-size: 14px; }
.ax-lineform .total-row .total-val { font-size: 20px; font-weight: 700; color: var(--brand-primary); }
.ax-lineform .form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border-color); }
.ax-lineform .field-err { color: var(--accent-red); font-size: 11px; }

/* medicine bill form extras */
.ax-lineform .ax-switch { display:inline-flex; align-items:center; gap:8px; cursor:pointer; font-size:13px; color:var(--text-main); }
.ax-lineform .ax-switch input { width:auto; }
.ax-lineform .ax-avail { display:block; font-size:10px; color:var(--text-muted); margin-top:3px; }
