/* ===== APP STYLES — Login + Dashboards ===== */
/* Complete rewrite — clean, flat, clinical */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}
a { text-decoration: none; color: inherit; }

/* ─── Design Tokens ─── */
:root {
    /* Status colors */
    --color-purple:    #7c3aed;
    --color-green:     #16a34a;
    --color-red:       #dc2626;
    --color-yellow:    #d97706;
    --color-blue:      #2563eb;
    --color-purple-bg: rgba(124,58,237,0.07);
    --color-green-bg:  rgba(22,163,74,0.07);
    --color-red-bg:    rgba(220,38,38,0.07);
    --color-yellow-bg: rgba(217,119,6,0.07);
    --color-blue-bg:   rgba(37,99,235,0.07);

    /* Surfaces */
    --bg-dark:       #f9fafb;
    --bg-card:       #ffffff;
    --bg-card-hover: #f3f4f6;
    --border:        #e5e7eb;
    --text:          #111827;
    --text-muted:    #6b7280;
    --glow:          transparent;

    /* Default accent — blue */
    --accent:        #2563eb;
    --accent-2:      #3b82f6;
    --accent-light:  rgba(37,99,235,0.07);
    --gradient:      #2563eb;
    --primary:       #2563eb;
    --primary-light: #3b82f6;

    /* Shadows */
    --shadow-sm:      0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:      0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg:      0 4px 16px rgba(0,0,0,0.08);
    --shadow-colored: 0 2px 8px rgba(0,0,0,0.10);

    /* Layout */
    --radius:            6px;
    --radius-sm:         4px;
    --sidebar-width:     256px;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Per-Dashboard Accent Tokens ─── */
[data-dashboard="doctor"] {
    --accent:        #1d4ed8;
    --accent-2:      #3b82f6;
    --accent-light:  rgba(29,78,216,0.07);
    --gradient:      #1d4ed8;
    --bg-dark:       #f9fafb;
    --glow:          transparent;
    --primary:       #1d4ed8;
    --primary-light: #3b82f6;
    --shadow-colored: 0 2px 8px rgba(0,0,0,0.08);
}
[data-dashboard="lab"] {
    --accent:        #6d28d9;
    --accent-2:      #7c3aed;
    --accent-light:  rgba(109,40,217,0.07);
    --gradient:      #6d28d9;
    --bg-dark:       #f9fafb;
    --glow:          transparent;
    --primary:       #6d28d9;
    --primary-light: #7c3aed;
    --shadow-colored: 0 2px 8px rgba(0,0,0,0.08);
}
[data-dashboard="patient"] {
    --accent:        #15803d;
    --accent-2:      #16a34a;
    --accent-light:  rgba(21,128,61,0.07);
    --gradient:      #15803d;
    --bg-dark:       #f9fafb;
    --glow:          transparent;
    --primary:       #15803d;
    --primary-light: #16a34a;
    --shadow-colored: 0 2px 8px rgba(0,0,0,0.08);
}
[data-dashboard="super-admin"] {
    --accent:        #334155;
    --accent-2:      #475569;
    --accent-light:  rgba(51,65,85,0.07);
    --gradient:      #334155;
    --bg-dark:       #f9fafb;
    --glow:          transparent;
    --primary:       #334155;
    --primary-light: #475569;
    --shadow-colored: 0 2px 8px rgba(0,0,0,0.08);
}
[data-dashboard="hospital-admin"] {
    --accent:        #0f766e;
    --accent-2:      #0d9488;
    --accent-light:  rgba(15,118,110,0.07);
    --gradient:      #0f766e;
    --bg-dark:       #f9fafb;
    --glow:          transparent;
    --primary:       #0f766e;
    --primary-light: #0d9488;
    --shadow-colored: 0 2px 8px rgba(0,0,0,0.08);
}
[data-dashboard="nurse"] {
    --accent:        #be123c;
    --accent-2:      #e11d48;
    --accent-light:  rgba(190,18,60,0.07);
    --gradient:      #be123c;
    --bg-dark:       #f9fafb;
    --glow:          transparent;
    --primary:       #be123c;
    --primary-light: #e11d48;
    --shadow-colored: 0 2px 8px rgba(0,0,0,0.08);
}

/* ─── Dark Theme ─── */
[data-theme="dark"] {
    --bg-dark:        #0a0a0a;
    --bg-card:        #111111;
    --bg-card-hover:  #1c1c1c;
    --border:         #262626;
    --text:           #f5f5f5;
    --text-muted:     #737373;
    --glow:           var(--bg-card-hover);
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:      0 12px 40px rgba(0,0,0,0.5);
    --color-purple:   #a78bfa;
    --color-green:    #34d399;
    --color-red:      #f87171;
    --color-yellow:   #fbbf24;
    --color-blue:     #60a5fa;
    --color-purple-bg: rgba(167,139,250,0.12);
    --color-green-bg:  rgba(52,211,153,0.12);
    --color-red-bg:    rgba(248,113,113,0.12);
    --color-yellow-bg: rgba(251,191,36,0.12);
    --color-blue-bg:   rgba(96,165,250,0.12);
}
[data-theme="dark"][data-dashboard="doctor"]        { --accent:#3b82f6; --accent-light:rgba(59,130,246,0.13); --bg-dark:#030f1e; --gradient:#1d4ed8; }
[data-theme="dark"][data-dashboard="lab"]           { --accent:#a78bfa; --accent-light:rgba(167,139,250,0.13); --bg-dark:#0d0714; --gradient:#5b21b6; }
[data-theme="dark"][data-dashboard="patient"]       { --accent:#34d399; --accent-light:rgba(52,211,153,0.13); --bg-dark:#021a0f; --gradient:#065f46; }
[data-theme="dark"][data-dashboard="super-admin"]   { --accent:#818cf8; --accent-light:rgba(129,140,248,0.13); --bg-dark:#060612; --gradient:#3730a3; }
[data-theme="dark"][data-dashboard="hospital-admin"]{ --accent:#2dd4bf; --accent-light:rgba(45,212,191,0.13); --bg-dark:#021713; --gradient:#0f766e; }
[data-theme="dark"][data-dashboard="nurse"]         { --accent:#fb7185; --accent-light:rgba(251,113,133,0.13); --bg-dark:#1a020a; --gradient:#9f1239; }

/* Dark overrides */
[data-theme="dark"] .auth-form-panel { background: #ffffff !important; color: #0f172a !important; }
[data-theme="dark"] .auth-page { background: #ffffff; }
[data-theme="dark"] .login-bg { background: var(--bg-dark); }
[data-theme="dark"] .form-group input { background: var(--bg-card-hover); }
[data-theme="dark"] .form-group input:focus { border-color: var(--border); background: var(--bg-card-hover); }
[data-theme="dark"] .role-btn { background: var(--bg-card-hover); border-color: var(--border); }
[data-theme="dark"] .role-btn:hover { border-color: var(--accent-light); }
[data-theme="dark"] .role-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
[data-theme="dark"] .nav-item:hover { background: var(--bg-card-hover); }
[data-theme="dark"] .data-table th { background: var(--bg-card); }
[data-theme="dark"] .data-table tr:hover { background: var(--bg-card-hover); }
[data-theme="dark"] .sidebar { background: #0d0d0d; border-right-color: #1a1a1a; }
[data-theme="dark"] .user-info:hover { background: var(--bg-card-hover); }
[data-theme="dark"] .dash-card:hover { border-color: var(--accent-light); }
[data-theme="dark"] .chart-bar { background: var(--accent); }

/* Gradient text utility */
.gradient-text { color: var(--accent); }


/* ─── Accessibility ─── */
.skip-link {
    position: absolute; top: -100%; left: 16px;
    padding: 10px 20px; background: var(--accent); color: #fff;
    font-size: 0.875rem; font-weight: 600; border-radius: 0 0 6px 6px;
    z-index: 99999; text-decoration: none; transition: top 0.2s;
}
.skip-link:focus { top: 0; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
*:focus:not(:focus-visible) { outline: none; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
@media (prefers-contrast: high) {
    :root { --border: #555; }
    .dash-card, .data-table-container, .chart-container { border-width: 2px; }
}


/* ─── Legacy Login (fallback) ─── */
.login-page {
    min-height: 100vh; display: flex; align-items: center;
    justify-content: center; padding: 24px; position: relative;
}
.login-bg { position: absolute; inset: 0; background: var(--bg-dark); }
.login-container { position: relative; width: 100%; max-width: 440px; }
.login-logo {
    display: flex; align-items: center; gap: 10px; justify-content: center;
    margin-bottom: 32px; font-family: 'Space Grotesk', sans-serif;
    font-weight: 700; font-size: 1.3rem;
}
.login-logo .logo-icon {
    width: 36px; height: 36px; background: var(--accent);
    border-radius: 6px; display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 800; color: #fff;
}
.login-logo .logo-accent { color: var(--accent); }
.login-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow-sm);
}
.login-card h2 { font-family: 'Space Grotesk', sans-serif; font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.login-card .subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 28px; }

.role-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 24px; }
.role-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 14px 6px; border-radius: var(--radius);
    background: var(--bg-card-hover); border: 1px solid var(--border);
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
    color: var(--text-muted); font-size: 0.75rem; font-weight: 600; text-align: center;
}
.role-btn:hover { border-color: var(--accent); color: var(--text); }
.role-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.role-btn svg { width: 26px; height: 26px; }
.role-btn input { display: none; }

.form-group { margin-bottom: 18px; position: relative; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 7px; }
.form-group input {
    width: 100%; padding: 11px 14px; border-radius: var(--radius);
    background: var(--bg-card-hover); border: 1.5px solid var(--border);
    color: var(--text); font-size: 0.9rem; font-family: inherit;
    transition: border-color 0.15s; outline: none;
}
.form-group input:focus { border-color: var(--accent); background: var(--bg-card); box-shadow: 0 0 0 3px var(--accent-light); }
.form-group input::placeholder { color: var(--text-muted); }
.form-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.form-row label { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--text-muted); cursor: pointer; }
.form-row label input[type="checkbox"] { accent-color: var(--accent); }
.form-row a { font-size: 0.82rem; color: var(--accent); }

.btn-login {
    width: 100%; padding: 12px; border: none; border-radius: var(--radius);
    background: var(--accent); color: #fff; font-size: 0.9rem; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: opacity 0.15s;
}
.btn-login:hover { opacity: 0.85; }
.btn-login:active { opacity: 1; }
.login-footer { text-align: center; margin-top: 20px; font-size: 0.875rem; color: var(--text-muted); }
.login-footer a { color: var(--text); font-weight: 600; }
.back-link { display: block; text-align: center; margin-top: 20px; font-size: 0.82rem; color: var(--text-muted); }
.back-link:hover { color: var(--text); }

.form-error {
    color: var(--color-red); font-size: 0.78rem; margin-top: 5px;
    animation: form-error-slide 0.2s ease forwards;
}
@keyframes form-error-slide {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.form-group input.invalid { border-color: var(--color-red) !important; background: var(--color-red-bg); }
.form-group input.invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.10); }
.form-group input.valid { border-color: var(--accent) !important; }
.form-group input.valid:focus { box-shadow: 0 0 0 3px var(--accent-light); }

.password-strength { margin-top: 7px; height: 3px; background: var(--border); border-radius: 3px; overflow: hidden; }
.password-strength .bar { height: 100%; border-radius: 3px; width: 0; transition: width 0.3s ease, background 0.3s ease; }
.password-strength .bar.weak   { width: 25%; background: var(--color-red); }
.password-strength .bar.fair   { width: 50%; background: var(--color-yellow); }
.password-strength .bar.good   { width: 75%; background: var(--color-blue); }
.password-strength .bar.strong { width: 100%; background: var(--accent); }
.password-strength-label { font-size: 0.72rem; margin-top: 4px; color: var(--text-muted); }


/* ─── Dashboard Layout ─── */
.dashboard { display: flex; min-height: 100vh; }

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width); background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 0; display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transition: transform 0.3s var(--transition-smooth);
}
.sidebar-logo {
    display: flex; align-items: center; gap: 11px; padding: 22px 18px 18px;
    border-bottom: 1px solid var(--border);
    font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.1rem;
    flex-shrink: 0;
}
.sidebar-logo .logo-icon {
    width: 32px; height: 32px; background: var(--accent);
    border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; font-weight: 800; color: #fff; flex-shrink: 0;
}
.sidebar-logo:hover .logo-icon { opacity: 0.85; }
.sidebar-logo .logo-accent { color: var(--color-green); }

.sidebar-nav {
    flex: 1; padding: 14px 10px; overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.nav-section { margin-bottom: 18px; }
.nav-section-title {
    font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--text-muted); padding: 0 10px 5px;
    margin-bottom: 3px; opacity: 0.6;
}
.nav-section:hover .nav-section-title { opacity: 1; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius); font-size: 0.84rem; font-weight: 500;
    color: var(--text-muted); cursor: pointer;
    margin-bottom: 1px; border: none; background: none; width: 100%;
    text-align: left; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text); }
.nav-item.active {
    background: var(--accent-light); color: var(--accent); font-weight: 600;
    border-left: 3px solid var(--accent); padding-left: 7px;
}
.nav-item.active svg { color: var(--accent); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-footer {
    padding: 14px 10px 18px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.user-info {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius);
    transition: background 0.15s;
}
.user-info:hover { background: var(--bg-card-hover); }
.user-avatar {
    width: 34px; height: 34px; border-radius: var(--radius); background: var(--accent-light);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.78rem; color: var(--accent); flex-shrink: 0;
}
.user-name { font-size: 0.82rem; font-weight: 600; }
.user-role { font-size: 0.7rem; color: var(--text-muted); }


/* ─── Main Content ─── */
.main-content {
    flex: 1; margin-left: var(--sidebar-width); padding: 28px;
}
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 28px; flex-wrap: wrap; gap: 14px;
    padding: 20px 24px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); border-left: 3px solid var(--accent);
    box-shadow: var(--shadow-sm);
    position: relative;
}
.page-header h1 {
    font-family: 'Space Grotesk', sans-serif; font-size: 1.6rem; font-weight: 700;
    letter-spacing: -0.02em;
}
.page-header p { color: var(--text-muted); font-size: 0.875rem; margin-top: 3px; }
.header-actions { display: flex; gap: 10px; align-items: center; }


/* ─── Dashboard Cards ─── */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }
.dash-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    transition: border-color 0.15s, box-shadow 0.15s;
    animation: fadeSlideUp 0.4s ease both;
}
.dash-card:nth-child(1) { animation-delay: 0s; }
.dash-card:nth-child(2) { animation-delay: 0.05s; }
.dash-card:nth-child(3) { animation-delay: 0.10s; }
.dash-card:nth-child(4) { animation-delay: 0.15s; }
.dash-card:hover { border-color: var(--accent-light); box-shadow: var(--shadow-sm); }
.dash-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.dash-card-icon {
    width: 40px; height: 40px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
}
.dash-card-icon.purple { background: var(--color-purple-bg); color: var(--color-purple); }
.dash-card-icon.blue   { background: var(--color-blue-bg);   color: var(--color-blue); }
.dash-card-icon.green  { background: var(--color-green-bg);  color: var(--color-green); }
.dash-card-icon.red    { background: var(--color-red-bg);    color: var(--color-red); }
.dash-card-icon.yellow { background: var(--color-yellow-bg); color: var(--color-yellow); }
.dash-card-icon.accent { background: var(--accent-light);    color: var(--accent); }
.dash-card-icon svg { width: 20px; height: 20px; }
.dash-card-trend { font-size: 0.75rem; font-weight: 600; padding: 3px 7px; border-radius: 5px; }
.dash-card-trend.up   { color: var(--color-green); background: var(--color-green-bg); }
.dash-card-trend.down { color: var(--color-red);   background: var(--color-red-bg); }
.dash-card .value {
    font-family: 'Space Grotesk', sans-serif; font-size: 1.85rem; font-weight: 700;
    margin-bottom: 3px; letter-spacing: -0.03em;
}
.dash-card .label { font-size: 0.82rem; color: var(--text-muted); }
.dash-card-footer { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }
.dash-card-action { font-size: 0.76rem; font-weight: 600; color: var(--accent); cursor: pointer; }
.dash-card.critical { border-left: 3px solid var(--color-red); }

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


