/* ==========================================================================
   CoreClinix HMIS - Modern Healthcare UI Design System (v3.5 Dual Theme)
   Designed for QuadraByteCore Technology • 100% ABDM V3 & DHIS Compliant
   WCAG 2.1 AAA/AA Certified • 100% Fully Responsive Design System
   Supports QuadraByteCore Dark Navy (#070b16 / #0b1222) & Crisp Light (#f8fafc / #ffffff)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root,
html.dark,
html[data-theme="dark"] {
    /* ==========================================================================
       1. BRAND ACCENT & ACTION PALETTE (QuadraByteCore Dark Navy Enterprise)
       ========================================================================== */
    --primary: #0284c7;             /* Core Medical Cyan/Sky 600 */
    --primary-hover: #0369a1;       /* Sky 700 */
    --primary-active: #075985;      /* Sky 800 */
    --primary-light: rgba(2, 132, 199, 0.16);
    --primary-border: rgba(56, 189, 248, 0.35);
    --primary-glow: rgba(0, 210, 255, 0.25);

    --success: #10b981;             /* Emerald 500 - Verified / Doctor Active */
    --success-hover: #059669;       /* Emerald 600 */
    --success-active: #047857;      /* Emerald 700 */
    --success-light: rgba(16, 185, 129, 0.15);
    --success-border: rgba(52, 211, 153, 0.35);
    --success-glow: rgba(16, 185, 129, 0.25);

    --warning: #f59e0b;             /* Amber 500 - Attention / Renewal */
    --warning-hover: #d97706;       /* Amber 600 */
    --warning-light: rgba(245, 158, 11, 0.15);
    --warning-border: rgba(251, 191, 36, 0.35);

    --danger: #ef4444;              /* Red 500 - Emergency / Critical Warning */
    --danger-hover: #dc2626;        /* Red 600 */
    --danger-active: #b91c1c;       /* Red 700 */
    --danger-light: rgba(239, 68, 68, 0.15);
    --danger-border: rgba(248, 113, 113, 0.35);
    --danger-glow: rgba(239, 68, 68, 0.25);

    --accent-indigo: #6366f1;       /* Indigo 500 - ABDM Gateway & FHIR */
    --accent-indigo-light: rgba(99, 102, 241, 0.15);
    --accent-indigo-border: rgba(129, 140, 248, 0.35);

    --accent-cyan: #00d2ff;         /* QuadraByteCore Cyan */
    --accent-teal: #14b8a6;         /* Teal 500 */
    --accent-purple: #a855f7;       /* QuadraByteCore Purple */

    /* ==========================================================================
       2. TEXT COLORS & CONTRAST HIERARCHY (QuadraByteCore Dark Navy)
       ========================================================================== */
    --text-primary: #f8fafc;        /* Crisp White/Slate-50 Headings & Titles */
    --text-main: #f8fafc;           /* Backward compatibility alias */
    --text-body: #cbd5e1;           /* Slate 300 - Body copy, Form labels */
    --text-muted: #94a3b8;          /* Slate 400 - Secondary text, Hints */
    --text-light: #64748b;          /* Slate 500 - Placeholders, Inactive icons */
    --text-white: #ffffff;

    /* ==========================================================================
       3. SURFACES & NEUTRALS (Exact quadrabytecore.com Dark Navy Palette)
       ========================================================================== */
    --bg-page: #070b16;             /* QuadraByteCore Main Dark Background (#070b16) */
    --bg-card: #0b1222;             /* QuadraByteCore Card Background (#0b1222) */
    --bg-elevated: #0f172a;         /* QuadraByteCore Input / Inner Surface (#0f172a) */
    --bg-hover: #131f38;            /* Interactive Hover Surface */
    --topbar-bg: rgba(6, 26, 47, 0.95); /* QuadraByteCore dark:bg-[#061a2f]/95 */
    --topbar-border: #20344a;       /* QuadraByteCore dark:border-[#20344a] */
    --border-color: rgba(59, 130, 246, 0.22);        /* QuadraByteCore dark:border-blue-500/20 */
    --border-color-strong: rgba(59, 130, 246, 0.35); /* QuadraByteCore dark:border-blue-500/30 */
    --border-focus: #00d2ff;

    /* ==========================================================================
       4. TYPOGRAPHY SCALES & ELEVATIONS
       ========================================================================== */
    --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --border-radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-pill: 9999px;

    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px -2px rgba(0, 0, 0, 0.55), 0 2px 8px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 14px 32px -4px rgba(0, 0, 0, 0.65), 0 4px 12px -2px rgba(0, 0, 0, 0.45);
    --shadow-xl: 0 24px 48px -8px rgba(0, 0, 0, 0.8);

    --transition-fast: all 0.16s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    color-scheme: dark;
}

