/**
 * Glaucoma One Design System v2.0
 * Silicon Valley Grade UI
 * 
 * Inspired by: Linear, Vercel, Stripe, Notion, Raycast
 * @version 2.0.0
 */

/* ============================================
   GOOGLE FONTS IMPORT
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================
   CSS RESET & BASE
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 18px;
    /* Increased from 16px for presbyopic users */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: auto;
}

/* ============================================
   DESIGN TOKENS - Premium Dark Theme
   ============================================ */
:root {
    /* Color Palette - Refined Dark */
    --black-pure: #000000;
    --black-rich: #0a0a0a;
    --black-soft: #111111;
    --gray-950: #131313;
    --gray-900: #171717;
    --gray-850: #1a1a1a;
    --gray-800: #1f1f1f;
    --gray-750: #262626;
    --gray-700: #2e2e2e;
    --gray-600: #404040;
    --gray-500: #525252;
    --gray-400: #737373;
    --gray-300: #a3a3a3;
    --gray-200: #d4d4d4;
    --gray-100: #e5e5e5;
    --gray-50: #f5f5f5;
    --white: #ffffff;

    /* Glaucoma One Brand Palette */
    --g1-brand-900: #D94E00;
    /* Deep Red-Orange */
    --g1-brand-700: #FF7B00;
    /* Vibrant Orange */
    --g1-brand-500: #FFB300;
    /* Golden Yellow */
    --g1-brand-300: #FFE000;
    /* Bright Yellow */
    --g1-brand-100: #FFF6CC;
    /* Pale Yellow */

    --g1-gradient-primary: linear-gradient(135deg, var(--g1-brand-900) 0%, var(--g1-brand-700) 40%, var(--g1-brand-500) 80%, var(--g1-brand-300) 100%);

    /* Brand Colors - Mapped to G1 Palette */
    --indigo-50: var(--g1-brand-100);
    --indigo-100: var(--g1-brand-100);
    --indigo-200: var(--g1-brand-300);
    --indigo-300: var(--g1-brand-300);
    --indigo-400: var(--g1-brand-500);
    --indigo-500: var(--g1-brand-700);
    --indigo-600: var(--g1-brand-900);
    --indigo-700: var(--g1-brand-900);
    --indigo-800: var(--g1-brand-900);

    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-400: #4ade80;
    --success-500: #22c55e;
    --success-600: #16a34a;

    --warning-50: #fffbeb;
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;
    --warning-600: #d97706;

    --danger-50: #fef2f2;
    --danger-400: #f87171;
    --danger-500: #ef4444;
    --danger-600: #dc2626;

    --purple-400: var(--g1-brand-500);
    --purple-500: var(--g1-brand-700);
    --purple-600: var(--g1-brand-900);

    --pink-400: #f472b6;
    --pink-500: #ec4899;

    --blue-400: #60a5fa;
    --blue-500: #3b82f6;

    /* Legacy variables mapped to indigo */
    --teal-500: var(--indigo-500);
    --teal-400: var(--indigo-400);
    --cyan-400: var(--indigo-400);
    --cyan-500: var(--indigo-500);
    --cyan-600: var(--indigo-600);
    --cyan-300: var(--indigo-300);

    /* Clinical Color Semantics */
    --color-cyan: var(--indigo-500);
    /* Functional Vision (VF) */
    --color-magenta: var(--purple-400);
    /* Structural Nerve (OCT) */
    --color-green: var(--success-500);
    /* Safe / Stable / Target Met */
    --color-amber: var(--warning-500);
    /* Warning / Caution */
    --color-red: var(--danger-500);
    /* Danger / Crisis / Alert */
    --color-iop: var(--white);
    /* IOP readings */

    /* Functional Colors */
    --bg-base: var(--black-rich);
    --bg-subtle: var(--gray-950);
    --bg-surface: var(--gray-900);
    --bg-elevated: var(--gray-850);
    --bg-hover: var(--gray-800);
    --bg-overlay: rgba(0, 0, 0, 0.85);

    /* Legacy support */
    --color-void: var(--bg-base);
    --color-surface: var(--bg-surface);
    --color-surface-elevated: var(--bg-elevated);
    --color-surface-hover: var(--bg-hover);

    --text-primary: var(--gray-50);
    --text-secondary: var(--gray-400);
    --text-tertiary: var(--gray-500);
    --text-muted: var(--gray-600);
    --text-inverse: var(--black-rich);

    /* Legacy */
    --color-text-primary: var(--text-primary);
    --color-text-secondary: var(--text-secondary);
    --color-text-tertiary: var(--text-tertiary);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);
    --border-focus: var(--teal-500);

    /* Legacy */
    --color-border: var(--border-default);
    --color-border-subtle: var(--border-subtle);

    /* Accent - Premium G1 Orange */
    --accent: var(--indigo-500);
    --accent-hover: var(--indigo-400);
    --accent-muted: rgba(255, 123, 0, 0.15);
    /* #FF7B00 */

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --font-ui: var(--font-sans);

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;

    /* Spacing - 4px base */
    --space-0: 0;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Border Radius */
    --radius-none: 0;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Shadows - Layered for depth */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.25), 0 8px 16px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 0 1px rgba(255, 123, 0, 0.1), 0 0 32px rgba(255, 123, 0, 0.2);
    --shadow-glow-strong: 0 0 0 1px rgba(255, 123, 0, 0.3), 0 0 48px rgba(255, 123, 0, 0.3);

    /* Legacy shadows - mapped to orange */
    --shadow-glow-cyan: 0 0 24px rgba(255, 123, 0, 0.35);
    --shadow-glow-magenta: 0 0 24px rgba(168, 85, 247, 0.35);
    --shadow-glow-green: 0 0 24px rgba(34, 197, 94, 0.35);
    --shadow-glow-red: 0 0 24px rgba(239, 68, 68, 0.35);

    /* Transitions */
    --duration-instant: 50ms;
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 350ms;
    --duration-slower: 500ms;

    --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-Index Scale */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-tooltip: 600;

    /* Layout */
    --sidebar-width: 255px;
    --header-height: 56px;
    --content-max-width: 1600px;

    /* Theme transition */
    --theme-transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ============================================
   LIGHT MODE THEME - Complete Coverage
   ============================================ */
[data-theme="light"] {
    /* Light backgrounds */
    --bg-base: #f8fafc;
    --bg-subtle: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #e2e8f0;
    --bg-overlay: rgba(255, 255, 255, 0.98);
    --bg-card: #ffffff;

    /* Light text - high contrast for presbyopic users */
    --text-primary: #0f172a;
    --text-secondary: #1e293b;
    --text-tertiary: #334155;
    --text-muted: #475569;
    --text-inverse: #ffffff;

    /* Legacy text vars */
    --color-text-primary: #0f172a;
    --color-text-secondary: #1e293b;
    --color-text-tertiary: #334155;

    /* Light borders - more visible */
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-default: rgba(0, 0, 0, 0.15);
    --border-strong: rgba(0, 0, 0, 0.25);
    --color-border: rgba(0, 0, 0, 0.15);
    --color-border-subtle: rgba(0, 0, 0, 0.08);

    /* Light shadows - softer */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1), 0 10px 15px rgba(0, 0, 0, 0.05);

    /* Accent - darker indigo for light mode contrast */
    --accent: var(--g1-brand-700);
    --accent-hover: var(--g1-brand-900);
    --accent-muted: rgba(255, 123, 0, 0.12);

    /* Clinical colors - darker for light mode */
    --color-iop: #1e293b;
    --color-cyan: var(--g1-brand-700);

    /* Semantic colors - slightly darker for visibility */
    --success-400: #16a34a;
    --warning-400: #d97706;
    --danger-400: #dc2626;

    /* Grays inverted */
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
}

/* Dark mode explicit (default) */
[data-theme="dark"] {
    --bg-base: #0a0a0a;
    --bg-subtle: #131313;
    --bg-surface: #171717;
    --bg-elevated: #1a1a1a;
    --bg-hover: #1f1f1f;
    --bg-card: #171717;
}

/* ============================================
   LIGHT MODE - COMPREHENSIVE HIGH CONTRAST
   ============================================ */

/* === SIDEBAR === */
[data-theme="light"] .app-sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

[data-theme="light"] .sidebar-logo,
[data-theme="light"] .sidebar-brand {
    color: #0f172a;
}

[data-theme="light"] .nav-section-title {
    color: #475569;
}

[data-theme="light"] .nav-link {
    color: #1e293b;
}

[data-theme="light"] .nav-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

[data-theme="light"] .nav-link.active {
    background: rgba(255, 123, 0, 0.05);
    color: var(--g1-brand-700);
}

[data-theme="light"] .nav-link svg {
    color: #64748b;
}

[data-theme="light"] .nav-link:hover svg,
[data-theme="light"] .nav-link.active svg {
    color: var(--g1-brand-700);
}