/* ─── Quick Actions ─── */
.quick-actions-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.quick-action-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 14px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text); font-size: 0.82rem; font-weight: 600;
    cursor: pointer; transition: border-color 0.15s, color 0.15s;
    position: relative;
}
.quick-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.quick-action-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.quick-action-btn.primary:hover { opacity: 0.88; }
.quick-action-btn svg { width: 17px; height: 17px; }
.quick-action-badge {
    position: absolute; top: -6px; right: -6px;
    background: var(--color-red); color: #fff;
    font-size: 0.65rem; font-weight: 700; padding: 2px 5px;
    border-radius: 9px; min-width: 17px; text-align: center;
}


/* ─── Dashboard Split Grid ─── */
.dashboard-split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
@media (max-width: 960px) { .dashboard-split-grid { grid-template-columns: 1fr; } }

/* ─── Dashboard Widget ─── */
.dashboard-widget {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
    transition: border-color 0.15s;
    animation: fadeSlideUp 0.4s ease both;
}
.dashboard-widget:hover { border-color: var(--accent-light); }
.widget-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--border);
}
.widget-header h3 { font-size: 0.9rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.widget-count {
    font-size: 0.72rem; font-weight: 700; padding: 3px 9px;
    border-radius: 20px; background: var(--bg-card-hover); color: var(--text-muted);
}
.widget-count.critical { background: var(--color-red-bg); color: var(--color-red); }
.widget-footer { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }
.full-width { width: 100%; }


/* ─── List Components ─── */
/* Patient queue */
.patient-queue-list { display: flex; flex-direction: column; }
.patient-queue-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 12px; border-radius: var(--radius);
    margin-bottom: 7px; background: var(--bg-card-hover);
    border: 1px solid transparent; transition: border-color 0.15s;
}
.patient-queue-item:hover { border-color: var(--accent-light); background: var(--bg-card); }
.patient-queue-item.priority-high   { border-left: 3px solid var(--color-red); }
.patient-queue-item.priority-medium { border-left: 3px solid var(--color-yellow); }
.patient-queue-item.priority-low    { border-left: 3px solid var(--color-green); }
.patient-queue-info { display: flex; flex-direction: column; gap: 1px; }
.patient-queue-name { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.patient-queue-reason { font-size: 0.74rem; color: var(--text-muted); }
.patient-queue-item.priority-high .patient-queue-reason { color: var(--color-red); }
.patient-queue-item.priority-medium .patient-queue-reason { color: var(--color-yellow); }
.patient-queue-actions { display: flex; gap: 5px; }

/* Icon buttons */
.btn-icon {
    width: 30px; height: 30px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon.btn-call:hover { border-color: var(--color-green); color: var(--color-green); }

/* Critical results */
.critical-results-list { display: flex; flex-direction: column; }
.critical-result-item {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 0; border-bottom: 1px solid var(--border);
}
.critical-result-item:last-child { border-bottom: none; }
.critical-result-icon {
    width: 34px; height: 34px; border-radius: var(--radius);
    background: var(--color-red-bg); color: var(--color-red);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.critical-result-icon svg { width: 17px; height: 17px; }
.critical-result-info { flex: 1; }
.critical-result-name { font-size: 0.84rem; font-weight: 600; color: var(--text); display: block; }
.critical-result-test { font-size: 0.74rem; color: var(--text-muted); display: block; margin-top: 1px; }
.critical-result-time { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }

/* Equipment alerts */
.equipment-alert-list { display: flex; flex-direction: column; }
.equipment-alert-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: var(--radius);
    margin-bottom: 7px; background: var(--bg-card-hover);
    border: 1px solid transparent; transition: border-color 0.15s;
}
.equipment-alert-item:hover { border-color: var(--accent-light); }
.equipment-alert-item.critical { border-left: 3px solid var(--color-red); }
.equipment-alert-item.warning  { border-left: 3px solid var(--color-yellow); }
.equipment-alert-icon {
    width: 38px; height: 38px; border-radius: var(--radius);
    background: var(--bg-card); color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.equipment-alert-item.critical .equipment-alert-icon { background: var(--color-red-bg);    color: var(--color-red); }
.equipment-alert-item.warning  .equipment-alert-icon { background: var(--color-yellow-bg); color: var(--color-yellow); }
.equipment-alert-icon svg { width: 19px; height: 19px; }
.equipment-alert-info { flex: 1; }
.equipment-alert-name  { font-size: 0.86rem; font-weight: 600; color: var(--text); display: block; }
.equipment-alert-issue { font-size: 0.74rem; color: var(--text-muted); display: block; margin-top: 1px; }
.equipment-alert-health { font-size: 0.84rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }

/* Shift notes */
.shift-notes-list { display: flex; flex-direction: column; }
.shift-note-item {
    padding: 13px; border-radius: var(--radius);
    margin-bottom: 9px; background: var(--bg-card-hover);
    border: 1px solid var(--border); transition: border-color 0.15s;
}
.shift-note-item:hover { border-color: var(--accent-light); }
.shift-note-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.shift-note-author { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.shift-note-time   { font-size: 0.7rem; color: var(--text-muted); }
.shift-note-body   { margin-bottom: 9px; }
.shift-note-body p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.55; margin: 0; }
.shift-note-tags   { display: flex; gap: 5px; flex-wrap: wrap; }
.shift-tag {
    font-size: 0.65rem; font-weight: 600; padding: 2px 7px;
    border-radius: 5px; text-transform: uppercase; letter-spacing: 0.03em;
    background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border);
}
.shift-tag.warning { background: var(--color-yellow-bg); color: var(--color-yellow); }
.shift-tag.info    { background: var(--color-blue-bg);   color: var(--color-blue); }
.shift-tag.success { background: var(--color-green-bg);  color: var(--color-green); }

/* Health metrics */
.health-metrics-list { display: flex; flex-direction: column; }
.health-metric-item {
    display: flex; align-items: center; gap: 13px;
    padding: 13px; border-radius: var(--radius);
    margin-bottom: 7px; background: var(--bg-card-hover);
    border: 1px solid var(--border); transition: border-color 0.15s;
}
.health-metric-item:hover { border-color: var(--accent-light); }
.health-metric-icon {
    width: 38px; height: 38px; border-radius: var(--radius);
    background: var(--bg-card); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.health-metric-icon svg { width: 19px; height: 19px; }
.health-metric-info { flex: 1; }
.health-metric-name  { font-size: 0.84rem; font-weight: 600; color: var(--text); display: block; }
.health-metric-value { font-size: 0.88rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; display: block; margin-top: 1px; }
.health-metric-value.critical { color: var(--color-red); }
.health-metric-value.warning  { color: var(--color-yellow); }
.health-metric-value.normal   { color: var(--color-green); }
.health-metric-trend { font-size: 0.7rem; font-weight: 600; padding: 3px 7px; border-radius: 5px; }
.health-metric-trend.down   { background: var(--color-red-bg);    color: var(--color-red); }
.health-metric-trend.stable { background: var(--color-yellow-bg); color: var(--color-yellow); }
.health-metric-trend.up     { background: var(--color-green-bg);  color: var(--color-green); }

/* Appointments */
.appointments-list { display: flex; flex-direction: column; }
.appointment-item {
    display: flex; align-items: center; gap: 13px;
    padding: 13px; border-radius: var(--radius);
    margin-bottom: 7px; background: var(--bg-card-hover);
    border: 1px solid var(--border); transition: border-color 0.15s;
}
.appointment-item:hover { border-color: var(--accent-light); }
.appointment-date-badge {
    width: 48px; height: 48px; border-radius: var(--radius);
    background: var(--accent-light); color: var(--accent);
    display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0;
}
.apt-month { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.apt-day   { font-size: 1.05rem; font-weight: 800; font-family: 'Space Grotesk', sans-serif; }
.appointment-info   { flex: 1; }
.appointment-title  { font-size: 0.86rem; font-weight: 600; color: var(--text); display: block; }
.appointment-doctor { font-size: 0.76rem; color: var(--text-muted); display: block; margin-top: 1px; }
.appointment-time   { font-size: 0.7rem; color: var(--text-muted); display: block; margin-top: 1px; }
.appointment-actions { display: flex; gap: 5px; }

/* Table actions */
.table-actions { display: flex; gap: 5px; }

/* Sample pipeline widget */
.sample-pipeline-widget {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 22px; margin-bottom: 28px;
    transition: border-color 0.15s;
    animation: fadeSlideUp 0.4s ease both;
}
.sample-pipeline-widget:hover { border-color: var(--accent-light); }


/* ─── Data Table ─── */
.data-table-container {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; margin-bottom: 28px;
    animation: fadeSlideUp 0.4s ease both;
}
.table-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.table-header h3 { font-size: 0.95rem; font-weight: 700; }
.table-header .badge { padding: 3px 10px; border-radius: 5px; font-size: 0.72rem; font-weight: 600; background: var(--color-blue-bg); color: var(--color-blue); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 11px 22px; font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
    border-bottom: 1px solid var(--border); background: var(--bg-card-hover);
}
.data-table td { padding: 14px 22px; border-bottom: 1px solid var(--border); font-size: 0.86rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr { transition: background 0.15s; }
.data-table tr:hover { background: var(--bg-card-hover); }
.status-badge { display: inline-block; padding: 3px 9px; border-radius: 5px; font-size: 0.72rem; font-weight: 600; }
.status-badge.normal   { background: var(--color-green-bg);  color: var(--color-green); }
.status-badge.warning  { background: var(--color-yellow-bg); color: var(--color-yellow); }
.status-badge.critical { background: var(--color-red-bg);    color: var(--color-red); }
.status-badge.pending  { background: var(--color-blue-bg);   color: var(--color-blue); }

/* Table toolbar */
.table-toolbar {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.table-search { flex: 1; min-width: 180px; position: relative; }
.table-search input {
    width: 100%; padding: 9px 14px 9px 38px; border-radius: var(--radius);
    background: var(--bg-card-hover); border: 1px solid var(--border);
    color: var(--text); font-size: 0.84rem; font-family: inherit; outline: none;
    transition: border-color 0.15s;
}
.table-search input:focus { border-color: var(--accent); background: var(--bg-card); box-shadow: 0 0 0 3px var(--accent-light); }
.table-search input::placeholder { color: var(--text-muted); }
.table-search .search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 0.875rem; pointer-events: none;
}
.table-filter { position: relative; }
.table-filter select {
    appearance: none; -webkit-appearance: none;
    padding: 9px 34px 9px 12px; border-radius: var(--radius);
    background: var(--bg-card-hover); border: 1px solid var(--border);
    color: var(--text); font-size: 0.84rem; font-family: inherit; cursor: pointer; outline: none;
    transition: border-color 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.table-filter select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.table-filter select option { background: var(--bg-card); color: var(--text); }
.sortable th { cursor: pointer; user-select: none; }
.sortable th:hover { background: var(--bg-card-hover); color: var(--text); }
.sort-icon { display: inline-block; margin-left: 5px; font-size: 0.68rem; color: var(--text-muted); vertical-align: middle; opacity: 0.5; }
.sort-icon.active { opacity: 1; color: var(--accent); }
.sort-icon.asc::after  { content: "\25B2"; }
.sort-icon.desc::after { content: "\25BC"; }
.no-results { text-align: center; padding: 44px 22px; color: var(--text-muted); font-size: 0.9rem; }
.no-results svg { width: 44px; height: 44px; margin-bottom: 10px; opacity: 0.35; }
.no-results p { margin-top: 6px; font-size: 0.82rem; }


/* ─── Charts ─── */
.chart-container {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 28px;
    animation: fadeSlideUp 0.4s ease both;
}
.chart-container h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 16px; }
.chart-placeholder {
    height: 180px; border-radius: var(--radius);
    background: var(--bg-card-hover);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 0.875rem;
    border: 1px dashed var(--border);
}
.chart-bars { display: flex; align-items: flex-end; gap: 7px; height: 140px; padding: 0 16px; }
.chart-bar {
    flex: 1; border-radius: 4px 4px 0 0;
    background: var(--accent); opacity: 0.65; min-width: 18px;
    transition: opacity 0.15s;
}
.chart-bar:hover { opacity: 1; }

/* Compact charts row */
.dashboard-charts-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 20px; }
@media (max-width: 1100px) { .dashboard-charts-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .dashboard-charts-row { grid-template-columns: 1fr; } }
.compact-chart-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px; transition: border-color 0.15s;
}
.compact-chart-card:hover { border-color: var(--accent-light); }
.compact-chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.compact-chart-header h4 { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.compact-chart-value { font-size: 1.05rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.compact-chart-value.down { color: var(--color-red); }
.compact-chart-value.up   { color: var(--color-green); }
.compact-chart { height: 72px; }
.compact-chart canvas { max-height: 72px !important; }


/* ─── Buttons ─── */
.btn-sm {
    padding: 7px 14px; border-radius: var(--radius); font-size: 0.78rem; font-weight: 600;
    border: none; cursor: pointer; font-family: inherit; transition: opacity 0.15s, border-color 0.15s;
    display: inline-flex; align-items: center; gap: 5px;
}
.btn-sm.primary {
    background: var(--accent); color: #fff;
}
.btn-sm.primary:hover { opacity: 0.85; }
.btn-sm.outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-sm.outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


/* ─── Alert Banner ─── */
.alert-banner {
    display: flex; align-items: center; gap: 11px; padding: 14px 18px; border-radius: var(--radius);
    margin-bottom: 20px; font-size: 0.875rem;
    animation: fadeSlideUp 0.35s ease both;
}
.alert-banner.info    { background: var(--color-blue-bg);   border: 1px solid rgba(37,99,235,0.15);    color: var(--color-blue); }
.alert-banner.warning { background: var(--color-yellow-bg); border: 1px solid rgba(217,119,6,0.15);    color: var(--color-yellow); }
.alert-banner.success { background: var(--color-green-bg);  border: 1px solid rgba(22,163,74,0.15);    color: var(--color-green); }


/* ─── Grid Layouts ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }


/* ─── Skeleton Loading ─── */
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton,
.skeleton-text,
.skeleton-card,
.skeleton-row,
.skeleton-avatar {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton      { border-radius: var(--radius-sm); }
.skeleton-text { height: 13px; width: 100%; border-radius: 3px; margin-bottom: 9px; }
.skeleton-text:last-child { width: 60%; }
.skeleton-text.short { width: 40%; }
.skeleton-card { height: 140px; border-radius: var(--radius); border: 1px solid var(--border); }
.skeleton-row  { height: 44px; width: 100%; border-radius: var(--radius-sm); margin-bottom: 7px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--radius); }


/* ─── Theme Toggle ─── */
.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-muted); cursor: pointer; transition: border-color 0.15s, color 0.15s;
    font-size: 1rem;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon-sun  { transition: opacity 0.2s; }
.theme-toggle .icon-moon { transition: opacity 0.2s; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: flex; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }


/* ─── PWA Install Banner ─── */
.pwa-install-banner {
    position: fixed; top: 0; left: 0; right: 0; z-index: 10001;
    display: flex; align-items: center; justify-content: center; gap: 14px;
    padding: 12px 22px; background: var(--accent); color: #fff;
    font-size: 0.875rem; font-weight: 500;
    animation: pwa-banner-slide-down 0.35s ease forwards;
}
.pwa-install-banner.hidden { animation: pwa-banner-slide-up 0.25s ease forwards; pointer-events: none; }
.pwa-install-banner p { flex: 1; text-align: center; }
.pwa-install-btn {
    flex-shrink: 0; padding: 7px 18px; border: none; border-radius: var(--radius);
    background: #fff; color: var(--primary); font-size: 0.82rem; font-weight: 700;
    cursor: pointer; font-family: inherit; transition: opacity 0.15s;
}
.pwa-install-btn:hover { opacity: 0.9; }
.pwa-install-dismiss {
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border: none; border-radius: var(--radius);
    background: rgba(255,255,255,0.15); color: #fff; cursor: pointer; font-size: 1rem;
    transition: background 0.15s;
}
.pwa-install-dismiss:hover { background: rgba(255,255,255,0.25); }
@keyframes pwa-banner-slide-down {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
@keyframes pwa-banner-slide-up {
    from { transform: translateY(0); opacity: 1; }
    to   { transform: translateY(-100%); opacity: 0; }
}


/* ─── Notification Bell ─── */
.notification-bell {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-muted); cursor: pointer; font-size: 1rem;
    transition: border-color 0.15s, color 0.15s;
}
.notification-bell:hover { border-color: var(--accent); color: var(--accent); }
.notification-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: var(--color-red); color: #fff; font-size: 0.62rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-dark);
}
.notification-dropdown {
    position: absolute; top: calc(100% + 7px); right: 0;
    width: 340px; max-height: 380px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    overflow: hidden; display: none; z-index: 500; flex-direction: column;
}
.notification-dropdown.open { display: flex; }
.notification-dropdown-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    font-size: 0.875rem; font-weight: 700;
}
.notification-dropdown-header a { font-size: 0.78rem; font-weight: 600; color: var(--accent); cursor: pointer; }
.notification-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.notification-item {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 18px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.15s;
}
.notification-item:hover { background: var(--bg-card-hover); }
.notification-item:last-child { border-bottom: none; }
.notification-item.unread { background: var(--accent-light); border-left: 3px solid var(--accent); }
.notification-item-icon {
    flex-shrink: 0; width: 34px; height: 34px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; background: var(--accent-light); color: var(--accent);
}
.notification-item-content { flex: 1; min-width: 0; }
.notification-item-content p { font-size: 0.82rem; line-height: 1.4; color: var(--text); margin-bottom: 1px; }
.notification-item-content .time { font-size: 0.72rem; color: var(--text-muted); }
.notification-dropdown-footer { padding: 11px 18px; border-top: 1px solid var(--border); text-align: center; }
.notification-dropdown-footer a { font-size: 0.82rem; font-weight: 600; color: var(--accent); cursor: pointer; }


/* ─── Toast Notifications ─── */
.toast-container {
    position: fixed; bottom: 22px; right: 22px; z-index: 9999;
    display: flex; flex-direction: column; gap: 7px; pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 11px;
    padding: 12px 18px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); min-width: 280px; max-width: 400px;
    font-size: 0.86rem; color: var(--text);
    animation: toast-slide-in 0.3s ease forwards; position: relative; overflow: hidden;
}
.toast.removing { animation: toast-slide-out 0.25s ease forwards; }
.toast-icon { flex-shrink: 0; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.toast-message { flex: 1; font-size: 0.85rem; line-height: 1.4; }
.toast-close {
    flex-shrink: 0; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--text-muted); cursor: pointer;
    border-radius: 4px; font-size: 0.95rem; transition: background 0.15s;
}
.toast-close:hover { background: var(--bg-card-hover); color: var(--text); }
.toast.success { border-left: 3px solid var(--accent); }
.toast.success .toast-icon { color: var(--accent); }
.toast.error   { border-left: 3px solid var(--color-red); }
.toast.error .toast-icon { color: var(--color-red); }
.toast.warning { border-left: 3px solid var(--color-yellow); }
.toast.warning .toast-icon { color: var(--color-yellow); }
.toast.info    { border-left: 3px solid var(--primary-light); }
.toast.info .toast-icon { color: var(--primary-light); }
@keyframes toast-slide-in  { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-slide-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }


/* ─── Language Switcher ─── */
.lang-switcher { position: relative; }
.lang-switcher select {
    appearance: none; -webkit-appearance: none;
    padding: 7px 28px 7px 9px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text); font-size: 0.78rem; font-family: inherit; cursor: pointer; outline: none;
    transition: border-color 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
}
.lang-switcher select:focus { border-color: var(--accent); }
.lang-switcher select option { background: var(--bg-card); color: var(--text); }