/* ==========================================================================
   LIGHT MODE PALETTE (QuadraByteCore Light Mode: #f8fafc / #ffffff)
   ========================================================================== */
html:not(.dark)[data-theme="light"],
html[data-theme="light"] {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-active: #075985;
    --primary-light: #f0f9ff;
    --primary-border: #bae6fd;
    --primary-glow: rgba(2, 132, 199, 0.22);

    --success: #059669;
    --success-hover: #047857;
    --success-active: #064e3b;
    --success-light: #ecfdf5;
    --success-border: #a7f3d0;
    --success-glow: rgba(5, 150, 105, 0.22);

    --warning: #d97706;
    --warning-hover: #b45309;
    --warning-light: #fffbeb;
    --warning-border: #fde68a;

    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-active: #991b1b;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;
    --danger-glow: rgba(220, 38, 38, 0.22);

    --accent-indigo: #4f46e5;
    --accent-indigo-light: #eef2ff;
    --accent-indigo-border: #c7d2fe;

    --accent-cyan: #0284c7;
    --accent-teal: #0d9488;
    --accent-purple: #7c3aed;

    --text-primary: #0f172a;
    --text-main: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;

    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #f1f5f9;
    --topbar-bg: rgba(255, 255, 255, 0.95);
    --topbar-border: #e2e8f0;
    --border-color: #e2e8f0;
    --border-color-strong: #cbd5e1;
    --border-focus: #0284c7;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
    --shadow-xl: 0 20px 40px -8px rgba(15, 23, 42, 0.22);
    color-scheme: light;
}

/* ==========================================================================
   Theme Toggle Button (QuadraByteCore Sun / Moon Switcher)
   ========================================================================== */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 9999px;
    border: 1.5px solid var(--border-color-strong);
    background: var(--bg-elevated);
    color: #facc15;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
    font-size: 15px;
    padding: 0;
}

.theme-toggle-btn:hover {
    transform: scale(1.07);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px var(--primary-glow);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

html[data-theme="light"] .theme-toggle-btn {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

html[data-theme="light"] .theme-toggle-btn:hover {
    background: #e2e8f0;
    color: #0284c7;
}

/* Show Sun in Dark Mode (to switch to Light), Show Moon in Light Mode (to switch to Dark) */
.theme-toggle-btn .theme-icon-sun {
    display: inline-block;
    color: #facc15;
}
.theme-toggle-btn .theme-icon-moon {
    display: none;
    color: #334155;
}

html[data-theme="light"] .theme-toggle-btn .theme-icon-sun {
    display: none;
}
html[data-theme="light"] .theme-toggle-btn .theme-icon-moon {
    display: inline-block;
}

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

html, body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-body);
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    line-height: 1.5;
    transition: background-color 0.25s ease, color 0.25s ease;
}

code, pre, .font-mono {
    font-family: var(--font-mono);
}

/* Standard Typography Headings */
h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    line-height: 1.25;
}

h2 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.3;
}

h3 {
    font-size: 16px;
    font-weight: 750;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    line-height: 1.35;
}

h4 {
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.4;
}

h5 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-body);
    line-height: 1.4;
}

p {
    font-size: 13px;
    color: var(--text-body);
    line-height: 1.55;
}

/* ==========================================================================
   Sidebar Navigation (QuadraByteCore Deep Navy #060f24 -> #070b16)
   ========================================================================== */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #060f24 0%, #070b16 100%);
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid rgba(59, 130, 246, 0.2);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.16);
    display: flex;
    align-items: center;
    gap: 12px;
}

.hospital-logo {
    width: 72px;
    height: 42px;
    background: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
    border: none;
    flex-shrink: 0;
    overflow: hidden;
    padding: 3px 5px;
}