/* === TOP NAVIGATION === */
[data-theme="light"] .top-nav {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .top-nav-brand,
[data-theme="light"] .top-nav-title,
[data-theme="light"] .nav-brand,
[data-theme="light"] .brand-text {
    color: #0f172a;
}

[data-theme="light"] .top-nav-subtitle,
[data-theme="light"] .brand-subtitle {
    color: #64748b;
}

[data-theme="light"] .top-nav-logo {
    color: var(--g1-brand-700);
}

[data-theme="light"] .breadcrumb a {
    color: #475569;
}

[data-theme="light"] .breadcrumb a:hover {
    color: #0f172a;
}

[data-theme="light"] .breadcrumb-current {
    color: #0f172a;
}

[data-theme="light"] .nav-links a {
    color: #334155;
}

[data-theme="light"] .nav-links a:hover,
[data-theme="light"] .nav-links a.active {
    color: var(--g1-brand-700);
}

/* === PAGE HEADER === */
[data-theme="light"] .page-header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .page-title {
    color: #0f172a;
}

[data-theme="light"] .page-subtitle {
    color: #475569;
}

/* === CARDS === */
[data-theme="light"] .card,
[data-theme="light"] .card-glass {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .card-header {
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .stats-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .stat-label,
[data-theme="light"] .stat-card-label {
    color: #475569;
}

[data-theme="light"] .stat-value,
[data-theme="light"] .stat-card-value {
    color: #0f172a;
}

[data-theme="light"] .stat-change {
    color: #475569;
}

/* === TABLES === */
[data-theme="light"] .table {
    background: #ffffff;
}

[data-theme="light"] .table th {
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
}

[data-theme="light"] .table td {
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .table tr:hover {
    background: #f8fafc;
}

[data-theme="light"] .table-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

/* === BUTTONS === */
[data-theme="light"] .btn-primary {
    background: var(--g1-brand-700);
    color: #ffffff;
}

[data-theme="light"] .btn-primary:hover {
    background: var(--g1-brand-900);
}

[data-theme="light"] .btn-secondary {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #1e293b;
}

[data-theme="light"] .btn-secondary:hover {
    background: #e2e8f0;
}

[data-theme="light"] .btn-ghost {
    color: #475569;
}

[data-theme="light"] .btn-ghost:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* === FORMS === */
[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea,
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-textarea:focus {
    border-color: var(--g1-brand-700);
}

[data-theme="light"] .form-input::placeholder {
    color: #94a3b8;
}

[data-theme="light"] .form-label {
    color: #334155;
}

[data-theme="light"] .form-hint {
    color: #64748b;
}

/* === MODALS === */
[data-theme="light"] .modal {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .modal-header {
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .modal-title {
    color: #0f172a;
}

[data-theme="light"] .modal-body {
    color: #334155;
}

[data-theme="light"] .modal-footer {
    border-top: 1px solid #e2e8f0;
}

/* === SEARCH BAR === */
[data-theme="light"] .search-bar {
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

[data-theme="light"] .search-bar input {
    background: transparent;
    color: #0f172a;
}

[data-theme="light"] .search-bar-icon {
    color: #64748b;
}

/* === AVATARS === */
[data-theme="light"] .user-avatar,
[data-theme="light"] .patient-avatar {
    background: var(--g1-brand-700);
    color: #ffffff;
}

/* === TEXT COLORS === */
[data-theme="light"] .text-primary {
    color: #0f172a !important;
}

[data-theme="light"] .text-secondary {
    color: #334155 !important;
}

[data-theme="light"] .text-muted {
    color: #64748b !important;
}

[data-theme="light"] .font-mono {
    color: #1e293b;
}

/* === ICONS === */
[data-theme="light"] svg {
    color: inherit;
}

[data-theme="light"] .btn svg,
[data-theme="light"] .nav-link svg {
    opacity: 0.9;
}

/* === SITE FOOTER === */
[data-theme="light"] .site-footer,
[data-theme="light"] .app-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    color: #475569;
}

[data-theme="light"] .site-footer-brand {
    color: #475569;
}

[data-theme="light"] .site-footer-copyright {
    color: #64748b;
}

/* === CHARTS - HIGH CONTRAST === */
[data-theme="light"] .apexcharts-text,
[data-theme="light"] .apexcharts-title-text {
    fill: #0f172a !important;
}

[data-theme="light"] .apexcharts-xaxis-label,
[data-theme="light"] .apexcharts-yaxis-label {
    fill: #334155 !important;
}

[data-theme="light"] .apexcharts-gridline {
    stroke: #e2e8f0 !important;
}

[data-theme="light"] .apexcharts-tooltip {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .apexcharts-tooltip-title {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
}

[data-theme="light"] .apexcharts-legend-text {
    color: #334155 !important;
}

/* IOP line color - dark for visibility on white */
[data-theme="light"] .apexcharts-series[seriesName="IOP"] path {
    stroke: #0f172a !important;
}

[data-theme="light"] {
    --color-iop: #0f172a;
}

/* === ADVISOR PANEL === */
[data-theme="light"] .advisor-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .advisor-section-title {
    color: #0f172a;
}

[data-theme="light"] .vital-advisor-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .vital-label {
    color: #475569;
}

[data-theme="light"] .vital-value {
    color: #0f172a;
}

[data-theme="light"] .lifestyle-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .lifestyle-label {
    color: #334155;
}

[data-theme="light"] .count-badge {
    background: #475569;
    color: #ffffff;
}

/* === DASHBOARD SPECIFIC === */
[data-theme="light"] .app-header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .patient-name {
    color: #0f172a;
}

[data-theme="light"] .patient-info {
    color: #334155;
}

[data-theme="light"] .patient-meta {
    color: #475569;
}

[data-theme="light"] .patient-meta-item {
    color: #475569;
}

[data-theme="light"] .patient-meta-item strong {
    color: #334155;
}

[data-theme="light"] .patient-flags {
    color: #475569;
}

[data-theme="light"] .sidebar-footer {
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

[data-theme="light"] .sidebar-footer .user-name {
    color: #0f172a;
}

[data-theme="light"] .sidebar-footer .user-role {
    color: #64748b;
}

/* === CHART CARD HEADER === */
[data-theme="light"] .chart-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .chart-title {
    color: #0f172a;
}

[data-theme="light"] .chart-toolbar button {
    color: #475569;
    border-color: #e2e8f0;
}

[data-theme="light"] .chart-toolbar button:hover {
    background: #f1f5f9;
    color: #0f172a;
}

[data-theme="light"] .toggle-label.iop {
    color: #0f172a;
}

[data-theme="light"] .legend-color.iop {
    background: #0f172a;
    box-shadow: 0 0 6px rgba(15, 23, 42, 0.3);
}

/* === ADVISOR PANEL (RIGHT SIDEBAR) === */
[data-theme="light"] .advisor-panel {
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
}

[data-theme="light"] .advisor-panel-title {
    color: #0f172a;
}

[data-theme="light"] .advisor-panel-subtitle {
    color: #64748b;
}

/* === DARK MODE TEXT VISIBILITY FIXES === */
[data-theme="dark"] .patient-name,
[data-theme="dark"] .page-title,
[data-theme="dark"] .modal-title,
[data-theme="dark"] .card-title {
    color: #ffffff;
}

[data-theme="dark"] .patient-meta,
[data-theme="dark"] .patient-meta-item,
[data-theme="dark"] .text-secondary,
[data-theme="dark"] .form-label {
    color: #a3a3a3;
}

[data-theme="dark"] .patient-meta-item strong {
    color: #d4d4d4;
}

[data-theme="dark"] .stat-label,
[data-theme="dark"] .stat-card-label {
    color: #a3a3a3;
}

[data-theme="dark"] .stat-value,
[data-theme="dark"] .stat-card-value {
    color: #ffffff;
}

[data-theme="dark"] .table th {
    color: #a3a3a3;
}

[data-theme="dark"] .table td {
    color: #e5e5e5;
}

[data-theme="dark"] .nav-link {
    color: #a3a3a3;
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
    color: #ffffff;
}

[data-theme="dark"] .btn-secondary {
    color: #e5e5e5;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .btn-primary {
    background: var(--g1-brand-700);
    color: #ffffff;
}

[data-theme="dark"] .btn-primary:hover {
    background: var(--g1-brand-900);
}

[data-theme="dark"] .btn-xs {
    color: #ffffff;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .breadcrumb a {
    color: #a3a3a3;
}

[data-theme="dark"] .breadcrumb-current {
    color: #ffffff;
}

/* === DARK MODE UTILITY CLASS VISIBILITY === */
[data-theme="dark"] .text-muted {
    color: #a3a3a3 !important;
}

[data-theme="dark"] .text-primary {
    color: #ffffff !important;
}

[data-theme="dark"] .text-secondary {
    color: #d4d4d4 !important;
}

[data-theme="dark"] .font-mono {
    color: #e5e5e5;
}

[data-theme="dark"] .font-medium {
    color: #ffffff;
}

[data-theme="dark"] .text-accent {
    color: var(--accent) !important;
}

[data-theme="dark"] .btn-icon-mini,
[data-theme="dark"] .btn-ghost {
    color: var(--gray-300);
}

[data-theme="dark"] .btn-icon-mini:hover,
[data-theme="dark"] .btn-ghost:hover {
    color: var(--white);
}

[data-theme="dark"] td {
    color: #e5e5e5;
}

[data-theme="dark"] th {
    color: #a3a3a3;
}

[data-theme="dark"] th a {
    color: #a3a3a3;
}

[data-theme="dark"] th a:hover {
    color: #ffffff;
}

/* === RISK BADGES DARK MODE === */
[data-theme="dark"] .risk-badge {
    font-weight: 600;
}

[data-theme="dark"] .risk-badge.risk-low {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

[data-theme="dark"] .risk-badge.risk-moderate {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .risk-badge.risk-high {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* === STAT CARDS DARK MODE === */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .stats-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .stat-card-label {
    color: #a3a3a3;
}

[data-theme="dark"] .stat-card-value {
    color: #ffffff;
}

[data-theme="dark"] .stat-card-change {
    color: #a3a3a3;
}

[data-theme="dark"] .stat-card-change.positive {
    color: #4ade80;
}

/* === SEARCH BAR DARK MODE === */
[data-theme="dark"] .search-bar {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .search-bar input {
    color: #ffffff;
}

[data-theme="dark"] .search-bar input::placeholder {
    color: #737373;
}

/* === USER INFO DARK MODE === */
[data-theme="dark"] .user-name {
    color: #ffffff;
}

[data-theme="dark"] .user-role {
    color: #a3a3a3;
}

/* === FOOTER DARK MODE === */
[data-theme="dark"] .site-footer {
    background: rgba(0, 0, 0, 0.3);
    border-top-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .site-footer-brand,
[data-theme="dark"] .site-footer-copyright {
    color: #737373;
}

/* === VISITS PAGE === */
[data-theme="light"] .visits-sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

[data-theme="light"] .visits-patient-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .visits-patient-name {
    color: #0f172a;
}

[data-theme="light"] .visits-filter-item {
    color: #334155;
}

[data-theme="light"] .visits-filter-item:hover,
[data-theme="light"] .visits-filter-item.active {
    background: #f1f5f9;
    color: var(--g1-brand-700);
}

[data-theme="light"] .visits-event-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

/* === SETTINGS PAGE === */
[data-theme="light"] .settings-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .settings-card-title {
    color: #0f172a;
}

[data-theme="light"] .settings-card-desc {
    color: #64748b;
}

[data-theme="light"] .team-member {
    border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .team-member-name {
    color: #0f172a;
}

[data-theme="light"] .team-member-email {
    color: #64748b;
}

/* === REPORTS PAGE === */
[data-theme="light"] .chart-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .chart-card-title {
    color: #0f172a;
}

[data-theme="light"] .activity-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .activity-item {
    border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .activity-title {
    color: #0f172a;
}

[data-theme="light"] .activity-meta {
    color: #64748b;
}

/* === LOGIN PAGE === */
[data-theme="light"] .login-page {
    background: #f8fafc;
}

[data-theme="light"] .login-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .login-logo-text {
    color: #0f172a;
}

[data-theme="light"] .login-logo-subtitle {
    color: #64748b;
}

/* === MESSAGES/ALERTS === */
[data-theme="light"] .message {
    border: 1px solid;
}

[data-theme="light"] .message-success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

[data-theme="light"] .message-error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

[data-theme="light"] .message-warning {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

/* === BADGES === */
[data-theme="light"] .risk-badge {
    font-weight: 600;
}

[data-theme="light"] .risk-badge.risk-high {
    background: #fef2f2;
    color: #dc2626;
}

[data-theme="light"] .risk-badge.risk-moderate {
    background: #fffbeb;
    color: #d97706;
}

[data-theme="light"] .risk-badge.risk-low {
    background: #f0fdf4;
    color: #16a34a;
}

/* === EMPTY STATES === */
[data-theme="light"] .empty-state {
    color: #64748b;
}

[data-theme="light"] .empty-state-icon {
    color: #94a3b8;
}

[data-theme="light"] .empty-state-title {
    color: #334155;
}

/* === SCROLLBARS === */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: #f1f5f9;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Theme transition for smooth switching */
body,
.card,
.btn,
.app-sidebar,
.nav-link,
.modal,
.form-input,
.form-select {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}

h1 {
    font-size: var(--text-3xl);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
}

h4 {
    font-size: var(--text-lg);
}

h5 {
    font-size: var(--text-base);
}

h6 {
    font-size: var(--text-sm);
}

p {
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--accent-hover);
}

small {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

code,
kbd,
pre {
    font-family: var(--font-mono);
}

code {
    font-size: 0.9em;
    padding: 0.15em 0.5em;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--cyan-300);
    border: 1px solid var(--border-subtle);
}

/* ============================================
   BUTTONS - Compact
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    line-height: 1.25;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
    user-select: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.btn:hover::before {
    opacity: 1;
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--accent);
}

.btn:active {
    transform: scale(0.98);
    transition-duration: var(--duration-instant);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled::before {
    display: none;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(180deg, var(--cyan-400) 0%, var(--cyan-500) 100%);
    color: var(--black-rich);
    border-color: transparent;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 0 1px rgba(6, 182, 212, 0.3);
    font-weight: var(--font-semibold);
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--cyan-300) 0%, var(--cyan-400) 100%);
    box-shadow: var(--shadow-md), var(--shadow-glow), 0 0 0 1px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--gray-750);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(180deg, var(--danger-400) 0%, var(--danger-500) 100%);
    color: var(--white);
    border-color: transparent;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-danger:hover {
    background: linear-gradient(180deg, var(--danger-500) 0%, var(--danger-600) 100%);
    box-shadow: var(--shadow-md), 0 0 24px rgba(239, 68, 68, 0.25);
}

/* Success Button */
.btn-success {
    background: linear-gradient(180deg, var(--success-400) 0%, var(--success-500) 100%);
    color: var(--black-rich);
    border-color: transparent;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-success:hover {
    background: linear-gradient(180deg, var(--success-500) 0%, var(--success-600) 100%);
}

/* Button Sizes */
.btn-xs {
    padding: 4px 8px;
    font-size: 10px;
    border-radius: var(--radius-sm);
}

.btn-sm {
    padding: 6px 10px;
    font-size: var(--text-xs);
}

.btn-lg {
    padding: 10px 18px;
    font-size: var(--text-sm);
    border-radius: var(--radius-lg);
}

.btn-icon {
    padding: 8px;
    aspect-ratio: 1;
}

.btn-icon.btn-sm {
    padding: 6px;
}

.btn-block {
    width: 100%;
}

/* ============================================
   FORMS - Compact
   ============================================ */
.form-group {
    margin-bottom: var(--space-3);
}

.form-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-400);
}

.form-input,
.form-select,
.form-textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-out);
    outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover,
input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-default);
    background: var(--bg-elevated);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--accent-muted), var(--shadow-sm);
}

.form-select,
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: var(--space-10);
    cursor: pointer;
}

.form-textarea,
textarea {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--danger-400);
    margin-top: var(--space-1);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
}

/* Input Group */
.input-group {
    display: flex;
    gap: 0;
}

.input-group .form-input,
.input-group input {
    border-radius: 0;
}

.input-group .form-input:first-child,
.input-group input:first-child {
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.input-group .form-input:last-child,
.input-group .btn:last-child,
.input-group input:last-child {
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.input-group .btn {
    border-radius: 0;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    /* width: 16px set in HTML */
    /* height: 16px set in HTML */
    accent-color: var(--accent);
    cursor: pointer;
}

/* ============================================
   CARDS - Premium Glass Morphism
   ============================================ */
.card {
    background: linear-gradient(135deg,
            rgba(23, 23, 23, 0.98) 0%,
            rgba(17, 17, 17, 0.95) 50%,
            rgba(20, 20, 20, 0.98) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(6, 182, 212, 0.1) 0%,
            transparent 50%,
            rgba(139, 92, 246, 0.05) 100%);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-out);
    pointer-events: none;
}

.card:hover::before {
    opacity: 1;
}

.card:hover {
    border-color: var(--border-default);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(20, 184, 166, 0.05);
}

.card-glass {
    background: linear-gradient(160deg,
            rgba(30, 30, 30, 0.95) 0%,
            rgba(20, 20, 20, 0.9) 100%);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.card-elevated {
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.card-elevated:hover {
    box-shadow:
        var(--shadow-xl),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    border-color: var(--border-strong);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    min-height: 40px;
}

.card-title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.card-title svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.card-body {
    padding: var(--space-3);
}

.card-footer {
    padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
}

/* Stats Card */
.stats-card {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stats-card .stat-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1;
}

.stats-card .stat-label {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.stats-card .stat-change {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.stats-card .stat-change.positive {
    color: var(--success-400);
}

.stats-card .stat-change.negative {
    color: var(--danger-400);
}

/* ============================================
   NAVIGATION - Top Bar (Glassmorphism)
   ============================================ */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    height: var(--header-height);
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.95) 0%, rgba(10, 10, 10, 0.85) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.top-nav-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.top-nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
}

.top-nav-logo {
    width: 28px;
    height: 28px;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-nav-title {
    font-weight: var(--font-bold);
    font-size: 15px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--text-tertiary);
    transition: color var(--duration-fast);
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    color: var(--gray-700);
}

.breadcrumb-current {
    color: var(--text-secondary);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.brand-logo {
    /* width: 36px; */
    /* height: 36px; */
    background: linear-gradient(135deg, var(--cyan-400) 0%, var(--cyan-600) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    color: var(--black-rich);
    font-size: var(--text-lg);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

.brand-text {
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
    letter-spacing: var(--tracking-tight);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-text span {
    background: linear-gradient(135deg, var(--cyan-400) 0%, var(--cyan-500) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-subtitle {
    font-size: 9px;
    font-weight: var(--font-medium);
    color: var(--gray-500);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid var(--gray-700);
}

.top-nav-subtitle {
    font-size: 9px;
    font-weight: var(--font-medium);
    color: var(--gray-500);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid var(--gray-700);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.nav-link {
    padding: 8px 16px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: linear-gradient(90deg, var(--cyan-400), var(--cyan-500));
    border-radius: var(--radius-full);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.user-avatar {
    /* width: 36px; */
    /* height: 36px; */
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--cyan-500) 0%, var(--purple-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    color: var(--white);
    text-transform: uppercase;
    box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px var(--border-subtle);
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.user-role {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ============================================
   SIDEBAR - App Layout
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--duration-normal) var(--ease-out);
}

/* When sidebar is collapsed */
body.sidebar-collapsed .app-content {
    margin-left: 70px;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Glaucoma One Watermark */
.app-layout::before {
    content: 'Glaucoma One';
    position: fixed;
    bottom: 40px;
    right: 40px;
    font-size: 72px;
    font-weight: 800;
    letter-spacing: -2px;
    color: var(--gray-900);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
    user-select: none;
    white-space: nowrap;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.mobile-menu-toggle:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
}

.app-sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: var(--z-sticky);
    transition: transform var(--duration-normal) var(--ease-out),
        width var(--duration-normal) var(--ease-out),
        left 0.3s ease-in-out;
}

/* Collapsed sidebar state */
.app-sidebar.collapsed {
    width: 70px;
}

.app-sidebar.collapsed .sidebar-logo .brand-text,
.app-sidebar.collapsed .nav-text,
.app-sidebar.collapsed .nav-section-title,
.app-sidebar.collapsed .user-card-details,
.app-sidebar.collapsed .btn-text,
.app-sidebar.collapsed .sidebar-version {
    display: none !important;
}

.app-sidebar.collapsed .sidebar-footer {
    padding: var(--space-3) var(--space-2) !important;
}

.app-sidebar.collapsed .sidebar-footer .user-card {
    margin-bottom: var(--space-3) !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
    justify-content: center !important;
    gap: 0 !important;
}

.app-sidebar.collapsed .sidebar-header-actions {
    flex-direction: column;
}

.app-sidebar.collapsed .sidebar-collapse-toggle svg {
    transform: rotate(180deg);
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    min-height: 56px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
    margin-right: var(--space-2);
}

.sidebar-logo .brand-text {
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    white-space: nowrap;
    transition: opacity var(--duration-fast);
}

.sidebar-logo .brand-text span {
    color: var(--accent);
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-shrink: 0;
}

.btn-sidebar-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--bg-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.btn-sidebar-action:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    color: var(--accent);
}

.sidebar-collapse-toggle svg {
    transition: transform var(--duration-normal);
}

.sidebar-logo svg {
    width: 32px;
    height: 32px;
}

.sidebar-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--cyan-400) 0%, var(--cyan-600) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    color: var(--black-rich);
    font-size: var(--text-base);
    box-shadow: var(--shadow-glow);
}

.sidebar-logo-text {
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}

.sidebar-logo-text span {
    color: var(--accent);
}

.sidebar-logo-content {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.sidebar-logo-divider {
    color: var(--gray-600);
    font-size: 10px;
}

.sidebar-logo-subtitle {
    font-size: 10px;
    font-weight: var(--font-medium);
    color: var(--gray-400);
    letter-spacing: 0.3px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-2) var(--space-2);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-4);
}

.nav-section-title {
    font-size: 10px;
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: var(--space-1) var(--space-3);
    margin-bottom: 2px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 12px;
    margin-bottom: 1px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    transition: all var(--duration-fast) var(--ease-out);
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.sidebar-nav .nav-link.active {
    background: var(--accent-muted);
    color: var(--accent);
}

.sidebar-nav .nav-link.active::after {
    display: none;
}

.nav-link-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-link.active .nav-link-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: var(--space-3);
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

/* Main content area when using sidebar */
.app-main {
    min-height: calc(100vh - 56px);
    background: var(--bg-base);
    flex: 1;
    position: relative;
}

/* ============================================
   APP HEADER (Patient Dashboard Header)
   ============================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.98) 0%, rgba(10, 10, 10, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    min-height: 56px;
}

.patient-flags {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ============================================
   PATIENT BIODATA CARD
   ============================================ */
.patient-biodata-card {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-5) var(--space-6);
    margin: 0;
}

.patient-biodata-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.patient-avatar-large {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent) 0%, var(--cyan-600) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: 24px;
    color: var(--white);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 200, 255, 0.2);
}

.patient-biodata-info {
    flex: 1;
    min-width: 0;
}

.patient-name {
    font-size: 24px;
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
    letter-spacing: var(--tracking-tight);
}

.patient-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: 4px 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast);
}

.meta-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

.meta-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.patient-biodata-clinical {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.clinical-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.clinical-label {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.clinical-value {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

/* Light mode adjustments */
[data-theme="light"] .patient-biodata-card {
    background: #ffffff;
    border-bottom-color: #e2e8f0;
}

[data-theme="light"] .patient-avatar-large {
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

[data-theme="light"] .patient-name {
    color: #0f172a;
}

[data-theme="light"] .meta-item {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #475569;
}

[data-theme="light"] .meta-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

[data-theme="light"] .patient-biodata-clinical {
    border-top-color: #e2e8f0;
}

[data-theme="light"] .clinical-label {
    color: #64748b;
}

[data-theme="light"] .clinical-value {
    color: #0f172a;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-base) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

/* Page wrapper for centered content */
.page-wrapper {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.page-header .page-wrapper,
.page-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.page-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.page-content {
    padding: var(--space-6);
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

/* ============================================
   APP FOOTER
   ============================================ */
.app-footer {
    padding: var(--space-4) var(--space-6);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
    color: var(--text-tertiary);
}

.footer-content {
    width: 100%;
    display: flex;
    justify-content: center;
}

.footer-content p {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    margin: 0;
}

.page-content::after {
    content: 'G1';
    position: fixed;
    bottom: 30px;
    right: 30px;
    font-size: 120px;
    font-weight: 900;
    letter-spacing: -4px;
    color: var(--gray-900);
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

/* ============================================
   REPORTS PAGE LAYOUT
   ============================================ */
.page-wrapper {
    padding-top: var(--header-height);
    min-height: 100vh;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
}

.page-actions {
    display: flex;
    gap: var(--space-2);
}

/* Reports Stats Grid */
.reports-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    transition: all var(--duration-fast);
}

.stat-card:hover {
    border-color: var(--border-strong);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-content {
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-card-value-sm {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-card-change {
    font-size: 12px;
    margin-top: 6px;
}

.stat-card-change.positive {
    color: var(--success);
}

.stat-card-change.negative {
    color: var(--danger);
}

.stat-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Charts Grid */
.reports-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.reports-charts-row:has(.chart-card-wide) {
    grid-template-columns: 2fr 1fr;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.chart-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Activity Card */
.activity-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.activity-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.activity-view-all {
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
}

.activity-view-all:hover {
    text-decoration: underline;
}

.activity-list {
    max-height: 320px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--duration-fast);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: var(--bg-elevated);
}

.activity-icon {
    /* width: 36px; */
    /* height: 36px; */
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.activity-icon.iop {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan-400);
}

.activity-icon.oct {
    background: rgba(168, 85, 247, 0.15);
    color: var(--purple-400);
}

.activity-icon.vf {
    background: rgba(251, 191, 36, 0.15);
    color: var(--yellow-400);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.activity-eye {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.activity-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.activity-mrn {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
}

.activity-date {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.activity-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-8);
    color: var(--text-muted);
}

.activity-empty svg {
    opacity: 0.5;
}

/* Reports Responsive */
@media (max-width: 1200px) {
    .reports-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .reports-charts-row,
    .reports-charts-row:has(.chart-card-wide) {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .reports-stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: var(--space-4);
    }

    .stat-card-icon {
        width: 40px;
        height: 40px;
    }

    .stat-card-value {
        font-size: 24px;
    }
}

/* ============================================
   SETTINGS PAGE LAYOUT
   ============================================ */
.settings-page {
    max-width: 1200px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-5);
    align-items: start;
}

.settings-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.settings-sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-5));
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.settings-card-full {
    max-height: calc(100vh - var(--header-height) - var(--space-10));
    display: flex;
    flex-direction: column;
}

.settings-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.settings-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.settings-card-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.settings-card-body {
    padding: var(--space-5);
}

.settings-card-body.p-0 {
    padding: 0;
}

/* Subscription Banner */
.subscription-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
}

.subscription-plan {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.subscription-plan-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.subscription-status {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.subscription-status.active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green-400);
}

.subscription-status.trial {
    background: rgba(251, 191, 36, 0.15);
    color: var(--yellow-400);
}

.subscription-status.expired {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red-400);
}

.subscription-trial {
    font-size: 12px;
    color: var(--text-muted);
}

/* Alert Messages */
.alert {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    font-size: 14px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--green-400);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red-400);
}

/* Form Enhancements */
.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.required {
    color: var(--red-400);
}

/* Team List */
.team-list {
    max-height: 300px;
    overflow-y: auto;
}

.team-member {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--duration-fast);
}

.team-member:last-child {
    border-bottom: none;
}

.team-member:hover {
    background: var(--bg-elevated);
}

.team-member-avatar {
    /* width: 36px; */
    /* height: 36px; */
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--cyan-500), var(--purple-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.team-member-info {
    flex: 1;
    min-width: 0;
}

.team-member-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-member-email {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-member-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.team-member-action {
    margin-left: auto;
}

.role-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.role-owner {
    background: rgba(168, 85, 247, 0.15);
    color: var(--purple-400);
}

.role-doctor {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan-400);
}

.role-staff {
    background: rgba(113, 113, 122, 0.15);
    color: var(--gray-400);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    position: relative;
}

.status-dot.active {
    background: var(--green-400);
}

.status-dot.active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid var(--green-400);
    animation: ripple 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.status-dot.inactive {
    background: var(--gray-600);
}

/* Add User Section */
.add-user-section {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.add-user-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-8);
    color: var(--text-muted);
}

.empty-state svg {
    opacity: 0.4;
}

/* Settings Responsive */
@media (max-width: 1024px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-sidebar {
        position: static;
    }

    .settings-card-full {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .settings-card-header {
        padding: var(--space-3) var(--space-4);
    }

    .settings-card-body {
        padding: var(--space-4);
    }

    .subscription-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .team-member {
        flex-wrap: wrap;
    }

    .team-member-meta {
        width: 100%;
        margin-top: var(--space-2);
    }
}

/* ============================================
   VISITS PAGE LAYOUT
   ============================================ */
.visits-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* Visits Toolbar (patient info + actions) */
.visits-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
    gap: var(--space-3);
}

.visits-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.visits-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.visits-back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all var(--duration-fast);
    flex-shrink: 0;
}

.visits-back-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* Patient Card (inline in toolbar) */
.visits-patient-card {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.visits-patient-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--cyan-500) 0%, var(--purple-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: 11px;
    color: var(--white);
    flex-shrink: 0;
}

.visits-patient-info {
    min-width: 0;
}

.visits-patient-name {
    font-size: 14px;
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.visits-patient-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: 1px;
}

.visits-mrn {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.visits-age {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Filter Bar (horizontal) */
.visits-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    gap: var(--space-3);
    flex-wrap: wrap;
}

.visits-filter-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.visits-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--border-subtle);
    transition: all var(--duration-fast);
    white-space: nowrap;
}

.visits-pill:hover {
    color: var(--text-primary);
    border-color: var(--border-default);
    background: var(--bg-elevated);
}

.visits-pill.active {
    color: var(--white);
    background: var(--accent);
    border-color: var(--accent);
}

.visits-pill.iop.active {
    background: var(--cyan-500);
    border-color: var(--cyan-500);
}

.visits-pill.oct.active {
    background: var(--purple-500);
    border-color: var(--purple-500);
}

.visits-pill.vf.active {
    background: #b45309;
    border-color: #b45309;
    color: #fff;
}

.visits-pill.exam.active {
    background: var(--green-500);
    border-color: var(--green-500);
}

.visits-pill.surgery.active {
    background: var(--danger-500);
    border-color: var(--danger-500);
}

.visits-pill.laser.active {
    background: var(--orange-500);
    border-color: var(--orange-500);
}

/* Eye Toggle */
.visits-eye-toggle {
    display: flex;
    background: var(--bg-base);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 3px;
}

.visits-eye-btn {
    padding: 4px 14px;
    font-size: 12px;
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    text-align: center;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--duration-fast);
}

.visits-eye-btn:hover {
    color: var(--text-primary);
}

.visits-eye-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.visits-eye-btn.od.active {
    color: var(--cyan-400);
}

.visits-eye-btn.os.active {
    color: var(--purple-400);
}

/* Main Content */
.visits-main {
    padding: var(--space-4);
    min-width: 0;
    flex: 1;
}

/* Main Content Header */
.visits-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.visits-title {
    font-size: 22px;
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.visits-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.visits-count {
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
}

.visits-filters-active {
    color: var(--accent);
}

/* Empty State */
.visits-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    text-align: center;
    color: var(--text-muted);
}

.visits-empty-icon {
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.visits-empty h3 {
    font-size: 16px;
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin: 0 0 var(--space-2);
}

.visits-empty p {
    font-size: 14px;
    margin: 0 0 var(--space-4);
}

/* Timeline */
.visits-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.visits-timeline-group {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: var(--space-3);
}

.visits-timeline-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: var(--space-3);
}

.visits-date-day {
    font-size: 18px;
    font-weight: var(--font-bold);
    color: var(--text-primary);
    line-height: 1;
}

.visits-date-month {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-top: 2px;
}

.visits-timeline-events {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* Event Card */
.visits-event-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 6px 10px;
}

.visits-event-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.visits-event-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.visits-event-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
    font-size: 10px;
    color: var(--text-muted);
}

.visits-event-time {
    font-family: var(--font-mono);
}

.visits-event-by {
    font-size: 7px;
    color: var(--gray-500);
    opacity: 0.7;
}

.visits-event-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: var(--font-bold);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.visits-event-badge.iop {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan-400);
}

.visits-event-badge.oct {
    background: rgba(168, 85, 247, 0.15);
    color: var(--purple-400);
}

.visits-event-badge.vf {
    background: rgba(251, 191, 36, 0.15);
    color: var(--yellow-400);
}

.visits-event-badge.exam {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green-400);
}

.visits-event-badge.surgery {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-400);
}

.visits-event-badge.laser {
    background: rgba(249, 115, 22, 0.15);
    color: var(--orange-400);
}

.visits-event-badge.medication {
    background: rgba(236, 72, 153, 0.15);
    color: var(--pink-400);
}

.visits-event-time {
    margin-left: auto;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* Event Values */
.visits-event-values {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
}

.visits-event-metric {
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.visits-metric-label {
    font-size: 10px;
    font-weight: var(--font-medium);
    color: var(--text-muted);
    text-transform: uppercase;
}

.visits-metric-value {
    font-size: 15px;
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.visits-metric-unit {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Consolidated Eye Values */
.visits-eye-values {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

.eye-value {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: var(--font-semibold);
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.eye-tag {
    font-size: 9px;
    font-weight: var(--font-bold);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--font-sans);
}

.eye-tag.od {
    background: rgba(6, 182, 212, 0.2);
    color: var(--cyan-400);
}

.eye-tag.os {
    background: rgba(168, 85, 247, 0.2);
    color: var(--purple-400);
}

.vfi-badge {
    font-size: 11px;
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.eye-sep {
    color: var(--text-muted);
    font-size: 12px;
    padding: 0 2px;
}

.metric-label {
    font-size: 10px;
    font-weight: var(--font-bold);
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.visits-event-metric-sm {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.visits-event-tag {
    display: inline-flex;
    padding: 4px 8px;
    font-size: 11px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.visits-event-notes {
    font-size: 12px;
    color: var(--text-secondary);
    margin: var(--space-2) 0 0;
    line-height: 1.4;
}

.visits-event-footer {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: var(--space-2);
}

/* Visits Responsive */
@media (max-width: 900px) {
    .visits-container {
        grid-template-columns: 1fr;
    }

    .visits-sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: var(--space-4);
    }

    .visits-filter-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .visits-filter-item {
        padding: 6px 10px;
    }

    .visits-sidebar-links {
        flex-direction: row;
        margin-top: var(--space-4);
    }

    .visits-timeline-group {
        grid-template-columns: 50px 1fr;
        gap: var(--space-3);
    }

    .visits-date-day {
        font-size: 20px;
    }
}

/* ============================================
   PATIENT INFO HEADER
   ============================================ */
.patient-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.95) 0%, transparent 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
}

.patient-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.patient-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--cyan-500) 0%, var(--purple-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    color: var(--white);
    text-transform: uppercase;
    box-shadow: 0 0 0 2px var(--bg-base), 0 0 16px rgba(6, 182, 212, 0.25);
    flex-shrink: 0;
}

.patient-details h1,
.patient-name {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
    letter-spacing: var(--tracking-tight);
    line-height: 1.3;
}

.patient-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: 2px;
    flex-wrap: wrap;
}

.patient-meta-item {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.patient-meta-item strong,
.patient-meta-item span:first-child {
    color: var(--text-tertiary);
    font-weight: var(--font-normal);
}

.patient-flags {
    display: flex;
    gap: var(--space-2);
}

.alert-flag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    animation: pulse-glow 2s ease-in-out infinite;
}

.alert-flag.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-400);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.15);
}

.alert-flag.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-400);
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.15);
}

@keyframes pulse-glow {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.75;
    }
}

/* ============================================
   EYE LABELS
   ============================================ */
.eye-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    border-radius: var(--radius-md);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.eye-label.od {
    background: var(--bg-elevated);
    color: var(--g1-brand-500);
    border: 1px solid rgba(255, 123, 0, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    text-shadow: none;
}

.eye-label.os {
    background: var(--bg-elevated);
    color: var(--warning-400);
    border: 1px solid rgba(234, 179, 8, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    text-shadow: none;
}

.eye-label.ou {
    background: var(--bg-elevated);
    color: var(--success-400);
    border: 1px solid rgba(34, 197, 94, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    text-shadow: none;
}

/* ============================================
   DASHBOARD GRID
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    grid-template-rows: 1fr auto;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    max-width: var(--content-max-width);
    min-height: calc(100vh - 60px);
}

.zone-graph {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.zone-graph .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 500px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.zone-graph .card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.zone-graph .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.zone-advisor {
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
}

/* ============================================
   ADVISOR PANEL - Ultra Compact
   ============================================ */
.advisor-panel-compact {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    flex: 1;
    position: relative;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.advisor-panel-compact::before {
    display: none;
}

.advisor-section {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.2s ease;
}

.advisor-section:hover {
    background: var(--bg-surface);
}

.advisor-section:last-child {
    border-bottom: none;
}

.advisor-section-header {
    font-size: 11px;
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.count-badge {
    background: var(--gray-600);
    color: var(--white);
    font-size: 10px;
    font-weight: var(--font-bold);
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

/* Traffic Light Mini */
.traffic-light-mini {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tl-indicator {
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    background: var(--gray-500);
    transition: transform 0.2s ease;
    position: relative;
}

@keyframes live-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.85;
    }
}

.tl-indicator.green {
    background: var(--success-400);
    animation: live-pulse 2s ease-in-out infinite;
}

.tl-indicator.amber {
    background: var(--warning-400);
    animation: live-pulse 2s ease-in-out infinite;
}

.tl-indicator.red {
    background: var(--danger-400);
    animation: live-pulse 1.5s ease-in-out infinite;
}

.tl-indicator.gray {
    background: var(--gray-500);
}

.tl-text.gray {
    color: var(--text-muted);
}

.tl-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.tl-text.green {
    color: var(--success-400);
}

.tl-text.amber {
    color: var(--warning-400);
}

.tl-text.red {
    color: var(--danger-400);
}

/* Forecast Mini */
.forecast-mini {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.forecast-mini .forecast-alert {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: var(--font-medium);
    margin-bottom: 4px;
}

.forecast-mini .forecast-alert.warning {
    color: var(--warning-400);
}

.forecast-mini .forecast-alert.danger {
    color: var(--danger-400);
}

.forecast-mini .forecast-alert.safe {
    color: var(--success-400);
}

.forecast-mini .forecast-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 10px;
    color: var(--text-tertiary);
}

.forecast-mini .forecast-confidence {
    font-size: 9px;
    padding: 3px 6px;
    border-radius: 4px;
    margin-top: 4px;
    line-height: 1.3;
}

.forecast-mini .forecast-confidence.caution {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red-400);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.forecast-mini .forecast-confidence.warn {
    background: rgba(245, 158, 11, 0.1);
    color: var(--amber-400);
    border: 1px solid rgba(245, 158, 11, 0.15);
}

/* Risk Mini */
.risk-mini {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.risk-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.risk-badge {
    font-size: 11px;
    font-weight: var(--font-semibold);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-subtle);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.risk-badge:hover {
    transform: scale(1.05);
}

.risk-badge.low,
.risk-badge.good {
    color: var(--success-400);
    background: rgba(34, 197, 94, 0.15);
}

.risk-badge.moderate,
.risk-badge.fair {
    color: var(--warning-400);
    background: rgba(245, 158, 11, 0.15);
}

.risk-badge.high,
.risk-badge.poor {
    color: var(--danger-400);
    background: rgba(239, 68, 68, 0.15);
}

/* ============================================
   VITALS IN ADVISOR PANEL
   ============================================ */
.vitals-advisor {
    padding: 10px 12px !important;
}

.vitals-advisor .advisor-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.eye-toggle-mini {
    display: flex;
    gap: 4px;
    margin-left: auto;
    background: var(--bg-elevated);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.eye-btn-mini {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: var(--font-bold);
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
    opacity: 0.7;
}

.eye-btn-mini:hover {
    opacity: 1;
    background: var(--bg-hover);
}

.eye-btn-mini.active[data-eye="OD"] {
    background: linear-gradient(135deg, var(--cyan-400), var(--teal-500));
    color: var(--black-rich);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4);
    opacity: 1;
}

.eye-btn-mini.active[data-eye="OS"] {
    background: linear-gradient(135deg, var(--purple-400), var(--pink-400));
    color: var(--black-rich);
    box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
    opacity: 1;
}

.eye-btn-mini.active {
    background: var(--accent);
    color: var(--black-rich);
    opacity: 1;
}

.vitals-advisor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.vital-advisor-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    background: var(--bg-base);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.vital-advisor-item:hover {
    border-color: var(--border-subtle);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.vital-advisor-item.highlight {
    background: linear-gradient(135deg, var(--bg-base) 0%, rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.vital-advisor-label {
    font-size: 10px;
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.vital-advisor-value {
    font-size: 20px;
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.vital-advisor-value small {
    font-size: 12px;
    font-weight: var(--font-normal);
    color: var(--text-secondary);
}

.vital-advisor-note {
    font-size: 10px;
    color: var(--text-muted);
}

.vitals-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.vital-alert {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: var(--font-semibold);
    border-radius: var(--radius-sm);
}

.vital-alert.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-400);
}

.vital-alert.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-400);
}

/* ============================================
   LIFESTYLE FACTORS SECTION
   ============================================ */
.lifestyle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.lifestyle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    text-align: center;
}

.lifestyle-icon {
    font-size: 16px;
    line-height: 1;
}

.lifestyle-label {
    font-size: 9px;
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.lifestyle-value {
    font-size: 11px;
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

.lifestyle-value.text-green {
    color: var(--success-400);
}

.lifestyle-value.text-amber,
.lifestyle-value.text-warning {
    color: var(--warning-400);
}

.lifestyle-value.text-danger {
    color: var(--danger-400);
}

.lifestyle-risks {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.lifestyle-risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: var(--font-semibold);
    border-radius: var(--radius-sm);
}

.lifestyle-risk-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-400);
}

.lifestyle-risk-badge.caution {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.lifestyle-risk-badge.info {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* Theme Toggle Button in Top Nav */
.theme-toggle-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: var(--radius-md);
}

.theme-toggle-nav svg {
    /* width: 16px set in HTML */
    /* height: 16px set in HTML */
}

.theme-toggle-nav .sun-icon {
    color: var(--warning-400);
}

.theme-toggle-nav .moon-icon {
    color: var(--accent);
}

[data-theme="light"] .theme-toggle-nav {
    background: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .theme-toggle-nav:hover {
    background: #e2e8f0;
}

/* Form section titles */
.form-section {
    margin-bottom: var(--space-4);
}

.form-section-title {
    font-size: 13px;
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Range input styling */
.form-range {
    width: 100%;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.range-value {
    display: inline-block;
    min-width: 24px;
    text-align: center;
    font-size: 14px;
    font-weight: var(--font-bold);
    color: var(--accent);
    margin-left: 8px;
}

/* Checkbox group styling */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    margin-top: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.theme-toggle svg {
    /* width: 16px set in HTML */
    /* height: 16px set in HTML */
    color: var(--accent);
}

/* Medications Mini */
.meds-mini {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.med-mini-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.med-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.med-dot.med-prostaglandin {
    background: var(--cyan-400);
}

.med-dot.med-beta-blocker {
    background: var(--blue-400);
}

.med-dot.med-alpha-agonist {
    background: var(--purple-400);
}

.med-dot.med-carbonic-anhydrase {
    background: var(--success-400);
}

.med-dot.med-rho-kinase {
    background: var(--pink-400);
}

.med-dot.med-combination {
    background: var(--warning-400);
}

.med-dot.med-other {
    background: var(--gray-400);
}

.med-mini-name {
    flex: 1;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eye-micro {
    font-size: 9px;
    font-weight: var(--font-bold);
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: var(--text-muted);
}

.eye-micro.od {
    color: var(--cyan-400);
}

.eye-micro.os {
    color: var(--pink-400);
}

.eye-micro.ou {
    color: var(--purple-400);
}

/* ============================================
   SPLIT PANEL - Vitals Zone
   ============================================ */
.vitals-split-panel {
    display: grid;
    grid-template-columns: 1fr 0.85fr;
    gap: var(--space-2);
    height: 100%;
}

.panel-left,
.panel-right {
    min-height: 0;
}

.h-full {
    height: 100%;
}

.compact-body {
    padding: var(--space-2) !important;
}

/* Compact Medications List */
.medications-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: var(--space-2);
}

.med-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.med-color {
    width: 3px;
    height: 20px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.med-color.med-prostaglandin {
    background: var(--cyan-400);
}

.med-color.med-beta-blocker {
    background: var(--blue-400);
}

.med-color.med-alpha-agonist {
    background: var(--purple-400);
}

.med-color.med-carbonic-anhydrase {
    background: var(--success-400);
}

.med-color.med-rho-kinase {
    background: var(--pink-400);
}

.med-color.med-combination {
    background: var(--warning-400);
}

.med-color.med-other {
    background: var(--gray-400);
}

.med-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.med-name {
    font-size: 11px;
    font-weight: var(--font-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.med-freq {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* Diagnosis Summary */
.diagnosis-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-subtle);
}

.diagnosis-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    flex: 1;
    min-width: 70px;
}

.diagnosis-label {
    font-size: 9px;
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.diagnosis-value {
    font-size: 11px;
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.diagnosis-value.stage-early {
    color: var(--success-400);
}

.diagnosis-value.stage-moderate {
    color: var(--warning-400);
}

.diagnosis-value.stage-severe {
    color: var(--danger-400);
}

.diagnosis-value.stage-advanced {
    color: var(--danger-400);
}

.empty-state-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    color: var(--text-muted);
    font-size: var(--text-xs);
}

/* Eye Toggle Buttons */
.eye-toggle {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
}

.eye-btn {
    padding: 4px 10px;
    font-size: 10px;
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.eye-btn:hover {
    color: var(--text-primary);
}

.eye-btn.active {
    background: var(--accent);
    color: var(--black-rich);
}

/* ============================================
   ENHANCED PATIENT VITALS
   ============================================ */

/* Primary Vitals Hero */
.vitals-primary {
    margin-bottom: 8px;
}

.vital-hero {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(6, 182, 212, 0.05) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    position: relative;
}

.vital-hero-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cyan-500) 0%, var(--cyan-600) 100%);
    border-radius: var(--radius-sm);
    color: white;
    flex-shrink: 0;
}

.vital-hero-icon svg {
    width: 16px;
    height: 16px;
}

.vital-hero-content {
    flex: 1;
}

.vital-hero-label {
    display: block;
    font-size: 10px;
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.vital-hero-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.vital-hero-value .value-num {
    font-size: 22px;
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1;
}

.vital-hero-value .value-unit {
    font-size: 12px;
    color: var(--text-tertiary);
}

.vital-hero-value.text-danger .value-num {
    color: var(--danger-400);
}

.vital-hero-date {
    font-size: 10px;
    color: var(--text-muted);
}

.vital-hero-target {
    text-align: right;
    padding-left: 12px;
    border-left: 1px solid var(--border-subtle);
}

.vital-hero-target .target-label {
    display: block;
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.vital-hero-target .target-value {
    font-size: 14px;
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    color: var(--success-400);
}

/* Compact Vitals Grid */
.vitals-compact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.vital-mini {
    text-align: center;
    padding: 6px 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    transition: all 0.15s ease;
    cursor: default;
}

.vital-mini:hover {
    border-color: var(--border-default);
    background: var(--bg-surface);
}

.vital-mini-label {
    display: block;
    font-size: 9px;
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.vital-mini-value {
    font-size: 13px;
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1.2;
}

.vital-mini-unit {
    font-size: 10px;
    font-weight: var(--font-normal);
    color: var(--text-tertiary);
}

.vital-mini-indicator {
    font-size: 9px;
    font-weight: var(--font-semibold);
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.vital-mini-indicator.thin {
    background: var(--danger-500/20);
    color: var(--danger-400);
}

.vital-mini-indicator.thick {
    background: var(--warning-500/20);
    color: var(--warning-400);
}

.vital-mini-indicator.normal {
    background: var(--success-500/20);
    color: var(--success-400);
}

.vital-mini-indicator.good {
    background: var(--success-500/20);
    color: var(--success-400);
}

.vital-mini-indicator.moderate {
    background: var(--warning-500/20);
    color: var(--warning-400);
}

/* Secondary Vitals Row */
.vitals-secondary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
}

.vital-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.vital-row-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.vital-row-icon svg {
    width: 12px;
    height: 12px;
}

.vital-row-icon.rnfl {
    background: var(--purple-500/20);
    color: var(--purple-400);
}

.vital-row-icon.vfi {
    background: var(--cyan-500/20);
    color: var(--cyan-400);
}

.vital-row-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.vital-row-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.vital-row-value {
    font-size: 12px;
    font-weight: var(--font-semibold);
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.vital-row-date {
    font-size: 10px;
    color: var(--text-muted);
}

/* ============================================
   ENHANCED CLINICAL TRENDS CHART
   ============================================ */

.chart-card {
    min-height: auto;
}

.chart-container {
    flex: 1;
    min-height: 400px;
    padding-bottom: 16px;
}

.chart-card .card-header {
    flex-wrap: wrap;
    gap: 12px;
}

/* ApexCharts Toolbar Fix - Ensure icons are clickable */
.apexcharts-toolbar {
    z-index: 10 !important;
    pointer-events: auto !important;
}

.apexcharts-toolbar svg {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.apexcharts-zoom-icon,
.apexcharts-zoomin-icon,
.apexcharts-zoomout-icon,
.apexcharts-reset-icon,
.apexcharts-pan-icon,
.apexcharts-selection-icon,
.apexcharts-menu-icon {
    cursor: pointer !important;
    pointer-events: auto !important;
}

.apexcharts-menu {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-default) !important;
    box-shadow: var(--shadow-lg) !important;
}

.apexcharts-menu-item {
    color: var(--text-primary) !important;
}

.apexcharts-menu-item:hover {
    background: var(--bg-surface) !important;
}

.chart-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.chart-header-left .card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-timeframe {
    display: flex;
    gap: 4px;
    background: var(--bg-elevated);
    padding: 3px;
    border-radius: var(--radius-md);
}

.timeframe-btn {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeframe-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.timeframe-btn.active {
    color: var(--white);
    background: var(--gray-700);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.chart-legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.legend-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.legend-item.inactive {
    opacity: 0.4;
}

.legend-value {
    font-family: var(--font-mono);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    min-width: 40px;
    font-size: 13px;
}

.legend-color {
    width: 16px;
    height: 4px;
    border-radius: var(--radius-full);
    box-shadow: 0 0 6px currentColor;
}

.legend-color.iop {
    background: var(--gray-200);
    border: 1px solid var(--border-strong);
}

.legend-color.rnfl {
    background: #a78bfa;
    box-shadow: 0 0 6px rgba(167, 139, 250, 0.4);
}

.legend-color.vfi {
    background: #fbbf24;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

/* Chart Stats Bar */
.chart-stats-bar {
    display: flex;
    gap: 20px;
    padding: 10px 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    border: 1px solid var(--border-subtle);
}

.chart-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chart-stat.highlight {
    padding-left: 16px;
    border-left: 2px solid var(--accent);
    margin-left: auto;
}

.chart-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: var(--font-semibold);
}

.chart-stat-value {
    font-size: 15px;
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.chart-stat-value small {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: var(--font-normal);
}

/* Chart Controls */
.chart-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 8px;
}

.chart-toggle-group {
    display: flex;
    gap: 16px;
}

.chart-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.chart-toggle:hover {
    background: var(--bg-hover);
}

.chart-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.toggle-label {
    font-size: 12px;
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.toggle-label.iop {
    color: var(--white);
}

.toggle-label.rnfl {
    color: var(--purple-400);
}

.toggle-label.vfi {
    color: var(--indigo-400);
}

.toggle-label.target {
    color: var(--success-400);
}

.chart-actions {
    display: flex;
    gap: 4px;
}

/* Risk Assessment */
.risk-assessment {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.risk-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.risk-item:last-child {
    border-bottom: none;
}

.risk-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.risk-value {
    font-size: 11px;
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.risk-value.risk-low {
    color: var(--success-400);
}

.risk-value.risk-good {
    color: var(--success-400);
}

.risk-value.risk-moderate {
    color: var(--warning-400);
}

.risk-value.risk-high {
    color: var(--danger-400);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    /* height: 16px set in HTML */
    padding: 0 6px;
    font-size: 10px;
    font-weight: var(--font-bold);
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.badge-accent {
    background: var(--accent-muted);
    color: var(--accent);
}

/* Nav Action Links */
.nav-action {
    color: var(--text-muted) !important;
}

.nav-action:hover {
    color: var(--accent) !important;
    background: var(--accent-muted) !important;
}

/* Vitals Grid - Legacy */
.vitals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: var(--space-2);
}

/* ============================================
   VITAL STATS - Compact
   ============================================ */
.vital-stat {
    text-align: center;
    padding: var(--space-3);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.vital-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.vital-stat:hover {
    border-color: var(--border-default);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.vital-stat:hover::before {
    opacity: 1;
}

.vital-stat-label {
    display: block;
    font-size: 10px;
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-1);
}

.vital-stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.vital-stat-unit {
    font-size: var(--text-xs);
    font-weight: var(--font-normal);
    color: var(--text-tertiary);
    margin-left: 2px;
}

.vital-stat-change {
    font-size: 10px;
    font-weight: var(--font-medium);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.vital-stat-change.positive {
    color: var(--success-400);
}

.vital-stat-change.negative {
    color: var(--danger-400);
}

.vital-stat-change.neutral {
    color: var(--text-tertiary);
}

/* IOP Values */
.iop-values {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
}

.iop-eye {
    text-align: center;
}

.iop-eye-label {
    font-size: 10px;
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-1);
}

.iop-eye-label.od {
    color: var(--cyan-400);
}

.iop-eye-label.os {
    color: var(--purple-400);
}

.iop-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Text colors */
.text-green {
    color: var(--success-400) !important;
}

.text-accent {
    color: var(--accent) !important;
}

.text-red,
.text-danger {
    color: var(--danger-400) !important;
}

.hover-danger:hover {
    color: var(--danger-400) !important;
}

.hover-danger:hover svg {
    stroke: var(--danger-400) !important;
}

.text-yellow,
.text-amber {
    color: var(--warning-400) !important;
}

.text-cyan {
    color: var(--cyan-400) !important;
}

.text-purple {
    color: var(--purple-400) !important;
}

/* ============================================
   TRAFFIC LIGHT - IOP Status
   ============================================ */
.traffic-light-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.traffic-light {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2);
}

.traffic-light-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
    background: linear-gradient(180deg, var(--gray-800) 0%, var(--gray-900) 100%);
    border-radius: var(--radius-xl);
    border: 2px solid var(--gray-700);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.traffic-light-bulb {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--gray-700);
    transition: all var(--duration-normal) var(--ease-out);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    position: relative;
}

/* Ripple animation */
@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

.traffic-light-bulb.active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid currentColor;
    animation: ripple 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.traffic-light-bulb.red.active {
    background: radial-gradient(circle at 35% 35%, var(--danger-400), var(--danger-500));
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    color: var(--danger-400);
}

.traffic-light-bulb.amber.active {
    background: radial-gradient(circle at 35% 35%, var(--warning-400), var(--warning-500));
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    color: var(--warning-400);
}

.traffic-light-bulb.green.active {
    background: radial-gradient(circle at 35% 35%, var(--success-400), var(--success-500));
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    color: var(--success-400);
}

.traffic-light-label {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.traffic-light-label.green {
    color: var(--success-400);
}

.traffic-light-label.amber {
    color: var(--warning-400);
}

.traffic-light-label.red {
    color: var(--danger-400);
}

/* ============================================
   MEDICATIONS
   ============================================ */
.medications-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.medication-card {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: all var(--duration-fast) var(--ease-out);
}

.medication-card:hover {
    border-color: var(--border-default);
    background: var(--bg-hover);
}

.medication-color-bar {
    width: 3px;
    height: 28px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.medication-color-bar.med-prostaglandin {
    background: linear-gradient(180deg, var(--cyan-300), var(--cyan-500));
}

.medication-color-bar.med-beta-blocker {
    background: linear-gradient(180deg, var(--blue-400), var(--blue-500));
}

.medication-color-bar.med-alpha-agonist {
    background: linear-gradient(180deg, var(--purple-400), var(--purple-500));
}

.medication-color-bar.med-carbonic-anhydrase {
    background: linear-gradient(180deg, var(--success-400), var(--success-500));
}

.medication-color-bar.med-rho-kinase {
    background: linear-gradient(180deg, var(--pink-400), var(--pink-500));
}

.medication-color-bar.med-combination {
    background: linear-gradient(180deg, var(--warning-400), var(--warning-500));
}

.medication-color-bar.med-other {
    background: linear-gradient(180deg, var(--gray-400), var(--gray-500));
}

.medication-info {
    flex: 1;
    min-width: 0;
}

.medication-name {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.medication-dosage {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 1px;
}

/* ============================================
   MODALS - Compact
   ============================================ */
.modal-backdrop,
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.active,
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-spring);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal.active,
.modal-backdrop.active .modal,
.modal-overlay.active .modal {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Ensure forms inside modals propagate the flex constraints to allow body scrolling */
.modal form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: hidden;
    min-height: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
}

.modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-footer {
    flex-shrink: 0;
}

.modal-title {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.btn-icon-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.btn-icon-mini:hover {
    background: var(--bg-hover);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    font-size: var(--text-base);
}

.modal-close:hover {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-4);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    text-align: center;
    transition: all var(--duration-fast) var(--ease-out);
    cursor: pointer;
    background: var(--bg-subtle);
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(6, 182, 212, 0.05);
}

.upload-dropzone-sm {
    padding: var(--space-3);
}

.upload-dropzone-sm .upload-content {
    flex-direction: row;
    gap: 8px;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.divider-text {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-subtle);
}

.divider-text span {
    padding: 0 12px;
}

/* ============================================
   TOASTS - Notifications
   ============================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
    animation: toast-in var(--duration-normal) var(--ease-spring);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.toast-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.toast.success {
    border-left: 4px solid var(--success-500);
}

.toast.success .toast-icon {
    color: var(--success-400);
}

.toast.error {
    border-left: 4px solid var(--danger-500);
}

.toast.error .toast-icon {
    color: var(--danger-400);
}

.toast.warning {
    border-left: 4px solid var(--warning-500);
}

.toast.warning .toast-icon {
    color: var(--warning-400);
}

.toast.info {
    border-left: 4px solid var(--accent);
}

.toast.info .toast-icon {
    color: var(--accent);
}

/* ============================================
   TABLES - Premium
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}

.table th {
    font-size: 11px;
    font-weight: var(--font-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--bg-elevated);
    position: sticky;
    top: 0;
}

.table th:first-child {
    border-radius: var(--radius-lg) 0 0 0;
}

.table th:last-child {
    border-radius: 0 var(--radius-lg) 0 0;
}

.table tbody tr {
    transition: background var(--duration-fast) var(--ease-out);
}

.table tbody tr:hover {
    background: var(--bg-elevated);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table td {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ============================================
   BADGES & PILLS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary {
    background: var(--accent-muted);
    color: var(--accent);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-400);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-400);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-400);
}

.badge-purple {
    background: rgba(168, 85, 247, 0.15);
    color: var(--purple-400);
}

/* Risk Badges */
.risk-badge {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.risk-high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-400);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.risk-moderate {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-400);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.risk-low {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-400);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Status Indicator */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

.status-dot.active {
    background: var(--success-400);
    box-shadow: 0 0 8px var(--success-400);
}

.status-dot.inactive {
    background: var(--gray-500);
}

.status-dot.pending {
    background: var(--warning-400);
    box-shadow: 0 0 8px var(--warning-400);
}

/* ============================================
   MESSAGE ALERTS
   ============================================ */
.message,
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    border: 1px solid;
}

.message-success,
.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--success-400);
}

.message-error,
.alert-error,
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger-400);
}

.message-warning,
.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--warning-400);
}

.message-info,
.alert-info {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--cyan-400);
}

/* ============================================
   TIMELINE
   ============================================ */
.timeline {
    position: relative;
    padding-left: var(--space-8);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: var(--space-2);
    bottom: var(--space-2);
    width: 2px;
    background: var(--border-subtle);
    border-radius: var(--radius-full);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-6);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: calc(-1 * var(--space-8) + 4px);
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 2px solid var(--accent);
    z-index: 1;
}

.timeline-item.iop .timeline-marker {
    border-color: var(--white);
    background: var(--gray-800);
}

.timeline-item.oct .timeline-marker {
    border-color: var(--purple-400);
}

.timeline-item.vf .timeline-marker {
    border-color: var(--cyan-400);
}

.timeline-item.surgery .timeline-marker {
    border-color: var(--danger-400);
}

.timeline-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all var(--duration-fast) var(--ease-out);
}

.timeline-content:hover {
    border-color: var(--border-default);
}

.timeline-date {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
}

.timeline-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.timeline-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* ============================================
   IMPERSONATION BANNER
   ============================================ */
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: 10px var(--space-4);
    background: linear-gradient(135deg, var(--warning-500) 0%, var(--warning-600) 100%);
    color: var(--black-rich);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.impersonation-banner a {
    color: var(--black-rich);
    text-decoration: underline;
    font-weight: var(--font-bold);
}

/* ============================================
   LOADING STATES
   ============================================ */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    /* width: 36px; */
    /* height: 36px; */
    border-width: 3px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 0%, var(--bg-surface) 50%, var(--bg-elevated) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay);
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-6);
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-4);
    opacity: 0.3;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    max-width: 320px;
    margin-bottom: var(--space-6);
}

/* ============================================
   LOGIN PAGE - Centered
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: var(--gray-950);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.login-page::after {
    content: 'G1';
    position: absolute;
    bottom: 40px;
    right: 60px;
    font-size: 180px;
    font-weight: 900;
    letter-spacing: -8px;
    color: var(--gray-900);
    opacity: 0.2;
    pointer-events: none;
    user-select: none;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: var(--space-8);
    width: 100%;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--space-6);
    text-align: center;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--cyan-400) 0%, var(--cyan-500) 100%);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-950);
    margin-bottom: var(--space-4);
    box-shadow: 0 0 40px rgba(6, 182, 212, 0.4);
}

.login-logo-text {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.login-logo-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.form-link {
    font-size: 12px;
    color: var(--text-muted);
    transition: color var(--duration-fast);
}

.form-link:hover {
    color: var(--accent);
}

.input-with-icon {
    position: relative;
}

.input-with-icon svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    pointer-events: none;
}

.input-with-icon input {
    padding-left: 44px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.checkbox-label {
    user-select: none;
}

.login-submit {
    margin-top: var(--space-2);
    height: 48px;
    font-size: 15px;
}

.login-footer {
    text-align: center;
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-subtle);
}

.login-footer p {
    font-size: 13px;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--accent);
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

.login-copyright {
    margin-top: var(--space-6);
    text-align: center;
}

.login-copyright p {
    font-size: 11px;
    color: var(--gray-600);
    line-height: 1.6;
}

/* Login page responsive */
@media (max-width: 480px) {
    .login-page {
        padding: var(--space-4);
    }

    .login-card {
        padding: var(--space-6);
    }

    .login-page::after {
        font-size: 100px;
        bottom: 20px;
        right: 20px;
    }
}

/* ============================================
   ACTION BUTTONS GRID
   ============================================ */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
}

.action-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    text-decoration: none;
    color: var(--text-secondary);
}

.action-button:hover {
    background: var(--bg-elevated);
    border-color: var(--border-default);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-button:hover .action-icon {
    color: var(--accent);
}

.action-icon {
    font-size: var(--text-xl);
    transition: color var(--duration-fast);
}

.action-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

/* ============================================
   STATS GRID
   ============================================ */
\.reports-stats-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

/* ============================================
   SEARCH BAR
   ============================================ */
.search-bar {
    position: relative;
    max-width: 320px;
}

.search-bar input {
    padding-left: 44px;
}

.search-bar-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    /* width: 16px set in HTML */
    /* height: 16px set in HTML */
    color: var(--text-muted);
    pointer-events: none;
}

/* ============================================
   DROPDOWN MENUS
   ============================================ */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    min-width: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--duration-fast) var(--ease-out);
    overflow: hidden;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all var(--duration-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-2) 0;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: -1px;
}

.tab {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    padding: var(--space-5) 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
}

.pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    /* height: 36px; */
    padding: 0 var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.pagination-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border-default);
    color: var(--text-primary);
}

.pagination-item.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--black-rich);
}

.pagination-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.grid {
    display: grid;
}

.hidden {
    display: none !important;
}

.block {
    display: block;
}

.inline {
    display: inline;
}

.inline-block {
    display: inline-block;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.items-stretch {
    align-items: stretch;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.justify-start {
    justify-content: flex-start;
}

.flex-col {
    flex-direction: column;
}

.flex-row {
    flex-direction: row;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

.gap-1 {
    gap: var(--space-1);
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-5 {
    gap: var(--space-5);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

.p-0 {
    padding: 0;
}

.p-2 {
    padding: var(--space-2);
}

.p-3 {
    padding: var(--space-3);
}

.p-4 {
    padding: var(--space-4);
}

.p-5 {
    padding: var(--space-5);
}

.p-6 {
    padding: var(--space-6);
}

.p-8 {
    padding: var(--space-8);
}

.px-2 {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
}

.px-3 {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
}

.px-4 {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.px-5 {
    padding-left: var(--space-5);
    padding-right: var(--space-5);
}

.px-6 {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

.py-2 {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
}

.py-3 {
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
}

.py-4 {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
}

.py-5 {
    padding-top: var(--space-5);
    padding-bottom: var(--space-5);
}

.pt-4 {
    padding-top: var(--space-4);
}

.pb-4 {
    padding-bottom: var(--space-4);
}

.pl-4 {
    padding-left: var(--space-4);
}

.pr-4 {
    padding-right: var(--space-4);
}

.m-0 {
    margin: 0;
}

.m-auto {
    margin: auto;
}

.mb-1 {
    margin-bottom: var(--space-1);
}

.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-3 {
    margin-bottom: var(--space-3);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-5 {
    margin-bottom: var(--space-5);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.mb-8 {
    margin-bottom: var(--space-8);
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-3 {
    margin-top: var(--space-3);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-5 {
    margin-top: var(--space-5);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mt-8 {
    margin-top: var(--space-8);
}

.mt-auto {
    margin-top: auto;
}

.ml-2 {
    margin-left: var(--space-2);
}

.ml-auto {
    margin-left: auto;
}

.mr-2 {
    margin-right: var(--space-2);
}

.mr-auto {
    margin-right: auto;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.my-4 {
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
}

.w-full {
    width: 100%;
}

.w-auto {
    width: auto;
}

.h-full {
    height: 100%;
}

.h-auto {
    height: auto;
}

.min-h-screen {
    min-height: 100vh;
}

.max-w-sm {
    max-width: 384px;
}

.max-w-md {
    max-width: 448px;
}

.max-w-lg {
    max-width: 512px;
}

.max-w-xl {
    max-width: 576px;
}

.max-w-2xl {
    max-width: 672px;
}

.rounded {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.rounded-2xl {
    border-radius: var(--radius-2xl);
}

.rounded-full {
    border-radius: var(--radius-full);
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-xs {
    font-size: var(--text-xs);
}

.text-sm {
    font-size: var(--text-sm);
}

.text-base {
    font-size: var(--text-base);
}

.text-lg {
    font-size: var(--text-lg);
}

.text-xl {
    font-size: var(--text-xl);
}

.text-2xl {
    font-size: var(--text-2xl);
}

.text-3xl {
    font-size: var(--text-3xl);
}

.text-4xl {
    font-size: var(--text-4xl);
}

.font-normal {
    font-weight: var(--font-normal);
}

.font-medium {
    font-weight: var(--font-medium);
}

.font-semibold {
    font-weight: var(--font-semibold);
}

.font-bold {
    font-weight: var(--font-bold);
}

.font-mono {
    font-family: var(--font-mono);
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.text-muted {
    color: var(--text-muted);
}

.text-accent {
    color: var(--accent);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.whitespace-nowrap {
    white-space: nowrap;
}

.break-words {
    word-break: break-word;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

.overflow-x-auto {
    overflow-x: auto;
}

.overflow-y-auto {
    overflow-y: auto;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.sticky {
    position: sticky;
}

.inset-0 {
    inset: 0;
}

.top-0 {
    top: 0;
}

.right-0 {
    right: 0;
}

.bottom-0 {
    bottom: 0;
}

.left-0 {
    left: 0;
}

.z-0 {
    z-index: 0;
}

.z-10 {
    z-index: 10;
}

.z-20 {
    z-index: 20;
}

.z-50 {
    z-index: 50;
}

.cursor-pointer {
    cursor: pointer;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

.select-none {
    user-select: none;
}

.pointer-events-none {
    pointer-events: none;
}

.opacity-0 {
    opacity: 0;
}

.opacity-50 {
    opacity: 0.5;
}

.opacity-75 {
    opacity: 0.75;
}

.opacity-100 {
    opacity: 1;
}

.transition {
    transition: all var(--duration-fast) var(--ease-out);
}

.transition-none {
    transition: none;
}

.border {
    border: 1px solid var(--border-default);
}

.border-0 {
    border: 0;
}

.border-t {
    border-top: 1px solid var(--border-subtle);
}

.border-b {
    border-bottom: 1px solid var(--border-subtle);
}

.border-l {
    border-left: 1px solid var(--border-subtle);
}

.border-r {
    border-right: 1px solid var(--border-subtle);
}

.bg-surface {
    background: var(--bg-surface);
}

.bg-elevated {
    background: var(--bg-elevated);
}

.bg-transparent {
    background: transparent;
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.shadow-xl {
    box-shadow: var(--shadow-xl);
}

.shadow-none {
    box-shadow: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1280px) {
    .dashboard-grid {
        grid-template-columns: 1fr 320px;
    }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .zone-advisor {
        grid-column: 1;
        grid-row: auto;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .zone-advisor>* {
        flex: 1;
        min-width: 280px;
    }

    .app-layout {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        transform: translateX(-100%);
        transition: transform var(--duration-normal) var(--ease-out);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 56px;
    }

    .top-nav {
        padding: 0 var(--space-3);
    }

    .top-nav-left {
        gap: var(--space-2);
    }

    .top-nav-subtitle,
    .breadcrumb {
        display: none;
    }

    .top-nav-title {
        font-size: 14px;
    }

    .top-nav-right .btn span {
        display: none;
    }

    .nav-links {
        display: none;
    }

    .page-header {
        padding: var(--space-4);
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .page-content,
    .dashboard-grid {
        padding: var(--space-4);
    }

    .modal {
        max-width: none;
        max-height: none;
        height: 100%;
        border-radius: 0;
    }

    .patient-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    .patient-meta {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .vitals-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    \.reports-stats-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Sidebar mobile */
    .app-sidebar {
        position: fixed;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1000;
    }

    .app-sidebar.open {
        left: 0;
    }

    .sidebar-logo {
        display: flex;
        align-items: center;
        padding: 10px var(--space-3);
        min-height: 44px;
    }

    .sidebar-logo svg {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }

    .sidebar-logo-content {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 4px;
        white-space: nowrap;
    }

    .sidebar-logo-text {
        font-size: 13px;
        white-space: nowrap;
    }

    .sidebar-logo-divider {
        display: inline;
        font-size: 8px;
    }

    .sidebar-logo-subtitle {
        font-size: 8px;
        margin-top: 0;
        white-space: nowrap;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Mobile Menu Toggle Button */
    .mobile-menu-toggle {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1001;
        width: 32px;
        height: 32px;
        padding: 6px;
        background: rgba(18, 18, 22, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        color: var(--text-primary);
        cursor: pointer;
        display: none;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        transition: all 0.2s ease;
    }

    .mobile-menu-toggle svg {
        width: 20px;
        height: 20px;
    }

    .mobile-menu-toggle:hover {
        background: rgba(25, 25, 30, 0.98);
        border-color: rgba(255, 255, 255, 0.15);
    }

    .mobile-menu-toggle.show-mobile {
        display: flex;
    }

    /* Theme Toggle Button - Mobile Positioning */
    .theme-toggle-nav,
    #themeToggleNav {
        position: fixed !important;
        top: 12px;
        right: 12px;
        z-index: 1001;
        width: 32px;
        height: 32px;
        padding: 6px;
        background: rgba(18, 18, 22, 0.95) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 8px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .theme-toggle-nav svg,
    #themeToggleNav svg {
        width: 20px;
        height: 20px;
    }

    .theme-toggle-nav:hover,
    #themeToggleNav:hover {
        background: rgba(25, 25, 30, 0.98) !important;
        border-color: rgba(255, 255, 255, 0.15) !important;
    }

    /* Light Mode Styles for Mobile Buttons */
    [data-theme="light"] .mobile-menu-toggle {
        background: rgba(255, 255, 255, 0.95) !important;
        border-color: rgba(0, 0, 0, 0.1) !important;
        color: #000 !important;
    }

    [data-theme="light"] .mobile-menu-toggle:hover {
        background: rgba(245, 245, 245, 0.98) !important;
        border-color: rgba(0, 0, 0, 0.15) !important;
    }

    [data-theme="light"] .theme-toggle-nav,
    [data-theme="light"] #themeToggleNav {
        background: rgba(255, 255, 255, 0.95) !important;
        border-color: rgba(0, 0, 0, 0.1) !important;
        color: #000 !important;
    }

    [data-theme="light"] .theme-toggle-nav:hover,
    [data-theme="light"] #themeToggleNav:hover {
        background: rgba(245, 245, 245, 0.98) !important;
        border-color: rgba(0, 0, 0, 0.15) !important;
    }

    /* Sidebar logo alignment on mobile — no left offset needed, padding-top handles clearance */
    .app-sidebar .sidebar-logo {
        padding: var(--space-3);
    }

    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }
}

@media (max-width: 480px) {
    .vitals-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .toast {
        min-width: auto;
        margin: 0 var(--space-4);
    }

    /* Hide large watermarks on small screens */
    .app-layout::before,
    .login-page::after {
        font-size: 36px;
        bottom: 20px;
        right: 20px;
        opacity: 0.2;
    }

    .page-content::after {
        font-size: 60px;
        bottom: 15px;
        right: 15px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body {
        background: white;
        color: black;
    }

    /* Hide watermarks in print */
    .app-layout::before,
    .page-content::after,
    .login-page::after {
        display: none;
    }

    .app-sidebar,
    .top-nav,
    .no-print {
        display: none !important;
    }

    .app-main {
        margin-left: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-700);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-600);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-700) transparent;
}

/* ============================================
   SELECTION
   ============================================ */
::selection {
    background: var(--accent-muted);
    color: var(--accent);
}

/* ============================================
   FOCUS VISIBLE
   ============================================ */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
    outline: none;
}

/* ============================================
   APEX CHARTS OVERRIDES
   ============================================ */
.apexcharts-tooltip {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
}

.apexcharts-tooltip-title {
    background: var(--bg-elevated) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    color: var(--text-primary) !important;
    font-weight: var(--font-semibold) !important;
}

.apexcharts-tooltip-text {
    color: var(--text-secondary) !important;
}

.apexcharts-tooltip-series-group {
    background: transparent !important;
}

.apexcharts-xaxistooltip,
.apexcharts-yaxistooltip {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-secondary) !important;
}

.apexcharts-legend-text {
    color: var(--text-secondary) !important;
}

.apexcharts-menu {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-lg) !important;
}

.apexcharts-menu-item:hover {
    background: var(--bg-elevated) !important;
}

/* ============================================
   FOOTER - Site Footer
   ============================================ */
.site-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--gray-500);
}

.site-footer-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.site-footer-brand svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
    opacity: 0.7;
}

.site-footer-copyright {
    color: var(--gray-600);
}

.site-footer-links {
    display: flex;
    gap: var(--space-4);
}

.site-footer-links a {
    color: var(--gray-500);
    transition: color var(--duration-fast);
}

.site-footer-links a:hover {
    color: var(--accent);
}

/* ============================================
   MOBILE RESPONSIVE - Dashboard & Charts
   ============================================ */

/* Tablet and below (1024px) */
@media screen and (max-width: 1024px) {

    /* Sidebar becomes narrower */
    :root {
        --sidebar-width: 200px;
    }

    /* CRITICAL: Change grid to flex column-reverse for vitals above chart */
    .dashboard-grid {
        display: flex !important;
        flex-direction: column-reverse !important;
        height: auto !important;
        padding: var(--space-3);
        gap: var(--space-3);
    }

    /* Reset zone grid positions */
    .zone-graph {
        display: block;
        width: 100%;
    }

    .zone-graph .card {
        min-height: auto;
    }

    .zone-graph .card-body {
        min-height: auto;
    }

    .zone-advisor {
        display: block;
        width: 100%;
    }

    .chart-stats-bar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .chart-stat.highlight {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        width: 100%;
        padding-top: 8px;
        border-top: 1px solid var(--border-subtle);
    }

    /* Hide watermark on tablet */
    .app-layout::before {
        display: none;
    }

    .page-content::after {
        display: none;
    }
}

/* Mobile (768px) - Major layout changes */
@media screen and (max-width: 768px) {

    /* Show mobile menu button */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Ensure dashboard grid uses flex column-reverse on mobile */
    .dashboard-grid {
        display: flex !important;
        flex-direction: column-reverse !important;
        height: auto !important;
        padding: var(--space-2);
        gap: var(--space-3);
    }

    /* Sidebar becomes off-canvas drawer */
    .app-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 260px;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: none;
    }

    .app-sidebar.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    /* Sidebar overlay - backdrop when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* CRITICAL: Remove sidebar margin from main content */
    .app-main {
        margin-left: 0 !important;
        padding: var(--space-3);
        padding-top: 60px;
        /* Space for mobile menu button */
    }

    .app-header {
        margin-left: 0 !important;
        padding: 12px 16px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background: linear-gradient(180deg, rgba(18, 18, 22, 0.98) 0%, rgba(12, 12, 15, 0.95) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        position: sticky;
        top: 0;
        z-index: 100;
    }

    /* Patient Identity Row */
    .app-header .patient-info {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        margin: 0 !important;
        padding: 0 0 0 12px !important;
    }

    /* Compact Avatar */
    .app-header .patient-avatar {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        min-height: 32px !important;
        max-height: 32px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
    }

    /* Patient Details Container */
    .app-header .patient-info>div:not(.patient-avatar) {
        flex: 1;
        min-width: 0;
    }

    /* Patient Name */
    .app-header .patient-name {
        font-size: 16px !important;
        font-weight: 600 !important;
        line-height: 1.2 !important;
        margin: 0 0 3px 0 !important;
        color: var(--text-primary) !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Metadata Row */
    .app-header .patient-meta {
        display: flex !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 2px 12px !important;
        margin: 0 !important;
        font-size: 12px !important;
        color: var(--text-secondary) !important;
        line-height: 1.4 !important;
    }

    .app-header .patient-meta-item {
        font-size: 12px !important;
        white-space: nowrap;
        display: inline-flex;
        align-items: baseline;
    }

    .app-header .patient-meta-item strong {
        font-weight: 500;
        margin-right: 3px;
        color: var(--text-tertiary);
    }

    /* Diagnosis - On Separate Line */
    .app-header .patient-diagnosis-box {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 12px !important;
        color: var(--text-tertiary) !important;
        line-height: 1.4 !important;
    }

    .app-header .patient-diagnosis-box strong {
        font-weight: 500;
        margin-right: 4px;
    }

    .patient-flags {
        width: 100%;
        display: flex;
        gap: 8px;
        margin-top: 8px;
    }

    .alert-flag {
        font-size: 10px;
        padding: 3px 8px;
    }

    /* Chart container adjustments */
    .chart-card {
        border-radius: var(--radius-md);
    }

    .card-header {
        padding: var(--space-2) var(--space-3);
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }

    .card-body {
        padding: var(--space-3);
    }

    .chart-container {
        min-height: 280px;
        margin: 0 calc(-1 * var(--space-2));
    }

    /* Chart header - cleaner layout */
    .chart-header-left {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .chart-header-left .card-title {
        width: 100%;
        justify-content: center;
        font-size: 15px;
        font-weight: var(--font-semibold);
    }

    .chart-timeframe {
        width: 100%;
        justify-content: center;
        background: var(--bg-elevated);
        padding: 4px;
        border-radius: var(--radius-md);
    }

    .timeframe-btn {
        flex: 1;
        text-align: center;
    }

    /* Hide redundant elements on mobile - vitals panel shows this info */
    .chart-legend,
    .chart-stats-bar {
        display: none !important;
    }

    /* Stats grid - organized 2x2 */
    .chart-stats-bar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: var(--space-3);
        background: var(--bg-elevated);
        border-radius: var(--radius-md);
        margin-bottom: var(--space-3);
    }

    .chart-stat {
        text-align: center;
        padding: var(--space-3);
        background: var(--bg-surface);
        border-radius: var(--radius-md);
        border: 1px solid var(--border-subtle);
    }

    .chart-stat-label {
        font-size: 9px;
        margin-bottom: 4px;
        display: block;
    }

    .chart-stat-value {
        font-size: 16px;
        font-weight: var(--font-bold);
    }

    .chart-stat-value small {
        font-size: 10px;
    }

    .chart-stat.highlight {
        grid-column: span 2;
        background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(6, 182, 212, 0.05) 100%);
        border-color: rgba(6, 182, 212, 0.3);
    }

    /* Chart controls - cleaner toggles */
    .chart-controls {
        flex-direction: column;
        gap: 12px;
        padding: var(--space-3);
        background: var(--bg-elevated);
        border-radius: var(--radius-md);
        margin-top: var(--space-2);
        align-items: center;
    }

    .chart-toggle-group {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        width: 100%;
        justify-content: space-between;
        overflow-x: auto;
        padding-bottom: 4px;
        /* For scrollbar if needed */
    }

    .chart-toggle {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .chart-toggle input {
        width: 16px;
        height: 16px;
    }

    .toggle-label {
        font-size: 11px;
        font-weight: var(--font-medium);
    }

    .chart-actions {
        display: flex;
        justify-content: center;
    }

    /* Advisor Panel - Organized sections */
    .advisor-panel-compact {
        background: transparent;
        border: none;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
    }

    .advisor-section {
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-lg);
        padding: var(--space-4);
        margin-bottom: 0;
    }

    .advisor-section-header {
        font-size: 12px;
        font-weight: var(--font-semibold);
        color: var(--text-secondary);
        margin-bottom: var(--space-3);
        padding-bottom: var(--space-2);
        border-bottom: 1px solid var(--border-subtle);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .vitals-advisor-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    .vital-advisor-item {
        background: var(--bg-elevated);
        padding: var(--space-3);
        border-radius: var(--radius-md);
        text-align: center;
    }

    .vital-advisor-item.highlight {
        background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(6, 182, 212, 0.05) 100%);
        border: 1px solid rgba(6, 182, 212, 0.3);
    }

    .vital-advisor-label {
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        margin-bottom: 4px;
    }

    .vital-advisor-value {
        font-size: 18px;
        font-weight: var(--font-bold);
        font-family: var(--font-mono);
    }

    .vital-advisor-note {
        font-size: 9px;
        color: var(--text-tertiary);
        margin-top: 4px;
    }

    /* Eye toggle */
    .eye-toggle-mini {
        display: flex;
        gap: 4px;
        background: var(--bg-elevated);
        padding: 2px;
        border-radius: var(--radius-sm);
    }

    .eye-btn-mini {
        padding: 4px 10px;
        font-size: 10px;
        font-weight: var(--font-semibold);
        border-radius: var(--radius-sm);
    }

    /* Traffic light - horizontal */
    .traffic-light-mini {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-2);
        background: var(--bg-elevated);
        border-radius: var(--radius-md);
    }

    /* Risk assessment */
    .risk-mini {
        gap: var(--space-1);
    }

    .risk-row {
        padding: var(--space-1) 0;
    }

    /* Medications */
    .meds-mini {
        gap: var(--space-1);
    }

    .med-mini-row {
        padding: var(--space-1) 0;
    }
}

/* Small Mobile (480px) */
@media screen and (max-width: 480px) {
    .app-main {
        padding: var(--space-2);
        padding-top: 56px;
    }

    .app-header {
        padding: var(--space-2);
        padding-left: 56px;
    }

    .patient-avatar {
        /* width: 36px; */
        /* height: 36px; */
        font-size: 12px;
    }

    .patient-name {
        font-size: var(--text-base);
    }

    .patient-meta-item {
        font-size: 9px;
    }

    .chart-container {
        min-height: 280px;
    }

    .chart-stats-bar {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .chart-stat-value {
        font-size: 12px;
    }

    .chart-stat-label {
        font-size: 8px;
    }

    .chart-toggle-group {
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 5px;
        justify-content: flex-start;
    }

    .chart-toggle {
        flex: 0 0 auto;
    }

    .toggle-label {
        font-size: 10px;
    }

    .vitals-advisor-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
    }

    .vital-advisor-value {
        font-size: 14px;
    }

    .advisor-section {
        padding: var(--space-2);
    }

    /* Modal adjustments */
    .modal {
        width: calc(100% - 20px) !important;
        max-width: none !important;
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .modal-body {
        padding: var(--space-3);
    }

    .modal-footer {
        padding: var(--space-3);
        flex-direction: column;
        gap: var(--space-2);
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ============================================
   PRINT STYLES - Clinical Passport
   ============================================ */
@media print {

    /* Hide the entire app UI */
    .app-layout,
    .impersonation-banner,
    .mobile-menu-toggle,
    .sidebar-overlay,
    .modal-backdrop,
    .modal,
    #toast-container {
        display: none !important;
    }

    /* Force background and colors for printing */
    html,
    body {
        background: white !important;
        color: black !important;
        overflow: visible !important;
    }

    /* Show the passport */
    #clinical-passport {
        display: block !important;
        background: white !important;
        color: black !important;
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .passport-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 2px solid #000 !important;
        padding-bottom: 1rem;
        margin-bottom: 1.5rem;
    }

    .passport-brand {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .passport-logo {
        width: 48px;
        height: 48px;
        background: #000 !important;
        color: #fff !important;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 800;
        font-size: 24px;
        border-radius: 8px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .passport-brand h1 {
        font-size: 24px;
        font-weight: 700;
        margin: 0;
        color: #000 !important;
    }

    .clinic-name {
        font-size: 14px;
        color: #666 !important;
        margin: 2px 0 0 0;
    }

    .passport-meta {
        text-align: right;
        font-size: 12px;
        color: #333 !important;
    }

    .passport-patient-info {
        margin-bottom: 2rem;
    }

    .passport-patient-info h2 {
        font-size: 28px;
        font-weight: 700;
        margin: 0 0 0.5rem 0;
        color: #000 !important;
    }

    .patient-details-grid {
        display: flex;
        gap: 1.5rem;
        font-size: 14px;
        color: #444 !important;
        margin-bottom: 0.75rem;
    }

    .patient-diagnosis-box {
        background: #f8f8f8 !important;
        padding: 0.75rem 1rem;
        border-radius: 8px;
        border: 1px solid #eee !important;
        font-size: 14px;
        color: #000 !important;
    }

    .passport-chart-box {
        width: 100%;
        height: 300px;
        margin-bottom: 2rem;
        border: 1px solid #eee !important;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .passport-chart-box img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .passport-impression-box {
        background: #fcfcfc !important;
        border: 1px solid #eee !important;
        padding: 1.25rem;
        border-radius: 8px;
        font-size: 13px;
        line-height: 1.6;
        color: #333 !important;
        margin-bottom: 2rem;
    }

    .passport-impression-box p {
        margin: 0 0 0.75rem 0;
    }

    .passport-impression-box p:last-child {
        margin-bottom: 0;
    }

    .passport-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .passport-section {
        break-inside: avoid;
        margin-bottom: 2rem;
    }

    .passport-section h3 {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #666 !important;
        border-bottom: 1px solid #eee !important;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
    }

    .passport-med-item {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .eye-badge {
        font-size: 10px;
        font-weight: 700;
        padding: 2px 6px;
        border: 1px solid #000 !important;
        border-radius: 4px;
        text-transform: uppercase;
        color: #000 !important;
    }

    .med-info {
        display: flex;
        flex-direction: column;
    }

    .med-name {
        font-weight: 600;
        font-size: 14px;
        color: #000 !important;
    }

    .med-desc {
        font-size: 11px;
        color: #777 !important;
    }

    .passport-vitals-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .vital-eye-column {
        margin-bottom: 0.5rem;
    }

    .eye-header {
        display: block;
        font-weight: 700;
        font-size: 12px;
        margin-bottom: 0.25rem;
        color: #333 !important;
    }

    .vital-row {
        display: flex;
        justify-content: space-between;
        padding: 4px 0;
        border-bottom: 1px dashed #eee !important;
    }

    .vital-row .label {
        font-size: 13px;
        color: #666 !important;
    }

    .vital-row .value {
        font-weight: 600;
        font-size: 14px;
        color: #000 !important;
    }

    .passport-lifestyle-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem 2rem;
        background: #fcfcfc !important;
        border: 1px solid #f0f0f0 !important;
        padding: 1rem;
        border-radius: 8px;
    }

    .ls-item {
        font-size: 11px;
        color: #555 !important;
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #f9f9f9 !important;
        padding-bottom: 2px;
    }

    .ls-item strong {
        color: #333 !important;
        font-weight: 600;
    }

    .passport-footer {
        margin-top: 60px;
        border-top: 1px solid #eee !important;
        padding-top: 1.5rem;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
    }

    .passport-footer p {
        font-size: 10px;
        color: #888 !important;
        max-width: 320px;
        line-height: 1.4;
    }

    /* Safety & Allergies */
    .passport-safety-alert {
        margin-top: 1rem;
        border: 2px solid #000 !important;
        display: flex;
        border-radius: 4px;
        overflow: hidden;
    }

    .safety-label {
        background: #000 !important;
        color: #fff !important;
        padding: 0.5rem 0.75rem;
        font-weight: 800;
        font-size: 10px;
        display: flex;
        align-items: center;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .safety-content {
        padding: 0.5rem 0.75rem;
        font-size: 12px;
        line-height: 1.4;
        flex: 1;
    }

    .flag-inline {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: #f0f0f0 !important;
        padding: 2px 6px;
        border-radius: 4px;
        margin-right: 4px;
        font-size: 11px;
    }

    /* Procedures Table */
    .passport-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 0.5rem;
    }

    .passport-table th {
        text-align: left;
        font-size: 11px;
        text-transform: uppercase;
        color: #666 !important;
        border-bottom: 1px solid #eee !important;
        padding-bottom: 0.5rem;
    }

    .passport-table td {
        padding: 0.5rem 0;
        font-size: 13px;
        border-bottom: 1px solid #f9f9f9 !important;
    }

    /* Clinical Notes */
    .passport-notes-box {
        background: #fdfdfd !important;
        border-left: 3px solid #eee !important;
        padding: 1rem 1.5rem;
        font-size: 13px;
        line-height: 1.6;
        color: #444 !important;
    }

    /* Patient Education Card */
    .passport-education-card {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px;
        overflow: hidden;
        margin: 1.5rem 0;
    }

    .edu-header {
        background: #f1f5f9 !important;
        padding: 0.75rem 1rem;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: #475569 !important;
        display: flex;
        align-items: center;
        gap: 8px;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    .edu-icon {
        width: 14px;
        height: 14px;
        color: #3b82f6 !important;
    }

    .edu-body {
        padding: 1rem;
        font-size: 12px;
        line-height: 1.6;
        color: #334155 !important;
        font-style: italic;
    }

    .footer-sign {
        text-align: right;
    }

    .footer-sign span {
        font-size: 11px;
        color: #777 !important;
    }

    .sign-line {
        width: 220px;
        border-bottom: 1px solid #000 !important;
        margin-top: 24px;
    }

    @page {
        margin: 1.5cm;
        size: A4;
    }
}

/* ============================================
   FORM SECTIONS - Modern Lifestyle Modal Styling
   ============================================ */
.form-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    transition: var(--theme-transition);
}

.form-section:hover {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-3) 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    letter-spacing: 0.015em;
}

.form-section-title svg {
    opacity: 0.9;
}

.form-group {
    margin-bottom: var(--space-3);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    letter-spacing: 0.02em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: inherit;
    outline: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-default);
    background: var(--bg-surface);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-select {
    cursor: pointer;
}

.form-range {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--bg-subtle);
    outline: none;
    margin: var(--space-2) 0;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    /* width: 16px set in HTML */
    /* height: 16px set in HTML */
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.form-range::-webkit-slider-thumb:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.range-value {
    display: inline-block;
    width: 32px;
    text-align: center;
    font-weight: 600;
    color: var(--accent);
    font-size: 16px;
    margin-left: var(--space-2);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-inline input[type='checkbox'] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Light mode specific adjustments */
[data-theme='light'] .form-input,
[data-theme='light'] .form-select,
[data-theme='light'] .form-textarea {
    background: #fafafa;
    border-color: #e5e7eb;
}

[data-theme='light'] .form-input:hover,
[data-theme='light'] .form-select:hover,
[data-theme='light'] .form-textarea:hover {
    background: #ffffff;
    border-color: #d1d5db;
}

[data-theme='light'] .form-input:focus,
[data-theme='light'] .form-select:focus,
[data-theme='light'] .form-textarea:focus {
    background: #ffffff;
    border-color: var(--g1-brand-700);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Premium Modal Enhancements */
.modal-body {
    padding: var(--space-6);
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: 20px;
    border: 2px solid transparent;
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    background: var(--bg-surface);
}

/* Modifier Classes - Re-designed for 'Sleek' look (no harsh vertical bars) */
.form-section-danger {
    border: 1px solid rgba(239, 68, 68, 0.15) !important;
    background: rgba(239, 68, 68, 0.03) !important;
}

.form-section-warning {
    border: 1px solid rgba(245, 158, 11, 0.15) !important;
    background: rgba(245, 158, 11, 0.03) !important;
}

[data-theme='dark'] .form-section-danger {
    background: rgba(239, 68, 68, 0.05) !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
}

[data-theme='dark'] .form-section-warning {
    background: rgba(245, 158, 11, 0.05) !important;
    border-color: rgba(245, 158, 11, 0.25) !important;
}

.form-section-danger:hover {
    border-color: rgba(239, 68, 68, 0.3) !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

.form-section-warning:hover {
    border-color: rgba(245, 158, 11, 0.3) !important;
    background: rgba(245, 158, 11, 0.05) !important;
}

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 199;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    display: none;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-fast);
    box-shadow: var(--shadow-md);
}

.mobile-menu-toggle:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    transform: scale(1.05);
}

.mobile-menu-toggle svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   CONSOLIDATED MOBILE RESPONSIVE (≤768px)
   ============================================ */

@media screen and (max-width: 768px) {

    /* === CORE LAYOUT === */
    .app-content {
        padding: 0 !important;
        margin-left: 0 !important;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body.sidebar-collapsed .app-content {
        margin-left: 0 !important;
    }

    .app-container {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .page-content {
        max-width: 100% !important;
        width: 100% !important;
        padding: var(--space-3) !important;
        margin: 0 !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    body {
        overflow-x: hidden;
    }

    /* === NAVIGATION === */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        z-index: 301;
    }

    .app-sidebar {
        left: -280px !important;
        position: fixed !important;
        z-index: 200;
        transform: translateX(0);
        transition: left 0.3s ease;
    }

    body.mobile-menu-open .app-sidebar {
        left: 0 !important;
    }

    .app-sidebar.mobile-open {
        left: 0 !important;
        z-index: 200;
    }

    .sidebar-collapse-toggle {
        display: none !important;
    }

    .top-nav {
        padding: 12px 16px;
    }

    /* === PAGE HEADER === */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
        padding: 16px;
        margin-bottom: 12px;
    }

    .page-header h1,
    .page-title {
        font-size: 22px;
    }

    .page-header .btn {
        width: 100%;
        margin-top: 4px;
    }

    /* === APP HEADER (Dashboard) === */
    .app-header {
        padding: var(--space-2) var(--space-3);
        min-height: 48px;
    }

    .header-actions {
        gap: var(--space-1) !important;
    }

    .header-actions .btn-sm {
        padding: 6px 12px;
        font-size: 11px;
    }

    .header-actions .btn-icon,
    .header-actions .btn-ghost {
        display: inline-flex !important;
        padding: 8px;
    }

    /* === BUTTONS === */
    .btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-xs);
        white-space: nowrap;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 11px;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    /* === FORMS === */
    .form-input,
    .form-select,
    .form-textarea {
        font-size: var(--text-sm);
    }

    .card-body form {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    .card-body form .search-bar {
        width: 100% !important;
        max-width: none !important;
        flex: none !important;
    }

    .card-body form .btn {
        width: 100%;
    }

    .search-bar {
        width: 100% !important;
        max-width: none !important;
        box-sizing: border-box;
    }

    .search-bar input {
        width: 100%;
        box-sizing: border-box;
    }

    /* === MODALS === */
    .modal {
        width: 95% !important;
        max-width: 95% !important;
        margin: 20px auto;
    }

    .modal-body {
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }

    /* === TABLES === */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }

    .table {
        min-width: 600px;
        font-size: 14px;
    }

    .table th,
    .table td {
        padding: 10px 8px;
        white-space: nowrap;
    }

    .table .btn-sm {
        padding: 4px 8px;
        font-size: 12px;
    }

    .hide-mobile {
        display: none !important;
    }

    /* === CARDS & GRIDS === */
    .reports-charts-row {
        grid-template-columns: 1fr !important;
    }

    .page-header-inner {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }



    .stats-grid,
    .reports-stats-grid,
    .grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .stat-card {
        padding: 16px !important;
    }

    .card {
        margin: 0 0 16px 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .card-body {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* === CHARTS === */
    .chart-container,
    [id$="-chart"],
    .echarts-container {
        height: 250px !important;
        margin: 0 -4px;
    }

    .chart-card {
        padding: var(--space-3) !important;
        overflow: hidden;
    }

    .reports-charts-row,
    .reports-charts-row:has(.chart-card-wide) {
        grid-template-columns: 1fr !important;
        gap: var(--space-3);
    }

    .chart-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* === PATIENT BIODATA === */
    .patient-biodata-card {
        padding: var(--space-4);
    }

    .patient-biodata-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--space-3);
    }

    .patient-avatar-large {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }

    .patient-name {
        font-size: 20px;
    }

    .patient-meta {
        justify-content: center;
        gap: var(--space-2);
    }

    .meta-item {
        font-size: 11px;
        padding: 3px 8px;
    }

    .meta-item svg {
        width: 12px;
        height: 12px;
    }

    .patient-biodata-clinical {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .clinical-item {
        padding: var(--space-2);
        background: var(--bg-hover);
        border-radius: var(--radius-md);
    }

    /* === PAGE-SPECIFIC === */
    .patient-avatar {
        width: 32px !important;
        height: 32px !important;
        font-size: 11px !important;
    }

    .passport-zones {
        grid-template-columns: 1fr !important;
    }

    .zone-card {
        min-height: auto;
    }

    .med-list-card {
        padding: 16px;
    }

    .settings-section {
        padding: 16px !important;
    }

    .settings-grid {
        grid-template-columns: 1fr !important;
    }

    .empty-state {
        padding: 32px 16px !important;
    }

    .empty-state-icon {
        width: 48px !important;
        height: 48px !important;
    }

    /* === FOOTER === */
    .app-footer {
        padding: var(--space-3) var(--space-4);
    }

    .footer-content p {
        font-size: 10px;
    }
}

/* Tablet: 769px to 1024px */
@media screen and (min-width: 769px) and (max-width: 1024px) {

    .reports-stats-grid,
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Extra small devices (≤480px) */
@media screen and (max-width: 480px) {
    .page-header h1 {
        font-size: 20px;
    }

    .stat-value {
        font-size: 28px;
    }

    .table {
        font-size: 13px;
    }

    .header-actions .btn-sm span:not(.sr-only) {
        display: none;
    }

    .header-actions .btn-sm svg {
        margin: 0;
    }
}

/* Light mode mobile adjustments */
@media screen and (max-width: 768px) {
    [data-theme="light"] .mobile-menu-toggle {
        background: #ffffff;
        border-color: #e2e8f0;
    }

    [data-theme="light"] .mobile-menu-toggle:hover {
        background: #f8fafc;
        border-color: var(--g1-brand-700);
    }

    [data-theme="light"] .sidebar-overlay {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* Mobile overlays */
.mobile-menu-overlay,
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    cursor: pointer;
}

/* ============================================
   TOAST NOTIFICATION SYSTEM
   ============================================ */

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 48px);
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 14px 16px 14px 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateX(100%) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.toast-exit {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.toast-message {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.toast-close:hover {
    opacity: 1;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border-subtle);
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Toast Variants */
.toast-success {
    border-left: 3px solid var(--green-400);
}

.toast-success .toast-icon {
    color: var(--green-400);
}

.toast-success .toast-progress-bar {
    background: var(--green-400);
}

.toast-error {
    border-left: 3px solid var(--danger-400);
}

.toast-error .toast-icon {
    color: var(--danger-400);
}

.toast-error .toast-progress-bar {
    background: var(--danger-400);
}

.toast-warning {
    border-left: 3px solid var(--warning-400);
}

.toast-warning .toast-icon {
    color: var(--warning-400);
}

.toast-warning .toast-progress-bar {
    background: var(--warning-400);
}

.toast-info {
    border-left: 3px solid var(--accent);
}

.toast-info .toast-icon {
    color: var(--accent);
}

.toast-info .toast-progress-bar {
    background: var(--accent);
}

/* ============================================
   BUTTON LOADING STATE
   ============================================ */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btnSpinner 0.6s linear infinite;
}

.btn-loading>* {
    visibility: hidden;
}

@keyframes btnSpinner {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   SKELETON LOADING PLACEHOLDER
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--bg-surface) 50%, var(--bg-subtle) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   VISIT TIMELINE
   ============================================ */
.visit-timeline-section {
    grid-column: 1 / -1;
    margin-top: var(--space-2);
}

.visit-timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.visit-timeline-header:hover {
    background: var(--bg-hover);
}

.visit-timeline-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.visit-timeline-count {
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: var(--radius-full);
}

.visit-timeline-container {
    max-height: 400px;
    overflow-y: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    padding: 8px 0;
}

.visit-timeline-container.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0;
}

.visit-card {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    border-left: 2px solid var(--border-subtle);
    margin-left: 12px;
    margin-bottom: 2px;
    transition: border-color 0.2s;
}

.visit-card:hover {
    border-left-color: var(--accent);
}

.visit-card:last-child {
    border-left-color: transparent;
}

.visit-card-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    margin-top: 4px;
    margin-left: -17px;
}

.visit-card-content {
    flex: 1;
    min-width: 0;
}

.visit-card-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.visit-card-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.visit-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-hover);
    color: var(--text-secondary);
    white-space: nowrap;
}

.visit-card-tag.iop {
    color: var(--text-primary);
}

.visit-card-tag.oct {
    color: #d946ef;
}

.visit-card-tag.vf {
    color: var(--g1-brand-500);
}

.visit-card-tag.procedure {
    color: #f59e0b;
}

.visit-card-tag.on-target {
    color: var(--success-400);
}

.visit-card-tag.above-target {
    color: var(--danger-400);
}

.visit-card-note {
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-tertiary);
    font-style: italic;
}