/* ─── Chat Widget ─── */
.chat-fab {
    position: fixed; bottom: 22px; right: 22px;
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--accent); color: #fff; border: none; cursor: pointer;
    font-size: 1.3rem; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-colored); z-index: 999;
    transition: opacity 0.15s;
}
.chat-fab:hover { opacity: 0.88; }
.chat-fab .unread-dot {
    position: absolute; top: 2px; right: 2px; width: 11px; height: 11px;
    border-radius: 50%; background: var(--color-red); border: 2px solid var(--bg-dark);
}
.chat-panel {
    position: fixed; bottom: 90px; right: 22px;
    width: 360px; height: 480px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    display: none; flex-direction: column; z-index: 998; overflow: hidden;
    opacity: 0; transform: translateY(12px) scale(0.97);
}
.chat-panel.open {
    display: flex;
    animation: chat-panel-open 0.25s ease forwards;
}
.chat-panel.closing { animation: chat-panel-close 0.2s ease forwards; }
@keyframes chat-panel-open  { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes chat-panel-close { from { opacity: 1; transform: translateY(0) scale(1); }   to { opacity: 0; transform: translateY(12px) scale(0.97); } }

.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; background: var(--accent); color: #fff; flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 9px; }
.chat-header-info .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,0.2); display: flex; align-items: center;
    justify-content: center; font-size: 0.875rem; font-weight: 700;
}
.chat-header-info .name   { font-weight: 600; font-size: 0.9rem; }
.chat-header-info .status { font-size: 0.72rem; opacity: 0.8; }
.chat-close {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border: none; border-radius: var(--radius);
    background: rgba(255,255,255,0.15); color: #fff; cursor: pointer;
    font-size: 0.95rem; transition: background 0.15s;
}
.chat-close:hover { background: rgba(255,255,255,0.25); }
.chat-messages {
    flex: 1; overflow-y: auto; overscroll-behavior: contain;
    padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.chat-bubble {
    max-width: 80%; padding: 9px 12px; border-radius: 10px;
    font-size: 0.86rem; line-height: 1.5; word-wrap: break-word;
}
.chat-bubble.sent {
    align-self: flex-end; background: var(--accent); color: #fff;
    border-bottom-right-radius: 3px;
}
.chat-bubble.received {
    align-self: flex-start; background: var(--bg-card-hover); color: var(--text);
    border: 1px solid var(--border); border-bottom-left-radius: 3px;
}
.chat-bubble .time { display: block; font-size: 0.68rem; margin-top: 3px; opacity: 0.6; }
.chat-typing {
    align-self: flex-start; padding: 9px 14px;
    background: var(--bg-card-hover); border-radius: 10px;
    border: 1px solid var(--border); display: flex; gap: 4px; align-items: center;
}
.chat-typing .dot {
    width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted);
    animation: typing-dot 1.2s ease infinite;
}
.chat-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); } 30% { opacity: 1; transform: scale(1); } }