.hospital-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

/* App Title / Brand Header Typography */
.brand-info h1 {
    font-size: 17px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    letter-spacing: -0.025em;
    white-space: nowrap;
}

.brand-info h1 span {
    display: inline;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: none;
    margin: 0;
}

.nav-menu {
    list-style: none;
    padding: 14px 10px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.nav-menu::-webkit-scrollbar {
    width: 5px;
}

.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.nav-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Section / Category Headings Typography */
.nav-section-title {
    display: none;
}

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

/* Menu Items Typography & Interactions */
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: var(--transition-fast);
    position: relative;
    line-height: 1.35;
}

.nav-link span:first-child {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    box-shadow: none;
    filter: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    transition: transform 0.18s ease, color 0.18s ease;
}

.nav-link span:first-child i {
    filter: none !important;
    text-shadow: none !important;
    -webkit-font-smoothing: antialiased;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(2px);
}

.nav-link:hover span:first-child,
.nav-link.active span:first-child {
    transform: scale(1.08);
    filter: none !important;
    box-shadow: none !important;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(2, 132, 199, 0.28) 0%, rgba(2, 132, 199, 0.08) 100%);
    color: #ffffff;
    font-weight: 700;
    border-left: 3.5px solid #00d2ff;
}

/* Clean, Sharp, Professional Colored Sidebar Icons (No Blur / No Smoke) */
.nav-icon-cyan, .nav-icon-cyan i { color: #00d2ff !important; }
.nav-icon-purple, .nav-icon-purple i { color: #a855f7 !important; }
.nav-icon-emerald, .nav-icon-emerald i { color: #10b981 !important; }
.nav-icon-teal, .nav-icon-teal i { color: #14b8a6 !important; }
.nav-icon-lock, .nav-icon-lock i { color: #f59e0b !important; }
.nav-icon-rose, .nav-icon-rose i { color: #f43f5e !important; }
.nav-icon-pink, .nav-icon-pink i { color: #ec4899 !important; }
.nav-icon-orange, .nav-icon-orange i { color: #f97316 !important; }
.nav-icon-green, .nav-icon-green i { color: #22c55e !important; }
.nav-icon-blue, .nav-icon-blue i { color: #3b82f6 !important; }
.nav-icon-indigo, .nav-icon-indigo i { color: #818cf8 !important; }
.nav-icon-gold, .nav-icon-gold i { color: #eab308 !important; }

/* Department Specific Pills */
.dept-pill {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    line-height: 1.2;
}

.dept-reception { background: rgba(2, 132, 199, 0.2); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.dept-clinical { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.4); }
.dept-ipd { background: rgba(99, 102, 241, 0.2); color: #818cf8; border: 1px solid rgba(129, 140, 248, 0.4); }
.dept-lab { background: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(244, 114, 182, 0.4); }
.dept-pharmacy { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); }
.dept-billing { background: rgba(20, 184, 166, 0.2); color: #2dd4bf; border: 1px solid rgba(45, 212, 191, 0.4); }
.dept-admin { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.4); }

html[data-theme="light"] .dept-reception { background: #e0f2fe; color: #0284c7; border: 1px solid #7dd3fc; }
html[data-theme="light"] .dept-clinical { background: #ecfdf5; color: #059669; border: 1px solid #6ee7b7; }
html[data-theme="light"] .dept-ipd { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
html[data-theme="light"] .dept-lab { background: #fdf2f8; color: #be185d; border: 1px solid #fbcfe8; }
html[data-theme="light"] .dept-pharmacy { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
html[data-theme="light"] .dept-billing { background: #f0fdfa; color: #0f766e; border: 1px solid #99f6e4; }
html[data-theme="light"] .dept-admin { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }

/* ABDM Gateway Beacon */
.abdm-gateway-beacon {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--success-light);
    border: 1px solid var(--success-border);
    color: var(--success);
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.12);
}

.pulse-beacon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-ring 1.8s infinite;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(59, 130, 246, 0.16);
    background: rgba(6, 15, 36, 0.6);
}

.system-health-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: #94a3b8;
    font-weight: 600;
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.system-version {
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
    font-weight: 600;
}

/* ==========================================================================
   Main Content Area & Sticky Topbar
   ========================================================================== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: radial-gradient(circle at 15% 10%, rgba(37, 99, 235, 0.12) 0%, transparent 45%),
                radial-gradient(circle at 85% 85%, rgba(0, 210, 255, 0.08) 0%, transparent 45%),
                var(--bg-page);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    transition: background-color 0.25s ease;
}

html[data-theme="light"] .main-wrapper {
    background: var(--bg-page);
}

.topbar {
    background: var(--topbar-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    min-height: 64px;
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
    gap: 12px;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.topbar-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mobile-toggle-btn {
    display: none;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-color-strong);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 38px;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
}

.mobile-toggle-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-cyan);
}

.mobile-toggle-btn .bar {
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
}

.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: var(--transition-fast);
}

.sidebar-close-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 5, 14, 0.75);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.facility-status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--success-light);
    color: var(--success);
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--success-border);
    box-shadow: var(--shadow-xs);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
    flex-shrink: 0;
}

.logout-btn {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--bg-elevated);
    border-color: var(--border-color-strong);
    color: var(--text-body);
    font-weight: 700;
}

.logout-btn:hover {
    background: var(--danger-light);
    border-color: var(--danger-border);
    color: var(--danger);
}

/* Subscription Banners */
.subscription-banner {
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    gap: 14px;
}

.banner-warning {
    background: linear-gradient(90deg, #92400e, #d97706);
    color: white;
    border-bottom: 2px solid #b45309;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.25);
}

.banner-danger {
    background: linear-gradient(90deg, #991b1b, #dc2626);
    color: white;
    border-bottom: 2px solid #7f1d1d;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-container {
    padding: 28px 32px;
    flex: 1;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ==========================================================================
   Cards & Layout Grids
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
    transition: var(--transition-smooth);
}

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

.card-header-clean {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
    margin-bottom: 18px;
}

.card-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.015em;
    flex: 1 1 auto;
    min-width: 200px;
    line-height: 1.35;
}

/* Responsive Fluid CSS Grids */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

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

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

/* ==========================================================================
   Stat Boxes & Metrics Typography
   ========================================================================== */
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

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

.stat-box.highlight {
    border-top: 4px solid var(--accent-cyan);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.6px;
}

.stat-number {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 6px 0;
    letter-spacing: -0.025em;
    font-family: var(--font-sans);
    line-height: 1.2;
}

.stat-sub {
    font-size: 11.5px;
    color: var(--success);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================================================
   Form Controls, Labels & Inputs Typography
   ========================================================================== */
.form-group {
    margin-bottom: 16px;
}

label, .form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-body);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.form-label-muted {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color-strong);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary) !important;
    background: var(--bg-elevated) !important;
    font-family: inherit;
    line-height: 1.4;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-light);
    font-weight: 400;
    opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus) !important;
    outline: none;
    box-shadow: 0 0 0 3.5px var(--primary-glow);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
    background: var(--bg-page) !important;
    color: var(--text-muted) !important;
    border-color: var(--border-color);
}

.helper-text,
.form-help,
.hint-text {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.45;
    margin-top: 5px;
}

.security-note {
    font-size: 12px;
    line-height: 1.45;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-body);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Buttons & Cockpit CTA Typography
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
    box-shadow: var(--shadow-xs);
    letter-spacing: 0.01em;
    line-height: 1.25;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.28);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 5px 14px rgba(2, 132, 199, 0.38);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.28);
}

.btn-success:hover {
    background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
    box-shadow: 0 5px 14px rgba(5, 150, 105, 0.38);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff !important;
    border: 1px solid #991b1b;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.28);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    box-shadow: 0 5px 14px rgba(220, 38, 38, 0.38);
    transform: translateY(-1px);
}

.btn-outline {
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-color-strong);
    color: var(--text-body);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--accent-cyan);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-cockpit,
.btn-verify,
.btn-action {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff !important;
    font-weight: 800;
    font-size: 13.5px;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    box-shadow: 0 3px 12px rgba(2, 132, 199, 0.32);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-cockpit:hover,
.btn-verify:hover,
.btn-action:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.42);
    transform: translateY(-1px);
}

.btn-cockpit-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 3px 12px rgba(5, 150, 105, 0.32);
}

.btn-cockpit-success:hover {
    background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.42);
    transform: translateY(-1px);
}

.btn-emergency-pro {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff !important;
    border: 1px solid #991b1b;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.28);
    transition: var(--transition-fast);
    text-decoration: none;
    line-height: 1.2;
    letter-spacing: 0.2px;
}

.btn-emergency-pro:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    box-shadow: 0 5px 16px rgba(220, 38, 38, 0.4);
    transform: translateY(-1px);
}

.btn-emergency-pro .emergency-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    animation: pulseEmergency 1.8s infinite cubic-bezier(0.45, 0, 0.55, 1);
}

@keyframes pulseEmergency {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.btn-emergency-pro .emergency-tag {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-left: 2px;
}

/* ==========================================================================
   Tables & Data Displays Typography
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

th {
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 750;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

html[data-theme="light"] th {
    background: #f8fafc;
    color: #475569;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
    line-height: 1.45;
}

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

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

td code,
td .cell-mono {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-cyan);
    background: var(--primary-light);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--primary-border);
}

/* ==========================================================================
   Status Pills & Badges
   ========================================================================== */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.status-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.status-pending,
.status-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.status-info {
    background: var(--primary-light);
    color: var(--accent-cyan);
    border: 1px solid var(--primary-border);
}

.status-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.badge-tag {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-m1 { background: rgba(56, 189, 248, 0.2); color: #0284c7; border: 1px solid rgba(56, 189, 248, 0.35); }
.badge-m2 { background: rgba(52, 211, 153, 0.2); color: #059669; border: 1px solid rgba(52, 211, 153, 0.35); }
.badge-m3 { background: rgba(251, 146, 60, 0.2); color: #ea580c; border: 1px solid rgba(251, 146, 60, 0.35); }
.badge-m4 { background: rgba(168, 85, 247, 0.2); color: #7c3aed; border: 1px solid rgba(168, 85, 247, 0.35); }
.badge-m5 { background: rgba(244, 114, 182, 0.2); color: #db2777; border: 1px solid rgba(244, 114, 182, 0.35); }

html.dark .badge-m1, html[data-theme="dark"] .badge-m1 { color: #38bdf8; }
html.dark .badge-m2, html[data-theme="dark"] .badge-m2 { color: #34d399; }
html.dark .badge-m3, html[data-theme="dark"] .badge-m3 { color: #fb923c; }
html.dark .badge-m4, html[data-theme="dark"] .badge-m4 { color: #c084fc; }
html.dark .badge-m5, html[data-theme="dark"] .badge-m5 { color: #f472b6; }

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 22px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    margin-bottom: -2px;
    transition: var(--transition-fast);
    flex-shrink: 0;
    line-height: 1.3;
}

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

.tab-btn.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.22s ease-in-out;
}

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

/* ==========================================================================
   Code / JSON Viewer
   ========================================================================== */
.code-preview {
    background: #060b14;
    color: #38bdf8;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid rgba(59, 130, 246, 0.22);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   Alert Boxes
   ========================================================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-xs);
    line-height: 1.45;
}

.alert-info {
    background: var(--primary-light);
    color: var(--accent-cyan);
    border-left: 4px solid var(--primary);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

/* ==========================================================================
   Modal Dialogs
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 5, 14, 0.78);
    backdrop-filter: blur(6px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 32px 16px;
    z-index: 9999;
    box-sizing: border-box;
}

.modal-overlay.active {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
}

.modal-box {
    background: var(--bg-card);
    width: 640px;
    max-width: 94vw;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    margin: 0 auto;
    border-radius: var(--border-radius);
    padding: 24px 26px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color-strong);
    box-sizing: border-box;
    position: relative;
    color: var(--text-body);
}

/* ==========================================================================
   Responsive Workspace Grids (Panels)
   ========================================================================== */
.doctor-workspace-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 22px;
    align-items: start;
}

.doctor-mobile-switcher {
    display: none;
    gap: 8px;
    margin-bottom: 16px;
    background: var(--bg-elevated);
    padding: 5px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.doc-mobile-tab-btn {
    flex: 1;
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 700;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
}

.doc-mobile-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.doctor-diagnosis-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 10px;
}

.grid-2-mobile-stack,
.grid-modal-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

.ipd-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-chips-container {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--bg-elevated);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.hiu-workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 22px;
    align-items: start;
}

.hiu-workspace-grid > div {
    min-width: 0;
}

.hi-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.hiu-view-switcher {
    display: none;
    gap: 8px;
    margin-bottom: 16px;
    background: var(--bg-elevated);
    padding: 5px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.hiu-tab-btn {
    flex: 1;
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 700;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
}

.hiu-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

/* ==========================================================================
   QUADRABYTECORE DARK THEME HARMONIZATION FOR INLINE TEMPLATE STYLES
   Scoped to html.dark / html[data-theme="dark"] so Light Mode stays crisp white
   and Dark Mode stays QuadraByteCore Dark Navy (#070b16 / #0b1222).
   ========================================================================== */
html.dark [style*="background: #ffffff"],
html.dark [style*="background:#ffffff"],
html.dark [style*="background: #fff;"],
html.dark [style*="background:#fff;"],
html.dark [style*="background: white"],
html.dark [style*="background-color: #ffffff"],
html.dark [style*="background-color: white"] {
    background: #0b1222 !important;
    color: #e2e8f0;
}

html.dark [style*="background: #f8fafc"],
html.dark [style*="background:#f8fafc"],
html.dark [style*="background-color: #f8fafc"],
html.dark [style*="background: #f1f5f9"],
html.dark [style*="background:#f1f5f9"],
html.dark [style*="background-color: #f1f5f9"],
html.dark [style*="background: #e2e8f0"],
html.dark [style*="background:#e2e8f0"] {
    background: #0f172a !important;
    color: #cbd5e1;
}

html.dark [style*="background: #eff6ff"],
html.dark [style*="background:#eff6ff"],
html.dark [style*="background: #f0f9ff"],
html.dark [style*="background:#f0f9ff"],
html.dark [style*="background: #e0f2fe"],
html.dark [style*="background:#e0f2fe"] {
    background: rgba(2, 132, 199, 0.14) !important;
    border-color: rgba(56, 189, 248, 0.32) !important;
}

html.dark [style*="background: #ecfdf5"],
html.dark [style*="background:#ecfdf5"],
html.dark [style*="background: #f0fdf4"],
html.dark [style*="background:#f0fdf4"],
html.dark [style*="background: #dcfce7"],
html.dark [style*="background:#dcfce7"] {
    background: rgba(16, 185, 129, 0.14) !important;
    border-color: rgba(52, 211, 153, 0.32) !important;
}

html.dark [style*="background: #fffbeb"],
html.dark [style*="background:#fffbeb"],
html.dark [style*="background: #fefce8"],
html.dark [style*="background:#fefce8"],
html.dark [style*="background: #fef3c7"],
html.dark [style*="background:#fef3c7"] {
    background: rgba(245, 158, 11, 0.14) !important;
    border-color: rgba(251, 191, 36, 0.32) !important;
}

html.dark [style*="background: #fef2f2"],
html.dark [style*="background:#fef2f2"],
html.dark [style*="background: #fee2e2"],
html.dark [style*="background:#fee2e2"] {
    background: rgba(239, 68, 68, 0.14) !important;
    border-color: rgba(248, 113, 113, 0.32) !important;
}

html.dark [style*="background: #f5f3ff"],
html.dark [style*="background:#f5f3ff"],
html.dark [style*="background: #ede9fe"],
html.dark [style*="background:#ede9fe"],
html.dark [style*="background: #eef2ff"],
html.dark [style*="background:#eef2ff"] {
    background: rgba(139, 92, 246, 0.14) !important;
    border-color: rgba(167, 139, 250, 0.32) !important;
}

html.dark [style*="background: #fdf2f8"],
html.dark [style*="background:#fdf2f8"],
html.dark [style*="background: #fce7f3"],
html.dark [style*="background:#fce7f3"] {
    background: rgba(236, 72, 153, 0.14) !important;
    border-color: rgba(244, 114, 182, 0.32) !important;
}

html.dark [style*="linear-gradient(135deg, #eff6ff"],
html.dark [style*="linear-gradient(135deg, #f0fdf4"],
html.dark [style*="linear-gradient(135deg, #f5f3ff"],
html.dark [style*="linear-gradient(135deg, #f8fafc"],
html.dark [style*="linear-gradient(135deg, #fffbeb"] {
    background: linear-gradient(135deg, #0b1222 0%, #0f172a 100%) !important;
    border-color: rgba(59, 130, 246, 0.28) !important;
}

html.dark [style*="border: 1px solid #e2e8f0"],
html.dark [style*="border:1px solid #e2e8f0"],
html.dark [style*="border: 1.5px solid #e2e8f0"],
html.dark [style*="border: 1px solid #cbd5e1"],
html.dark [style*="border:1px solid #cbd5e1"],
html.dark [style*="border: 1.5px solid #cbd5e1"],
html.dark [style*="border: 1px solid #f1f5f9"] {
    border-color: rgba(59, 130, 246, 0.24) !important;
}

html.dark [style*="border-top: 1px solid #e2e8f0"],
html.dark [style*="border-top: 1px solid #f1f5f9"],
html.dark [style*="border-bottom: 1px solid #e2e8f0"],
html.dark [style*="border-bottom: 1px solid #f1f5f9"] {
    border-color: rgba(59, 130, 246, 0.18) !important;
}

html.dark [style*="color: #0f172a"],
html.dark [style*="color:#0f172a"],
html.dark [style*="color: #0a192f"],
html.dark [style*="color:#0a192f"],
html.dark [style*="color: #1e293b"],
html.dark [style*="color:#1e293b"] {
    color: #f8fafc !important;
}

html.dark [style*="color: #334155"],
html.dark [style*="color:#334155"],
html.dark [style*="color: #475569"],
html.dark [style*="color:#475569"] {
    color: #cbd5e1 !important;
}

html.dark [style*="color: #065f46"],
html.dark [style*="color: #047857"],
html.dark [style*="color: #166534"],
html.dark [style*="color: #15803d"] {
    color: #34d399 !important;
}

html.dark [style*="color: #92400e"],
html.dark [style*="color: #b45309"],
html.dark [style*="color: #854d0e"] {
    color: #fbbf24 !important;
}

html.dark [style*="color: #991b1b"],
html.dark [style*="color: #b91c1c"] {
    color: #f87171 !important;
}

html.dark [style*="color: #1e40af"],
html.dark [style*="color: #1d4ed8"],
html.dark [style*="color: #0369a1"],
html.dark [style*="color: #075985"] {
    color: #38bdf8 !important;
}

html.dark [style*="color: #5b21b6"],
html.dark [style*="color: #6d28d9"],
html.dark [style*="color: #4338ca"] {
    color: #c084fc !important;
}

html.dark [style*="color: #9d174d"],
html.dark [style*="color: #be185d"] {
    color: #f472b6 !important;
}

/* ==========================================================================
   COMPREHENSIVE FULLY RESPONSIVE BREAKPOINTS (ALL DEVICES & PANELS)
   ========================================================================== */

/* 1. Large Laptops & Desktops (> 1180px) */
@media (min-width: 1181px) {
    #hiuConsentCol,
    #hiuClinicalCol {
        display: block !important;
    }
}

/* 2. Laptops & Small Desktops (<= 1180px) */
@media (max-width: 1180px) {
    .hiu-workspace-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .hiu-view-switcher {
        display: flex;
    }

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

/* 3. Desktop Doctor Workspace Reset (> 992px) */
@media (min-width: 993px) {
    #doctorQueueColumn,
    #doctorConsultDesk {
        display: block !important;
    }
    #doctorConsultDesk {
        display: flex !important;
    }
}

/* 4. Tablets & iPad Landscape (<= 992px) */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
        height: 100vh;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-toggle-btn {
        display: inline-flex;
    }

    .sidebar-close-btn {
        display: inline-flex;
    }

    .main-wrapper {
        width: 100%;
        margin-left: 0;
        height: 100vh;
        overflow-y: auto;
    }

    .topbar {
        padding: 0 20px;
    }

    .content-container {
        padding: 22px 20px;
    }

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

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

    .doctor-workspace-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .doctor-mobile-switcher {
        display: flex;
    }
}

/* 5. Mobile Devices & Small Tablets (<= 768px) */
@media (max-width: 768px) {
    .topbar {
        height: auto;
        min-height: 58px;
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .topbar-left {
        gap: 8px;
    }

    .topbar-title {
        font-size: 15px;
        font-weight: 800;
    }

    .facility-status-pill {
        padding: 4px 10px;
        font-size: 11px;
        max-width: 140px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .abdm-gateway-beacon .beacon-label {
        display: none;
    }

    .abdm-gateway-beacon {
        padding: 4px 6px;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .subscription-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 14px;
        gap: 10px;
    }

    .subscription-banner .banner-btn {
        width: 100%;
        text-align: center;
        margin-left: 0 !important;
        padding: 8px 12px;
    }

    .content-container {
        padding: 16px 12px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .grid-2-mobile-stack,
    .grid-modal-fields {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .card {
        padding: 18px 14px;
        border-radius: 10px;
        margin-bottom: 16px;
    }

    .card-header-clean {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding-bottom: 12px;
        margin-bottom: 14px;
    }

    .card-title {
        font-size: 15px;
    }

    .stat-box {
        padding: 16px 16px;
        border-radius: 10px;
    }

    .stat-number {
        font-size: 24px;
        margin: 4px 0;
    }

    .table-responsive {
        border-radius: 8px;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 12px;
        min-width: 520px;
    }

    th, td {
        padding: 10px 12px;
    }

    .btn {
        padding: 9px 16px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 11.5px;
    }

    .modal-box,
    .modal-content,
    [id*="Modal"] > div {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 18px 14px;
        border-radius: 10px;
        max-height: calc(100vh - 40px) !important;
        overflow-y: auto !important;
        margin: 0 auto !important;
        box-sizing: border-box;
    }

    .grid-presets-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .tabs {
        gap: 6px;
        margin-bottom: 16px;
    }

    .tab-btn {
        padding: 9px 12px;
        font-size: 12px;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    select,
    textarea {
        font-size: 14px;
        padding: 10px 12px;
    }
}

/* 6. Medium Mobiles & Phablets (<= 640px) */
@media (max-width: 640px) {
    .hi-types-grid {
        grid-template-columns: 1fr !important;
    }

    .doctor-diagnosis-grid {
        grid-template-columns: 1fr !important;
    }

    [style*="grid-template-columns: 2fr 1fr 1fr"],
    [style*="grid-template-columns: 45% 55%"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .ipd-header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .ipd-header-actions .btn {
        flex: 1 1 calc(50% - 6px);
        min-height: 40px;
        justify-content: center;
        text-align: center;
    }

    .filter-chips-container {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* 7. Small Smartphones (<= 480px) */
@media (max-width: 480px) {
    .grid-presets-4 {
        grid-template-columns: 1fr !important;
    }

    .ipd-header-actions .btn {
        flex: 1 1 100%;
    }

    .content-container {
        padding: 12px 8px;
    }

    .topbar {
        padding: 8px 10px;
    }

    .topbar-title {
        font-size: 14px;
    }

    .facility-status-pill {
        font-size: 10px;
        padding: 3px 8px;
        max-width: 120px;
    }

    .logout-btn .logout-label {
        display: none;
    }

    .logout-btn {
        padding: 6px 8px;
    }

    .card {
        padding: 14px 10px;
        border-radius: 8px;
    }

    .stat-box {
        padding: 12px 10px;
    }

    .stat-number {
        font-size: 22px;
    }

    .stat-label {
        font-size: 10px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* 8. Miniature Screens & Folded Phones (<= 360px) */
@media (max-width: 360px) {
    .facility-status-pill {
        max-width: 95px;
    }

    .topbar {
        padding: 6px 8px;
    }

    .topbar-title {
        font-size: 13px;
    }

    .card-title {
        font-size: 14px;
    }
}

/* Sidebar Locked Department Card */
.sidebar-locked-item {
    box-sizing: border-box;
    width: 100%;
}

.sidebar-locked-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.sidebar-locked-card:hover {
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

@media (max-width: 480px) {
    .sidebar-locked-item {
        margin: 12px 6px 10px 6px !important;
    }

    .sidebar-locked-card {
        padding: 12px 10px !important;
    }

    .sidebar-locked-card .btn {
        min-height: 44px !important;
        font-size: 13px !important;
    }
}