.chat-input-area {
    display: flex; align-items: center; gap: 7px;
    padding: 11px 14px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input-area input {
    flex: 1; padding: 9px 12px; border-radius: var(--radius);
    background: var(--bg-card-hover); border: 1px solid var(--border);
    color: var(--text); font-size: 0.84rem; font-family: inherit; outline: none;
    transition: border-color 0.15s;
}
.chat-input-area input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.chat-input-area input::placeholder { color: var(--text-muted); }
.chat-send-btn {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius);
    border: none; background: var(--accent); color: #fff; cursor: pointer;
    font-size: 0.95rem; flex-shrink: 0; transition: opacity 0.15s;
}
.chat-send-btn:hover { opacity: 0.85; }
.chat-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }


/* ─── Mobile Sidebar Toggle ─── */
.sidebar-toggle {
    display: none; position: fixed; top: 14px; left: 14px; z-index: 200;
    width: 40px; height: 40px; border-radius: var(--radius);
    background: var(--accent); border: none; color: #fff; cursor: pointer;
    align-items: center; justify-content: center; box-shadow: var(--shadow-md);
    transition: opacity 0.15s;
}
.sidebar-toggle:hover { opacity: 0.88; }
.sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 99;
    background: rgba(0,0,0,0.45); opacity: 0; transition: opacity 0.25s; cursor: pointer;
}
.sidebar-backdrop.visible { display: block; opacity: 1; }


/* ─── Onboarding Tour ─── */
.tour-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 10000; }
.tour-highlight {
    position: absolute; z-index: 10001; border-radius: var(--radius);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5); pointer-events: none;
    transition: all 0.3s ease;
}
.tour-tooltip {
    position: absolute; z-index: 10002; max-width: 300px;
    padding: 20px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    animation: tour-tooltip-pop 0.25s ease forwards;
}
.tour-tooltip::before {
    content: ""; position: absolute; width: 11px; height: 11px;
    background: var(--bg-card); border: 1px solid var(--border); transform: rotate(45deg);
}
.tour-tooltip.arrow-top::before    { top: -6px;    left: 22px; border-right: none; border-bottom: none; }
.tour-tooltip.arrow-bottom::before { bottom: -6px; left: 22px; border-left: none;  border-top: none; }
.tour-tooltip.arrow-left::before   { left: -6px;   top: 22px;  border-top: none;   border-right: none; }
.tour-tooltip.arrow-right::before  { right: -6px;  top: 22px;  border-bottom: none; border-left: none; }
@keyframes tour-tooltip-pop { from { opacity: 0; transform: scale(0.93); } to { opacity: 1; transform: scale(1); } }
.tour-tooltip h4 { font-family: 'Space Grotesk', sans-serif; font-size: 0.95rem; font-weight: 700; margin-bottom: 7px; color: var(--text); }
.tour-tooltip p  { font-size: 0.84rem; line-height: 1.5; color: var(--text-muted); margin-bottom: 18px; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-actions .tour-skip {
    padding: 7px 14px; border-radius: var(--radius); border: none;
    background: transparent; color: var(--text-muted); cursor: pointer;
    font-size: 0.82rem; font-family: inherit; transition: color 0.15s;
}
.tour-actions .tour-skip:hover { color: var(--text); }
.tour-actions .tour-next {
    padding: 7px 18px; border-radius: var(--radius); border: none;
    background: var(--accent); color: #fff; cursor: pointer;
    font-size: 0.82rem; font-weight: 600; font-family: inherit; transition: opacity 0.15s;
}
.tour-actions .tour-next:hover { opacity: 0.85; }
.tour-step-indicator { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 14px; }
.tour-step-indicator .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: all 0.25s; }
.tour-step-indicator .dot.active    { background: var(--accent); width: 18px; border-radius: 4px; }
.tour-step-indicator .dot.completed { background: var(--accent); }


/* ─── Export Menu ─── */
.export-menu {
    position: absolute; top: calc(100% + 4px); right: 0; min-width: 150px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-md); z-index: 200;
    overflow: hidden; display: none;
    animation: export-menu-fade 0.18s ease forwards;
}
.export-menu.open { display: block; }
@keyframes export-menu-fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.export-menu-item {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 10px 14px; border: none; background: transparent;
    color: var(--text); font-size: 0.84rem; font-family: inherit; cursor: pointer;
    transition: background 0.15s;
}
.export-menu-item:hover { background: var(--bg-card-hover); }
.export-menu-item svg { width: 15px; height: 15px; color: var(--text-muted); }
.export-menu-item + .export-menu-item { border-top: 1px solid var(--border); }


/* ─── Print ─── */
@media print {
    body { background: #fff !important; color: #000 !important; font-size: 12pt; }
    .sidebar, .sidebar-toggle, .chat-fab, .chat-panel, .toast-container,
    .notification-bell, .notification-dropdown, .pwa-install-banner,
    .tour-overlay, .tour-highlight, .tour-tooltip, .theme-toggle,
    .lang-switcher, .header-actions .btn-sm, .export-menu { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; width: 100% !important; }
    .dashboard { display: block; }
    .dash-card, .data-table-container, .chart-container {
        break-inside: avoid; border: 1px solid #ccc !important;
        background: #fff !important; box-shadow: none !important;
    }
    .dash-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2    { grid-template-columns: 1fr 1fr; }
    .data-table th, .data-table td { border: 1px solid #ccc !important; color: #000 !important; }
    .status-badge { border: 1px solid currentColor; }
    .page-header h1 { color: #000 !important; }
    .gradient-text { color: #000 !important; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
}


/* ─── Responsive ─── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; width: min(82vw, 300px); }
    .sidebar.open { transform: translateX(0); box-shadow: 16px 0 48px rgba(0,0,0,0.4); }
    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0; padding: 20px 14px; padding-top: 60px; overflow-x: hidden; max-width: 100vw; }
    .dash-grid { grid-template-columns: 1fr; }
    .grid-2    { grid-template-columns: 1fr; }
    .role-selector { grid-template-columns: 1fr; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 10px 12px; }
    .layout-dropdown { display: none !important; }
    .alert-banner { flex-wrap: wrap; gap: 7px; }
    .alert-banner span { word-break: break-word; min-width: 0; flex: 1; }
    .page-header .header-actions > .btn-sm:not(#notification-bell),
    .page-header .header-actions > .btn-primary { display: none; }
    .chat-fab { bottom: 76px; }
    .data-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .chat-panel { width: calc(100vw - 28px); height: calc(100vh - 130px); right: 14px; bottom: 84px; }
    .notification-dropdown {
        position: fixed; top: auto; bottom: 0; left: 0; right: 0;
        width: 100%; max-height: 55vh; border-radius: var(--radius) var(--radius) 0 0;
    }
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .table-search { min-width: 100%; }
    .toast-container { left: 14px; right: 14px; bottom: 14px; }
    .toast { min-width: auto; max-width: 100%; }
    .tour-tooltip { max-width: calc(100vw - 44px); }
    .quick-actions-bar { flex-wrap: wrap; gap: 7px; }
    .quick-action-btn { font-size: 0.78rem; padding: 8px 11px; }
    .dashboard-split-grid { grid-template-columns: 1fr; }
    .section-container { padding: 0; }
    .ph-row { padding: 14px 18px !important; }
}
