/* ═══════════════════════════════════════════════════════════════════════
   CLINICAL SLATE — Master Theme for Guardian Health HMS
   Modern Clinical Slate | Glassmorphic | Thin Typography
   ═══════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ───────────────────────────────────────────── */
:root {
    --slate-bg:            #EDF1F5;
    --sidebar-bg:          #0F172A;
    --sidebar-hover:       #1E293B;
    --sidebar-active:      #0D9488;
    --accent:              #0D9488;
    --accent-light:        #14B8A6;
    --accent-subtle:       rgba(13,148,136,.08);
    --accent-glow:         rgba(13,148,136,.25);
    --text-primary:        #334155;
    --text-secondary:      #64748B;
    --text-muted:          #94A3B8;
    --text-inverse:        #F1F5F9;
    --text-sidebar:        #CBD5E1;
    --text-sidebar-dim:    #64748B;
    --card-bg:             #F7F9FB;
    --card-border:         rgba(0,0,0,.06);
    --glass-bg:            rgba(255,255,255,.72);
    --glass-border:        rgba(255,255,255,.35);
    --glass-shadow:        0 8px 32px rgba(15,23,42,.08);
    --input-border:        #E2E8F0;
    --divider:             #E2E8F0;
    --success:   #10B981;
    --warning:   #F59E0B;
    --danger:    #EF4444;
    --info:      #3B82F6;
    --purple:    #8B5CF6;
    /* ── Legacy aliases (used by some module templates) ─── */
    --guardian-green:   #0D9488;
    --guardian-blue:    #3B82F6;
    --guardian-orange:  #F59E0B;
    --guardian-purple:  #8B5CF6;
    --guardian-red:     #EF4444;
    --guardian-teal:    #14B8A6;
    --border-radius: .75rem;
    --secondary-color: #64748B;
    /* ── Brand Gradient ─── */
    --brand-gradient: linear-gradient(135deg, #065F46, #0D9488, #2563EB);
    --shadow-xs:  0 1px 2px rgba(15,23,42,.04);
    --shadow-sm:  0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --shadow-md:  0 4px 12px rgba(15,23,42,.07);
    --shadow-lg:  0 10px 30px rgba(15,23,42,.10);
    --shadow-xl:  0 20px 50px rgba(15,23,42,.14);
    --sidebar-w:           260px;
    --sidebar-w-collapsed:  64px;
    --header-h:             60px;
    --radius-sm:  .5rem;
    --radius-md:  .75rem;
    --radius-lg:  1rem;
    --radius-xl:  1.25rem;
    --radius-pill: 50rem;
    --ease-out: cubic-bezier(.4,0,.2,1);
    --speed:    .25s;
}

/* ── Reset & Base ────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 300;
    background: var(--slate-bg);
    color: var(--text-primary);
    padding-top: var(--header-h);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    letter-spacing: -.01em;
}

h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6 {
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -.02em;
}
h1,.h1,h2,.h2 { font-weight: 500; }
strong, b, .fw-bold { font-weight: 500; }
.fw-semibold { font-weight: 500; }

a { color: var(--accent); text-decoration: none; transition: color var(--speed) var(--ease-out); }
a:hover { color: var(--accent-light); }
::selection { background: var(--accent-subtle); color: var(--text-primary); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }


/* ═══ GLASSMORPHIC TOP NAVBAR ════════════════════════════════════════ */
.navbar-clinical {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1030;
    height: var(--header-h);
    background: rgba(15,23,42,.84);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-bottom: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 1px 24px rgba(0,0,0,.12);
}

.navbar-clinical .container-fluid {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
}

.clinical-brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    flex-shrink: 0;
}
.clinical-brand:hover { text-decoration: none; }
.clinical-brand-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #3B82F6);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(13,148,136,.35);
}
.clinical-brand-icon i { font-size: 15px; color: #fff; }
.clinical-brand-text {
    font-size: 1rem; font-weight: 600; letter-spacing: -.03em;
    color: #F1F5F9; line-height: 1.2;
}
.clinical-brand-text .brand-accent {
    background: linear-gradient(135deg, #5EEAD4, #38BDF8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; font-weight: 700;
}

/* Search Bar */
.clinical-search {
    flex: 1; max-width: 420px;
    position: relative;
}
.clinical-search input {
    width: 100%;
    height: 38px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: var(--radius-pill);
    padding: 0 1rem 0 2.4rem;
    color: #F1F5F9;
    font-size: .82rem;
    font-weight: 300;
    transition: all var(--speed) var(--ease-out);
    font-family: inherit;
}
.clinical-search input::placeholder { color: #64748B; font-weight: 300; }
.clinical-search input:focus {
    outline: none;
    background: rgba(255,255,255,.12);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13,148,136,.15);
}
.clinical-search .search-icon {
    position: absolute;
    left: .85rem; top: 50%; transform: translateY(-50%);
    color: #64748B; font-size: .8rem; pointer-events: none;
}

/* Navbar Right Actions */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-left: auto;
}

.nav-action-btn {
    width: 38px; height: 38px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: #94A3B8;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all .2s var(--ease-out);
    font-size: .95rem;
}
.nav-action-btn:hover {
    background: rgba(255,255,255,.08);
    color: #F1F5F9;
}

.notif-pulse {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid rgba(15,23,42,.84);
    animation: notifPulse 2s ease-in-out infinite;
}
@keyframes notifPulse {
    0%,100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.6); opacity: .4; }
}
.notif-pulse.hidden { display: none; }

.nav-action-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 16px; height: 16px;
    background: var(--danger);
    border-radius: var(--radius-pill);
    font-size: .6rem;
    font-weight: 600;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid rgba(15,23,42,.84);
    line-height: 1;
}

/* Profile Dropdown */
.nav-profile {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .6rem .35rem .35rem;
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    cursor: pointer;
    text-decoration: none;
    transition: all .2s var(--ease-out);
    color: #CBD5E1;
}
.nav-profile:hover { background: rgba(255,255,255,.10); color: #F1F5F9; }
.nav-profile-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #3B82F6);
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; color: #fff; font-weight: 500;
}
.nav-profile-name { font-size: .78rem; font-weight: 400; color: #E2E8F0; line-height: 1.2; }
.nav-profile-role { font-size: .65rem; color: #64748B; font-weight: 300; }

.mobile-menu-btn {
    display: none;
    width: 38px; height: 38px;
    background: transparent;
    border: none;
    color: #CBD5E1;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center; justify-content: center;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,.08); color: #F1F5F9; }


/* ═══ DEEP MIDNIGHT NAVY SIDEBAR ═════════════════════════════════════ */
.sidebar-clinical {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255,255,255,.04);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width .3s var(--ease-out), transform .3s var(--ease-out);
    z-index: 1020;
    display: flex;
    flex-direction: column;
}
.sidebar-clinical::-webkit-scrollbar { width: 4px; }
.sidebar-clinical::-webkit-scrollbar-track { background: transparent; }
.sidebar-clinical::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-clinical-header {
    display: flex;
    align-items: center;
    padding: 1rem .9rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    min-height: 52px;
    gap: .75rem;
    flex-shrink: 0;
}

.sidebar-collapse-btn {
    width: 32px; height: 32px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--radius-sm);
    color: #94A3B8;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    flex-shrink: 0;
    transition: all .2s var(--ease-out);
}
.sidebar-collapse-btn:hover {
    background: rgba(13,148,136,.15);
    color: var(--accent-light);
    border-color: rgba(13,148,136,.2);
}

.sidebar-title {
    font-size: .78rem;
    font-weight: 500;
    color: #E2E8F0;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity .2s var(--ease-out);
    line-height: 1.3;
}
.sidebar-title-sub { font-size: .65rem; font-weight: 300; color: #64748B; display: block; }

/* Collapsed sidebar */
.sidebar-clinical.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar-clinical.collapsed .sidebar-title,
.sidebar-clinical.collapsed .sidebar-section-label,
.sidebar-clinical.collapsed .sidebar-link-text,
.sidebar-clinical.collapsed .sidebar-link-badge { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }
.sidebar-clinical.collapsed .sidebar-clinical-header { justify-content: center; padding: 1rem 0; }
.sidebar-clinical.collapsed .sidebar-section-label { height: 0; padding: 0; margin: 0; }
.sidebar-clinical.collapsed .sidebar-link { justify-content: center; padding: .65rem 0; gap: 0; }
.sidebar-clinical.collapsed .sidebar-link-icon { font-size: 1rem; }

/* Tooltip on collapsed */
.sidebar-clinical.collapsed .sidebar-link { position: relative; }
.sidebar-clinical.collapsed .sidebar-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%; transform: translateY(-50%);
    background: #1E293B;
    color: #F1F5F9;
    padding: .4rem .75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 9999;
    font-size: .75rem; font-weight: 400;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,.06);
    animation: tipIn .15s ease;
}
@keyframes tipIn {
    from { opacity:0; transform: translateY(-50%) translateX(-4px); }
    to   { opacity:1; transform: translateY(-50%) translateX(0); }
}

/* Navigation List */
.sidebar-nav-list {
    list-style: none;
    padding: .75rem .5rem;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}
.sidebar-clinical.collapsed .sidebar-nav-list { padding: .75rem .25rem; }

.sidebar-section-label {
    padding: .6rem .75rem .35rem;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity .2s var(--ease-out);
}
.sidebar-section-label small {
    font-size: .6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #475569;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: .55rem .75rem;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 300;
    font-size: .82rem;
    gap: .75rem;
    margin: 1px 0;
    transition: all .18s var(--ease-out);
    position: relative;
}
.sidebar-link:hover { background: var(--sidebar-hover); color: #F1F5F9; text-decoration: none; }
.sidebar-link.active {
    background: linear-gradient(135deg, rgba(13,148,136,.2), rgba(13,148,136,.08));
    color: var(--accent-light);
    font-weight: 400;
    border-left: 2px solid var(--accent);
}
.sidebar-link.active .sidebar-link-icon { color: var(--accent-light); }

.sidebar-link.sidebar-danger { color: #F87171; }
.sidebar-link.sidebar-danger:hover { background: rgba(239,68,68,.1); color: #FCA5A5; }
.sidebar-link.sidebar-danger.active {
    background: linear-gradient(135deg, rgba(239,68,68,.2), rgba(239,68,68,.08));
    color: #FCA5A5; border-left-color: var(--danger);
}

.sidebar-link-icon {
    width: 20px; height: 20px;
    font-size: .85rem;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #64748B;
    transition: color .18s var(--ease-out), font-size .2s var(--ease-out);
}
.sidebar-link:hover .sidebar-link-icon { color: #CBD5E1; }

.sidebar-link-text {
    font-weight: 300;
    white-space: nowrap;
    overflow: hidden;
    flex: 1;
    transition: opacity .2s var(--ease-out), width .2s var(--ease-out);
}

.sidebar-link-badge {
    margin-left: auto;
    font-size: .6rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
    transition: opacity .2s, width .2s;
}


/* ═══ MAIN CONTENT ═══════════════════════════════════════════════════ */
.main-clinical {
    margin-left: var(--sidebar-w);
    min-height: calc(100vh - var(--header-h));
    transition: margin-left .3s var(--ease-out);
    padding: 0;
}
.main-clinical.sidebar-collapsed-main { margin-left: var(--sidebar-w-collapsed); }

.content-area {
    padding: 1.5rem;
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
}


/* ═══ GLASSMORPHIC CARDS ═════════════════════════════════════════════ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .3s var(--ease-out), transform .3s var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.card-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    padding: .85rem 1.15rem;
}


/* ═══ BUTTONS ════════════════════════════════════════════════════════ */
.btn {
    font-family: inherit;
    font-weight: 400;
    font-size: .82rem;
    border-radius: var(--radius-lg);
    transition: all .2s var(--ease-out);
    letter-spacing: -.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xs);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #0F766E);
    border: none; color: #fff;
    box-shadow: 0 2px 8px rgba(13,148,136,.3);
}
.btn-accent:hover { background: linear-gradient(135deg, #0F766E, var(--accent)); color: #fff; }

.btn-primary { background: linear-gradient(135deg, #3B82F6, #2563EB); border: none; }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); border: none; }
.btn-warning { background: linear-gradient(135deg, var(--warning), #D97706); border: none; color: #fff; }
.btn-warning:hover { color: #fff; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #DC2626); border: none; }

.btn-outline-primary { border: 1.5px solid #3B82F6; color: #3B82F6; background: transparent; box-shadow: none; }
.btn-outline-primary:hover { background: #3B82F6; color: #fff; }
.btn-outline-success { border: 1.5px solid var(--success); color: var(--success); background: transparent; box-shadow: none; }
.btn-outline-success:hover { background: var(--success); color: #fff; }
.btn-outline-info { border: 1.5px solid var(--info); color: var(--info); background: transparent; box-shadow: none; }
.btn-outline-info:hover { background: var(--info); color: #fff; }
.btn-outline-secondary { border: 1.5px solid #94A3B8; color: #64748B; background: transparent; box-shadow: none; }
.btn-outline-secondary:hover { background: #64748B; color: #fff; }
.btn-outline-warning { border: 1.5px solid var(--warning); color: var(--warning); background: transparent; box-shadow: none; }
.btn-outline-warning:hover { background: var(--warning); color: #fff; }


/* ═══ FORM CONTROLS ══════════════════════════════════════════════════ */
.form-control, .form-select {
    border-radius: var(--radius-pill) !important;
    border: 1.5px solid var(--input-border);
    padding: .55rem 1.15rem;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 300;
    transition: all .2s var(--ease-out);
    background: #fff;
    color: var(--text-primary);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
textarea.form-control { border-radius: var(--radius-xl) !important; }


/* ═══ MODALS ═════════════════════════════════════════════════════════ */
.modal-content {
    border-radius: var(--radius-xl);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.modal-header {
    background: linear-gradient(135deg, var(--sidebar-bg), #1E293B);
    color: #F1F5F9;
    border-bottom: none;
    padding: 1rem 1.5rem;
}
.modal-header .modal-title { font-weight: 500; font-size: .92rem; }
.modal-header .btn-close { filter: brightness(0) invert(1); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer { border-top: 1px solid var(--card-border); padding: .75rem 1.5rem; }


/* ═══ NOTIFICATION PANEL ═════════════════════════════════════════════ */
.notif-item { padding: .6rem .85rem; border-bottom: 1px solid #F1F5F9; cursor: pointer; transition: background .15s; }
.notif-item:hover { background: #F8FAFC; }
.notif-item.unread { background: #F0FDFA; border-left: 3px solid var(--accent); }
.notif-item.unread:hover { background: #CCFBF1; }
.notif-priority-critical { border-left: 3px solid var(--danger) !important; }
.notif-priority-high { border-left: 3px solid var(--warning) !important; }


/* ═══ TOAST NOTIFICATION SYSTEM ══════════════════════════════════════ */
.toast-stack {
    position: fixed;
    top: calc(var(--header-h) + 1rem);
    right: 1.25rem;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    pointer-events: none;
    max-width: 380px;
    width: 100%;
}

.clinical-toast {
    pointer-events: all;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: .85rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    animation: toastSlideIn .35s var(--ease-out);
    transition: all .3s var(--ease-out);
    overflow: hidden;
    position: relative;
}
.clinical-toast.toast-exit { animation: toastSlideOut .3s var(--ease-out) forwards; }

.clinical-toast::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    background: var(--accent);
    animation: toastTimer 5s linear forwards;
}
.clinical-toast.toast-success::before { background: var(--success); }
.clinical-toast.toast-danger::before  { background: var(--danger); }
.clinical-toast.toast-warning::before { background: var(--warning); }
.clinical-toast.toast-info::before    { background: var(--info); }

.toast-icon {
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem;
    flex-shrink: 0;
}
.toast-icon.toast-success { background: rgba(16,185,129,.1); color: var(--success); }
.toast-icon.toast-danger  { background: rgba(239,68,68,.1); color: var(--danger); }
.toast-icon.toast-warning { background: rgba(245,158,11,.1); color: var(--warning); }
.toast-icon.toast-info    { background: rgba(59,130,246,.1); color: var(--info); }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: .8rem; font-weight: 500; color: var(--text-primary); margin-bottom: .15rem; }
.toast-message { font-size: .75rem; font-weight: 300; color: var(--text-secondary); line-height: 1.4; }

.toast-close {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: .8rem; padding: 0; line-height: 1; transition: color .15s;
}
.toast-close:hover { color: var(--text-primary); }

@keyframes toastSlideIn  { from { transform: translateX(110%); opacity:0; } to { transform: translateX(0); opacity:1; } }
@keyframes toastSlideOut { from { transform: translateX(0); opacity:1; } to { transform: translateX(110%); opacity:0; } }
@keyframes toastTimer    { from { width: 100%; } to { width: 0%; } }


/* ═══ SKELETON LOADERS ═══════════════════════════════════════════════ */
.skeleton {
    position: relative;
    overflow: hidden;
    background: #E2E8F0;
    border-radius: var(--radius-sm);
}
.skeleton::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(100%)} }

.skeleton-text  { height: 12px; margin-bottom: 8px; border-radius: 6px; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-25 { width: 25%; }
.skeleton-title { height: 18px; width: 60%; margin-bottom: 12px; border-radius: 6px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-card  { height: 160px; border-radius: var(--radius-lg); }
.skeleton-img   { width: 100%; height: 200px; border-radius: var(--radius-md); }


/* ═══ PACS VIEWPORT CONTAINER ════════════════════════════════════════ */
.pacs-viewport {
    background: #0A0F1A;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,.06);
    overflow: hidden;
    position: relative;
    min-height: 500px;
}
.pacs-viewport-header {
    background: linear-gradient(135deg, #0F172A, #1E293B);
    padding: .6rem 1rem;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.pacs-viewport-header .viewport-label {
    font-size: .72rem; font-weight: 400; color: #64748B;
    letter-spacing: .5px; text-transform: uppercase;
}
.pacs-viewport-header .viewport-tools { display: flex; gap: .3rem; }
.pacs-viewport-header .viewport-tool-btn {
    width: 28px; height: 28px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--radius-sm);
    color: #64748B;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: .7rem;
    transition: all .15s;
}
.pacs-viewport-header .viewport-tool-btn:hover {
    background: rgba(13,148,136,.15);
    color: var(--accent-light);
    border-color: rgba(13,148,136,.2);
}
.pacs-viewport-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 440px;
    color: #475569;
    padding: 1rem;
}

.pacs-skeleton {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 1rem; padding: 2rem;
}
.pacs-skeleton .skeleton-monitor {
    width: 80%; max-width: 360px; height: 240px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--radius-md);
    position: relative; overflow: hidden;
}
.pacs-skeleton .skeleton-monitor::after {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.03), transparent);
    animation: shimmer 2s infinite;
}
.pacs-skeleton .skeleton-label { font-size: .72rem; color: #475569; font-weight: 300; letter-spacing: .3px; }


/* ═══ AI ASSISTANT PANEL ═════════════════════════════════════════════ */
.ai-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    display: flex; flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.ai-panel-header {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--card-border);
    display: flex; align-items: center; justify-content: space-between;
}
.ai-panel-header-title {
    font-size: .82rem; font-weight: 500; color: var(--text-primary);
    display: flex; align-items: center; gap: .4rem;
}
.ai-panel-header-title .ai-dot {
    width: 6px; height: 6px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(16,185,129,.4);
    animation: notifPulse 2.5s ease infinite;
}
.ai-panel-messages {
    flex: 1; overflow-y: auto; padding: .75rem;
    display: flex; flex-direction: column; gap: .5rem;
}
.ai-msg {
    max-width: 85%; padding: .6rem .85rem;
    border-radius: var(--radius-lg);
    font-size: .78rem; font-weight: 300; line-height: 1.55;
}
.ai-msg.ai-msg-bot {
    background: #F0FDFA; color: var(--text-primary);
    border-bottom-left-radius: .25rem; align-self: flex-start;
    border: 1px solid rgba(13,148,136,.08);
}
.ai-msg.ai-msg-user {
    background: var(--sidebar-bg); color: #F1F5F9;
    border-bottom-right-radius: .25rem; align-self: flex-end;
}
.ai-panel-input {
    padding: .6rem .75rem;
    border-top: 1px solid var(--card-border);
    display: flex; gap: .4rem;
}
.ai-panel-input input {
    flex: 1; height: 36px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-pill);
    padding: 0 .9rem;
    font-size: .78rem; font-weight: 300; font-family: inherit;
    background: #fff; color: var(--text-primary); transition: border-color .2s;
}
.ai-panel-input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.ai-panel-input button {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #0F766E);
    border: none; color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: .8rem; transition: transform .15s; flex-shrink: 0;
}
.ai-panel-input button:hover { transform: scale(1.05); }

.ai-skeleton { padding: 1rem; display: flex; flex-direction: column; gap: .8rem; }
.ai-skeleton .skel-bubble { padding: .8rem; border-radius: var(--radius-lg); background: #F1F5F9; }
.ai-skeleton .skel-bubble.right { margin-left: auto; width: 65%; }
.ai-skeleton .skel-bubble.left  { margin-right: auto; width: 75%; }


/* ═══ 3-COLUMN CLINICAL WORKSPACE ════════════════════════════════════ */
.clinical-workspace {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 1rem;
    height: calc(100vh - var(--header-h) - 3rem);
}

.patient-overview { overflow-y: auto; }
.patient-vitals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.vital-chip {
    background: #F8FAFC;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: .5rem .65rem;
    text-align: center;
}
.vital-chip-value { font-size: 1.1rem; font-weight: 500; color: var(--text-primary); line-height: 1; }
.vital-chip-label {
    font-size: .62rem; font-weight: 300; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px; margin-top: .2rem;
}


/* ═══ STAT/METRIC CARDS ══════════════════════════════════════════════ */
.stat-card-clinical {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    transition: all .25s var(--ease-out);
}
.stat-card-clinical:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card-clinical .stat-icon { font-size: 1.5rem; opacity: .4; margin-bottom: .35rem; }
.stat-card-clinical .stat-label { font-size: .72rem; font-weight: 300; color: var(--text-muted); }
.stat-card-clinical .stat-value { font-size: 1.35rem; font-weight: 500; line-height: 1; margin-top: .2rem; }


/* ═══ CONNECTION INDICATORS ══════════════════════════════════════════ */
.connection-indicator {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block; margin-left: 6px; transition: all .3s;
}
.connection-indicator.online  { background: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.3); }
.connection-indicator.offline { background: var(--danger); box-shadow: 0 0 0 2px rgba(239,68,68,.3); }
.connection-indicator.loading { background: var(--warning); box-shadow: 0 0 0 2px rgba(245,158,11,.3); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.sidebar-clinical.collapsed .connection-indicator {
    position: absolute; top: 6px; right: 6px; margin: 0;
}


/* ═══ UTILITY CLASSES ════════════════════════════════════════════════ */
.gradient-bg     { background: linear-gradient(135deg, #065F46, var(--accent), #3B82F6); }
.gradient-accent { background: linear-gradient(135deg, var(--accent), #0F766E); }
.fade-in { animation: fadeIn .45s var(--ease-out); }
@keyframes fadeIn { from{opacity:0; transform:translateY(12px)} to{opacity:1; transform:translateY(0)} }
@keyframes slideInRight { from{transform:translateX(100%); opacity:0} to{transform:translateX(0); opacity:1} }

.loading-spinner {
    display: inline-block; width: 20px; height: 20px;
    border: 2px solid rgba(13,148,136,.2);
    border-radius: 50%; border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.text-accent { color: var(--accent) !important; }
.bg-accent-subtle { background: var(--accent-subtle) !important; }


/* ═══ SIDEBAR OVERLAY (MOBILE) ═══════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(4px);
    z-index: 1019;
    opacity: 0;
    transition: opacity .3s var(--ease-out);
}
.sidebar-overlay.active { display: block; opacity: 1; }


/* ═══ FOOTER ═════════════════════════════════════════════════════════ */
.footer-clinical {
    margin-left: var(--sidebar-w);
    transition: margin-left .3s var(--ease-out);
    background: #fff;
    border-top: 1px solid var(--card-border);
    padding: .6rem 0;
}
.main-clinical.sidebar-collapsed-main ~ .footer-clinical { margin-left: var(--sidebar-w-collapsed); }


/* ═══ PRINT ══════════════════════════════════════════════════════════ */
@media print {
    .navbar-clinical,.sidebar-clinical,.footer-clinical,.sidebar-overlay,.toast-stack { display: none !important; }
    .main-clinical { margin-left: 0 !important; }
    .content-area { padding: 0 !important; height: auto !important; }
}


/* ═══ RESPONSIVE: TABLET (≤992px) ════════════════════════════════════ */
@media (max-width: 992px) {
    .clinical-workspace { grid-template-columns: 1fr 1fr; }
    .clinical-workspace .ai-panel-col { grid-column: 1 / -1; }
}


/* ═══ RESPONSIVE: MOBILE (≤768px) ════════════════════════════════════ */
@media (max-width: 768px) {
    :root { --header-h: 56px; }

    .sidebar-clinical {
        transform: translateX(-100%);
        width: var(--sidebar-w);
        box-shadow: none;
        top: 0;
        height: 100vh;
        z-index: 1040;
    }
    .sidebar-clinical.mobile-open {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(0,0,0,.3);
    }

    .main-clinical, .main-clinical.sidebar-collapsed-main { margin-left: 0; }
    .mobile-menu-btn { display: flex; }
    .clinical-search { display: none; }
    .clinical-brand-text { font-size: .9rem; }
    .nav-profile-info { display: none; }

    .clinical-workspace { grid-template-columns: 1fr; height: auto; }
    .clinical-workspace > * { min-height: 300px; }

    .toast-stack { left: .75rem; right: .75rem; max-width: none; }
    .footer-clinical { margin-left: 0; }
    .content-area { padding: 1rem; }

    /* Notification panel — full-width on mobile */
    #notifPanel { right: -10px !important; width: calc(100vw - 1.5rem) !important; max-width: 360px; }

    /* Dropdown menu mobile fix */
    .dropdown-menu { border-radius: var(--radius-md); box-shadow: var(--shadow-lg); border: 1px solid var(--card-border); }

    /* Navbar container tighter */
    .navbar-clinical .container-fluid { padding: 0 .5rem; gap: .5rem; }
}


/* ═══ RESPONSIVE: SMALL MOBILE (≤480px) ══════════════════════════════ */
@media (max-width: 480px) {
    .navbar-actions { gap: 0; }
    .nav-action-btn { width: 34px; height: 34px; }
    .clinical-brand-icon { width: 30px; height: 30px; }
    .clinical-brand-icon i { font-size: 13px; }
    .nav-profile { padding: .25rem .35rem; }
    .nav-profile-avatar { width: 26px; height: 26px; }
}


/* ═══════════════════════════════════════════════════════════════════════
   COMPREHENSIVE ADDITIONS — Shared component styles for all pages
   ═══════════════════════════════════════════════════════════════════════ */

/* ═══ PAGE HEADER / HERO ═════════════════════════════════════════════ */
.page-hero {
    background: var(--brand-gradient);
    border-radius: var(--radius-xl);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.page-hero::before {
    content: '';
    position: absolute; top: -50%; right: -20%;
    width: 420px; height: 420px;
    background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.page-hero h2, .page-hero h3, .page-hero h4 {
    color: #fff; font-weight: 500; margin-bottom: .35rem;
}
.page-hero p, .page-hero .lead { color: rgba(255,255,255,.8); font-weight: 300; font-size: .88rem; }
.page-hero .badge { background: rgba(255,255,255,.15); backdrop-filter: blur(6px); font-weight: 400; }


/* ═══ STAT / METRIC CARDS (universal) ════════════════════════════════ */
.stat-card, .stats-card, .metric-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    text-align: center;
    transition: all .25s var(--ease-out);
    position: relative;
    overflow: hidden;
}
.stat-card:hover, .stats-card:hover, .metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.stat-card .stat-icon, .stats-card .stat-icon, .metric-card .stat-icon {
    font-size: 1.4rem;
    margin-bottom: .35rem;
    opacity: .5;
}
.stat-card .stat-label, .stats-card .stat-label, .metric-card .stat-label {
    font-size: .72rem;
    font-weight: 300;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .3px;
}
.stat-card .stat-value, .stats-card .stat-value, .metric-card .stat-value {
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1;
    margin-top: .2rem;
}


/* ═══ TABLES ═════════════════════════════════════════════════════════ */
.table {
    font-size: .82rem;
    font-weight: 300;
    color: var(--text-primary);
}
.table thead th {
    background: #F8FAFC;
    border-bottom: 2px solid var(--divider);
    font-weight: 500;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    padding: .65rem .85rem;
    white-space: nowrap;
}
.table tbody td {
    padding: .6rem .85rem;
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--accent-subtle); }
.table tbody tr:last-child td { border-bottom: none; }
.table-sm th, .table-sm td { padding: .4rem .65rem; }

/* Card-wrapped table */
.table-card { border-radius: var(--radius-lg); overflow: hidden; }
.table-card .table { margin-bottom: 0; }


/* ═══ BADGES (themed) ════════════════════════════════════════════════ */
.badge {
    font-weight: 400;
    font-size: .68rem;
    letter-spacing: .2px;
    padding: .3em .65em;
    border-radius: var(--radius-pill);
}
.badge-success, .badge.bg-success { background: rgba(16,185,129,.12) !important; color: #065F46 !important; }
.badge-warning, .badge.bg-warning { background: rgba(245,158,11,.12) !important; color: #92400E !important; }
.badge-danger, .badge.bg-danger   { background: rgba(239,68,68,.12) !important; color: #991B1B !important; }
.badge-info, .badge.bg-info       { background: rgba(59,130,246,.12) !important; color: #1E40AF !important; }
.badge-primary, .badge.bg-primary { background: rgba(59,130,246,.12) !important; color: #1E40AF !important; }
.badge-secondary, .badge.bg-secondary { background: rgba(100,116,139,.1) !important; color: #475569 !important; }
.badge-purple, .badge.bg-purple   { background: rgba(139,92,246,.12) !important; color: #5B21B6 !important; }
.badge-accent, .badge.bg-accent   { background: var(--accent-subtle) !important; color: #065F46 !important; }


/* ═══ STATUS DOTS & INDICATORS ═══════════════════════════════════════ */
.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: .35rem;
    flex-shrink: 0;
}
.status-dot.online, .status-dot.active, .status-dot.success { background: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.status-dot.offline, .status-dot.error, .status-dot.danger  { background: var(--danger); box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.status-dot.warning, .status-dot.pending { background: var(--warning); box-shadow: 0 0 0 2px rgba(245,158,11,.2); }
.status-dot.info { background: var(--info); box-shadow: 0 0 0 2px rgba(59,130,246,.2); }


/* ═══ TABS (themed override) ═════════════════════════════════════════ */
.nav-tabs {
    border-bottom: 2px solid var(--divider);
    gap: .25rem;
}
.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: .82rem;
    padding: .55rem 1rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all .2s var(--ease-out);
}
.nav-tabs .nav-link:hover {
    color: var(--accent);
    border-bottom-color: var(--accent-subtle);
    background: var(--accent-subtle);
}
.nav-tabs .nav-link.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 500;
    background: transparent;
}

.nav-pills .nav-link {
    border-radius: var(--radius-pill);
    font-weight: 400;
    font-size: .82rem;
    padding: .45rem 1rem;
    color: var(--text-secondary);
    transition: all .2s var(--ease-out);
}
.nav-pills .nav-link.active {
    background: linear-gradient(135deg, var(--accent), #0F766E);
    color: #fff;
}


/* ═══ LIST GROUPS (themed) ═══════════════════════════════════════════ */
.list-group-item {
    border-color: var(--card-border);
    color: var(--text-primary);
    font-size: .82rem;
    font-weight: 300;
    padding: .65rem 1rem;
    transition: background .15s var(--ease-out);
}
.list-group-item:hover { background: var(--accent-subtle); }
.list-group-item.active {
    background: linear-gradient(135deg, var(--accent), #0F766E);
    border-color: var(--accent);
    color: #fff;
}


/* ═══ PROGRESS BARS ══════════════════════════════════════════════════ */
.progress {
    height: 6px;
    border-radius: var(--radius-pill);
    background: #E2E8F0;
    overflow: hidden;
}
.progress-bar {
    border-radius: var(--radius-pill);
    transition: width .6s var(--ease-out);
}


/* ═══ ALERTS (themed) ════════════════════════════════════════════════ */
.alert {
    border-radius: var(--radius-lg);
    font-size: .82rem;
    font-weight: 300;
    border: none;
    padding: .75rem 1.15rem;
}
.alert-success { background: rgba(16,185,129,.08); color: #065F46; border-left: 3px solid var(--success); }
.alert-warning { background: rgba(245,158,11,.08); color: #92400E; border-left: 3px solid var(--warning); }
.alert-danger  { background: rgba(239,68,68,.08); color: #991B1B; border-left: 3px solid var(--danger); }
.alert-info    { background: rgba(59,130,246,.08); color: #1E40AF; border-left: 3px solid var(--info); }


/* ═══ DROPDOWNS (themed) ═════════════════════════════════════════════ */
.dropdown-menu {
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-lg);
    padding: .35rem;
    font-size: .82rem;
}
.dropdown-item {
    border-radius: var(--radius-sm);
    font-weight: 300;
    padding: .45rem .85rem;
    color: var(--text-primary);
    transition: all .15s var(--ease-out);
}
.dropdown-item:hover, .dropdown-item:focus {
    background: var(--accent-subtle);
    color: var(--accent);
}


/* ═══ PAGINATION ═════════════════════════════════════════════════════ */
.pagination .page-link {
    border-radius: var(--radius-sm);
    border: 1px solid var(--divider);
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 400;
    margin: 0 2px;
    padding: .4rem .75rem;
    transition: all .15s var(--ease-out);
}
.pagination .page-link:hover { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent); }
.pagination .page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}


/* ═══ AUTH PAGE STYLES (Login / Signup / Logout) ═════════════════════ */
body.auth-page {
    background: #0f172a;
    padding-top: 0;
    color: #e2e8f0;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ─── LEFT: CAROUSEL PANEL ─── */
.auth-carousel {
    flex: 0 0 50%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.auth-carousel::before {
    content: '';
    position: absolute; inset: 0;
    background: url('/static/images/golem.png') center/cover no-repeat;
    opacity: .22;
    pointer-events: none;
    z-index: 0;
}
.auth-carousel::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg,
        rgba(15,23,42,.7) 0%,
        rgba(30,41,59,.5) 50%,
        rgba(15,23,42,.75) 100%
    );
    pointer-events: none;
    z-index: 0;
}

.carousel-wrapper {
    position: relative; z-index: 1;
    width: 85%; max-width: 560px;
    text-align: center;
}

/* ── Slide: right-to-left reveal ── */
.carousel-slide {
    position: absolute;
    top: 50%; left: 0;
    width: 100%;
    opacity: 0;
    transform: translateY(-50%) translateX(80px);
    transition: opacity .5s cubic-bezier(.4,0,.2,1), transform .5s cubic-bezier(.4,0,.2,1);
    pointer-events: none;
}
.carousel-slide.active {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}
.carousel-slide.exiting {
    opacity: 0;
    transform: translateY(-50%) translateX(-80px);
}

.carousel-slide .slide-icon {
    width: 80px; height: 80px;
    border-radius: 24px;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    animation: floatIcon 3s ease-in-out infinite;
}
@keyframes floatIcon {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.carousel-slide .slide-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: .5rem;
    letter-spacing: -.03em;
    min-height: 2.4em;
}

/* Typewriter cursor blink */
.typewriter-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #14B8A6;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink .7s step-end infinite;
}
@keyframes cursorBlink {
    0%,100% { opacity: 1; }
    50% { opacity: 0; }
}

.carousel-slide .slide-desc {
    font-size: .95rem;
    color: rgba(255,255,255,.75);
    line-height: 1.7;
    max-width: 440px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .4s ease .3s, transform .4s ease .3s;
}
.carousel-slide.active .slide-desc {
    opacity: 1;
    transform: translateY(0);
}

.carousel-slide .slide-features {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
}
.carousel-slide .slide-features .tag {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 50rem;
    padding: .35rem .85rem;
    font-size: .75rem;
    color: rgba(255,255,255,.75);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .3s ease, transform .3s ease;
}
.carousel-slide.active .slide-features .tag {
    opacity: 1;
    transform: translateY(0);
}
.carousel-slide.active .slide-features .tag:nth-child(1) { transition-delay: .45s; }
.carousel-slide.active .slide-features .tag:nth-child(2) { transition-delay: .55s; }
.carousel-slide.active .slide-features .tag:nth-child(3) { transition-delay: .65s; }
.carousel-slide.active .slide-features .tag:nth-child(4) { transition-delay: .75s; }

.carousel-dots {
    position: absolute;
    bottom: 2.5rem;
    left: 50%; transform: translateX(-50%);
    z-index: 2;
    display: flex; gap: .5rem;
}
.carousel-dots .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    cursor: pointer;
    transition: all .3s ease;
}
.carousel-dots .dot.active {
    background: #14B8A6;
    width: 24px;
    border-radius: 4px;
    box-shadow: 0 0 12px rgba(20,184,166,.4);
}
.carousel-brand {
    position: absolute;
    top: 2rem; left: 2rem;
    z-index: 2;
    display: flex; align-items: center; gap: .5rem;
}
.carousel-brand-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: rgba(20,184,166,.2);
    border: 1px solid rgba(20,184,166,.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: #14B8A6;
}
.carousel-brand-text {
    font-size: 1.05rem; font-weight: 600; color: #fff;
}
.carousel-brand-text span { color: #14B8A6; font-weight: 700; }

/* ─── RIGHT: AUTH CARD PANEL ─── */
.auth-panel {
    flex: 0 0 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 2rem 2.5rem;
    position: relative;
    overflow-y: auto;
    min-height: 100vh;
}

.auth-card {
    width: 100%; max-width: 480px;
    background: #ffffff;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 1rem 0;
    position: relative;
    z-index: 1;
    animation: fadeIn .6s ease;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    margin-bottom: .5rem;
}
.auth-brand-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #14B8A6, #0F766E);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: #fff;
    box-shadow: 0 4px 16px rgba(20,184,166,.3);
}
.auth-brand-text {
    font-size: 1.25rem; font-weight: 600; color: #1e293b;
    letter-spacing: -.03em;
}
.auth-brand-text span { font-weight: 700; color: #0D9488; }

.auth-subtitle {
    text-align: center;
    color: #64748b;
    font-size: .85rem; font-weight: 400;
    margin-bottom: 1.5rem;
}

/* Clerk component inside auth-panel: full-width, no clipping */
.auth-panel .cl-rootBox { width: 100% !important; max-width: 480px !important; }
.auth-panel .cl-card {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
}
.auth-panel .cl-formButtonPrimary {
    background: linear-gradient(135deg, #14B8A6, #0F766E) !important;
    border-radius: 50rem !important;
    box-shadow: 0 4px 16px rgba(20,184,166,.3) !important;
    min-width: 100% !important;
}
.auth-panel .cl-formButtonPrimary:hover {
    box-shadow: 0 6px 24px rgba(20,184,166,.4) !important;
}
.auth-panel .cl-formFieldInput:focus {
    border-color: #14B8A6 !important;
    box-shadow: 0 0 0 3px rgba(20,184,166,.2) !important;
}
.auth-panel .cl-footerActionLink,
.auth-panel .cl-formFieldAction { color: #0D9488 !important; }
.auth-panel .cl-footerActionLink:hover { color: #14B8A6 !important; }

.auth-btn {
    width: 100%;
    padding: .65rem;
    border: none;
    border-radius: .75rem;
    background: linear-gradient(135deg, #14B8A6, #0F766E);
    color: #fff;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    transition: all .25s ease;
    box-shadow: 0 4px 16px rgba(20,184,166,.3);
}
.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(20,184,166,.4);
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    color: #64748b;
    font-size: .8rem; font-weight: 400;
}
.auth-footer a { color: #0D9488; font-weight: 500; text-decoration: none; }
.auth-footer a:hover { color: #14B8A6; }

.auth-error {
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.15);
    border-radius: .75rem;
    padding: .65rem 1rem;
    color: #dc2626;
    font-size: .8rem;
    margin-bottom: 1rem;
}

.auth-orb { display: none; }

/* Responsive: stack on mobile */
@media (max-width: 900px) {
    .auth-page { flex-direction: column; overflow-y: auto; }
    .auth-carousel { flex: none; min-height: 30vh; max-height: 35vh; }
    .auth-panel { flex: 1 1 auto; min-height: auto; padding: 1.5rem; justify-content: flex-start; padding-top: 2rem; }
    .carousel-wrapper { max-width: 90%; }
    .carousel-slide .slide-title { font-size: 1.3rem; }
    .carousel-slide .slide-desc { font-size: .85rem; }
    .carousel-slide .slide-features { gap: .35rem; }
    .carousel-slide .slide-features .tag { font-size: .68rem; padding: .25rem .6rem; }
    .carousel-dots { bottom: 1rem; }
}
@media (max-width: 576px) {
    .auth-carousel { display: none; }
    .auth-page { min-height: 100vh; overflow-y: auto; }
    .auth-panel { flex: 1 1 auto; min-height: 100vh; padding: 1.5rem; justify-content: flex-start; padding-top: 2.5rem; }
    .auth-card { max-width: 100%; }
    .auth-brand-text { font-size: 1.1rem; }
    .auth-brand-icon { width: 36px; height: 36px; font-size: 1rem; }
}


/* ═══ BED MANAGEMENT ═════════════════════════════════════════════════ */
.bed-cell {
    border-radius: var(--radius-sm);
    padding: .4rem .55rem;
    text-align: center;
    font-size: .7rem;
    font-weight: 400;
    cursor: pointer;
    transition: all .2s var(--ease-out);
    border: 1px solid transparent;
}
.bed-cell.available  { background: rgba(16,185,129,.1); color: #065F46; border-color: rgba(16,185,129,.2); }
.bed-cell.occupied   { background: rgba(239,68,68,.08); color: #991B1B; border-color: rgba(239,68,68,.15); }
.bed-cell.reserved   { background: rgba(59,130,246,.08); color: #1E40AF; border-color: rgba(59,130,246,.15); }
.bed-cell.maintenance{ background: rgba(245,158,11,.08); color: #92400E; border-color: rgba(245,158,11,.15); }
.bed-cell:hover { transform: scale(1.05); box-shadow: var(--shadow-sm); }


/* ═══ OT SCHEDULER ═══════════════════════════════════════════════════ */
.ot-slot {
    border-radius: var(--radius-sm);
    padding: .45rem .65rem;
    font-size: .72rem;
    font-weight: 400;
    border-left: 3px solid;
    margin-bottom: .3rem;
    transition: all .2s var(--ease-out);
}
.ot-slot.scheduled    { background: rgba(99,102,241,.08); border-color: #6366F1; color: #4338CA; }
.ot-slot.in-progress  { background: rgba(245,158,11,.08); border-color: var(--warning); color: #92400E; }
.ot-slot.completed    { background: rgba(16,185,129,.08); border-color: var(--success); color: #065F46; }
.ot-slot.cancelled    { background: rgba(239,68,68,.08); border-color: var(--danger); color: #991B1B; }


/* ═══ WARD CARD ══════════════════════════════════════════════════════ */
.ward-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: all .25s var(--ease-out);
}
.ward-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }


/* ═══ TIMELINE ═══════════════════════════════════════════════════════ */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.25rem;
    border-left: 2px solid var(--divider);
}
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px; top: 4px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--card-bg);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}
.timeline-item.danger::before { background: var(--danger); box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.timeline-item.success::before { background: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.timeline-item.warning::before { background: var(--warning); box-shadow: 0 0 0 2px rgba(245,158,11,.2); }


/* ═══ PIPELINE / STEP INDICATORS ═════════════════════════════════════ */
.pipeline-step {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    font-size: .78rem;
    font-weight: 400;
    transition: all .2s var(--ease-out);
}
.pipeline-step.done   { color: var(--success); }
.pipeline-step.active { color: var(--accent); font-weight: 500; }
.pipeline-step.todo   { color: var(--text-muted); }


/* ═══ RISK BAR ═══════════════════════════════════════════════════════ */
.risk-bar {
    height: 6px;
    border-radius: var(--radius-pill);
    background: #E2E8F0;
    overflow: hidden;
}
.risk-bar .fill { height: 100%; border-radius: var(--radius-pill); transition: width .6s var(--ease-out); }
.risk-bar .fill.low    { background: var(--success); }
.risk-bar .fill.medium { background: var(--warning); }
.risk-bar .fill.high   { background: var(--danger); }


/* ═══ AI GLOW EFFECT ═════════════════════════════════════════════════ */
.ai-glow {
    position: relative;
}
.ai-glow::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(13,148,136,.15), rgba(59,130,246,.1));
    z-index: -1;
    opacity: 0;
    transition: opacity .3s var(--ease-out);
}
.ai-glow:hover::after { opacity: 1; }


/* ═══ FILTER CHIPS / PILLS ═══════════════════════════════════════════ */
.filter-btn, .filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .85rem;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--divider);
    background: #fff;
    color: var(--text-secondary);
    font-size: .78rem;
    font-weight: 400;
    cursor: pointer;
    transition: all .2s var(--ease-out);
}
.filter-btn:hover, .filter-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}
.filter-btn.active, .filter-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}


/* ═══ EMPTY STATE ════════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; opacity: .3; margin-bottom: .75rem; }
.empty-state p { font-size: .85rem; font-weight: 300; }


/* ═══ AVATARS ════════════════════════════════════════════════════════ */
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 500; flex-shrink: 0; }
.avatar-md { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 500; flex-shrink: 0; }
.avatar-lg { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 500; flex-shrink: 0; }
.avatar-accent { background: linear-gradient(135deg, var(--accent), #0F766E); color: #fff; }
.avatar-blue   { background: linear-gradient(135deg, #3B82F6, #2563EB); color: #fff; }
.avatar-purple { background: linear-gradient(135deg, #8B5CF6, #7C3AED); color: #fff; }
.avatar-danger { background: linear-gradient(135deg, #EF4444, #DC2626); color: #fff; }


/* ═══ SOS / EMERGENCY ════════════════════════════════════════════════ */
.sos-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    border-left: 4px solid var(--danger);
    transition: all .25s var(--ease-out);
}
.sos-card:hover { box-shadow: var(--shadow-md); }
.sos-card.critical { border-left-color: var(--danger); background: rgba(239,68,68,.02); }
.sos-card.dispatched { border-left-color: var(--warning); }
.sos-card.resolved { border-left-color: var(--success); }

.sos-button {
    width: 140px; height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(239,68,68,.4);
    transition: all .3s var(--ease-out);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: .3rem;
    animation: sosPulse 2s ease-in-out infinite;
}
.sos-button:hover { transform: scale(1.08); box-shadow: 0 12px 40px rgba(239,68,68,.5); }
@keyframes sosPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(239,68,68,.4); }
    50% { box-shadow: 0 8px 32px rgba(239,68,68,.6), 0 0 0 12px rgba(239,68,68,.1); }
}


/* ═══ MAP CONTAINERS (Leaflet) ═══════════════════════════════════════ */
.map-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
}


/* ═══ NOTETAKER ROOM ═════════════════════════════════════════════════ */
/* Override for full-height notetaker layout */
.content-area:has(.nr-app), .content-area:has(.m-app), .content-area:has(.g-app), .content-area:has(.dispatch-wrapper) {
    padding: 0 !important;
    height: calc(100vh - var(--header-h)) !important;
    overflow: hidden !important;
}


/* ═══ ONBOARDING ═════════════════════════════════════════════════════ */
.onboard-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #EDE9FE, #DBEAFE, #D1FAE5);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
}
.onboard-container {
    width: 100%; max-width: 680px;
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem 2rem;
}


/* ═══ PRINT HELPERS ══════════════════════════════════════════════════ */
@media print {
    .no-print { display: none !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    .page-hero { background: #f8f9fa !important; color: #333 !important; }
}


/* ═══ RESPONSIVE TABLE WRAPPER ═══════════════════════════════════════ */
.table-responsive {
    border-radius: var(--radius-lg);
    overflow: auto;
}

/* ═══ LEAFLET MAP OVERRIDE ═══════════════════════════════════════════ */
.leaflet-container {
    border-radius: var(--radius-lg);
    font-family: inherit;
}


/* ═══ MISCELLANEOUS HELPERS ══════════════════════════════════════════ */
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-info    { color: var(--info) !important; }
.text-purple  { color: var(--purple) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.bg-success-subtle { background: rgba(16,185,129,.08) !important; }
.bg-warning-subtle { background: rgba(245,158,11,.08) !important; }
.bg-danger-subtle  { background: rgba(239,68,68,.08) !important; }
.bg-info-subtle    { background: rgba(59,130,246,.08) !important; }
.bg-purple-subtle  { background: rgba(139,92,246,.08) !important; }

.border-accent { border-color: var(--accent) !important; }
.border-success { border-color: var(--success) !important; }
.border-warning { border-color: var(--warning) !important; }
.border-danger { border-color: var(--danger) !important; }

.rounded-clinical { border-radius: var(--radius-lg) !important; }
.rounded-pill-clinical { border-radius: var(--radius-pill) !important; }


/* ═══════════════════════════════════════════════════════════════════════
   MOBILE-RESPONSIVE DASHBOARD OVERRIDES
   Ensures all dashboards, tables, cards, modals work on phones/tablets
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Tablet (≤992px) ─────────────────────────────────────────────── */
@media (max-width: 992px) {
    /* Stat-card grids → 2-up */
    .row > [class*='col-xl-'],
    .row > [class*='col-lg-'] { flex: 0 0 50%; max-width: 50%; }

    /* Large modals shrink */
    .modal-xl { max-width: 95vw; }
    .modal-lg { max-width: 90vw; }

    /* Tab labels: remove icon text on tight screens */
    .nav-tabs .nav-link, .nav-pills .nav-link { font-size: .82rem; padding: .45rem .7rem; }

    /* Pipeline / step indicators wrap */
    .pipeline-steps, .step-indicator { flex-wrap: wrap; gap: .5rem; }

    /* Bed/Ward grid → 2 cols */
    .bed-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .ward-card-grid { grid-template-columns: repeat(2, 1fr) !important; }

    /* OT timeline card → full width */
    .ot-timeline-card { min-width: auto; }
}

/* ── Phone (≤768px) ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Page header flex → stack */
    .container-fluid > .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: .75rem;
    }

    /* Stat cards → 2-up even on small */
    .row > [class*='col-md-3'],
    .row > [class*='col-md-4'],
    .row > [class*='col-md-2'] { flex: 0 0 50%; max-width: 50%; }
    .row > .col-md-6 { flex: 0 0 100%; max-width: 100%; }

    /* Stat card bodies smaller */
    .card-body.p-3 { padding: .65rem !important; }
    .card-body .fs-5 { font-size: 1rem !important; }
    .card-body .fa-lg { font-size: 1rem; }

    /* Table font shrink */
    .table { font-size: .78rem; }
    .table th, .table td { padding: .4rem .5rem; }
    .table .btn-group .btn { padding: .2rem .35rem; font-size: .72rem; }

    /* Force horizontal scroll on wide tables */
    .table-responsive { -webkit-overflow-scrolling: touch; }

    /* Modal full-width on mobile */
    .modal-dialog { margin: .5rem; max-width: calc(100vw - 1rem); }
    .modal-lg, .modal-xl { max-width: calc(100vw - 1rem); }
    .modal-body { padding: .75rem; }
    .modal-header, .modal-footer { padding: .5rem .75rem; }
    .modal-title { font-size: .95rem; }

    /* Form rows → stacked */
    .modal-body .row.g-3 > [class*='col-md-'] { flex: 0 0 100%; max-width: 100%; }

    /* Tabs wrap + scroll */
    .nav-tabs, .nav-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .nav-tabs::-webkit-scrollbar, .nav-pills::-webkit-scrollbar { display: none; }
    .nav-tabs .nav-item, .nav-pills .nav-item { flex-shrink: 0; }

    /* Card header buttons wrap */
    .card-header .d-flex { flex-wrap: wrap !important; gap: .4rem; }
    .card-header .form-select-sm, .card-header .form-control-sm { width: 100% !important; }

    /* Badge pills smaller */
    .badge { font-size: .68rem; padding: .2em .5em; }

    /* Button groups → compact */
    .btn-group-sm .btn, .btn-sm { font-size: .75rem; padding: .25rem .45rem; }

    /* Dropdown wide on mobile */
    .dropdown-menu { min-width: auto; width: 100%; }

    /* Bed grid → 1 col */
    .bed-grid { grid-template-columns: 1fr !important; }
    .ward-card-grid { grid-template-columns: 1fr !important; }

    /* Prescription / dispensing sidebar → collapse below */
    .rx-sidebar, .low-stock-sidebar { display: none; }

    /* AI chat panels → full width */
    .g-app, .m-app, .nr-app { flex-direction: column !important; }
    .g-side, .m-side, .nr-ctx { width: 100% !important; min-width: 0 !important; max-width: 100% !important; height: auto !important; max-height: 250px; }
    .g-main, .m-chat, .nr-main { flex: 1 1 auto; }

    /* Report toolbar: wrap buttons */
    .d-flex.gap-2 { gap: .35rem !important; }

    /* Page container padding */
    .container-fluid.px-4 { padding-left: .75rem !important; padding-right: .75rem !important; }
    .container-fluid.py-3 { padding-top: .5rem !important; padding-bottom: .5rem !important; }

    /* H4/H5 headings */
    h4 { font-size: 1.1rem !important; }
    h5 { font-size: 1rem !important; }
    h6 { font-size: .88rem !important; }

    /* Auth pages responsive */
    .auth-card { margin: 1rem; padding: 1.5rem !important; max-width: 100%; }
    .auth-orb { display: none; }

    /* Dashboard KPI grids */
    .stat-card, .metric-card { padding: .5rem; }
}

/* ── Small Phone (≤480px) ────────────────────────────────────────── */
@media (max-width: 480px) {
    /* Stat cards → still 2-up but real tight */
    .row > [class*='col-6'] { padding-left: .25rem; padding-right: .25rem; }
    .row.g-3 { --bs-gutter-x: .5rem; --bs-gutter-y: .5rem; }

    /* Card body extreme compact */
    .card-body.p-3 { padding: .45rem !important; }
    .card-body .fs-5 { font-size: .9rem !important; }

    /* Table extreme compact */
    .table { font-size: .72rem; }
    .table th, .table td { padding: .3rem .35rem; }

    /* Hide less important table columns on very small */
    .table .d-none-xs { display: none !important; }

    /* Modal tighter */
    .modal-body { padding: .5rem; }

    /* Button text hide — icon only */
    .btn-sm .me-1 + span, .btn-sm .ms-1 { display: none; }

    /* Content area even tighter */
    .container-fluid.px-4 { padding-left: .5rem !important; padding-right: .5rem !important; }

    /* Heading sizes */
    h4 { font-size: 1rem !important; }
    h5 { font-size: .9rem !important; }

    /* Sub-pills smaller */
    .nav-pills .nav-link { font-size: .7rem; padding: .3rem .5rem; }

    /* Page title icon */
    .fa-lg { font-size: .85rem !important; }
}

/* ── Utility: hide on mobile ─────────────────────────────────────── */
@media (max-width: 768px) {
    .d-mobile-none { display: none !important; }
}
@media (min-width: 769px) {
    .d-mobile-only { display: none !important; }
}


/* ═══════════════════════════════════════════════════════════════════════
   BOOTSTRAP OVERRIDE PATCH — Fix white-background bleed
   These rules tame Bootstrap utility classes (bg-white, text-dark,
   table-light, etc.) that ship with !important and override the
   Clinical Slate palette.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 1. .bg-white — kills card-header transparency ── */
.bg-white {
    background-color: var(--card-bg) !important;
}

/* ── 2. .bg-light — light-grey panels ── */
.bg-light {
    background-color: var(--slate-bg) !important;
}

/* ── 3. .text-dark — overrides --text-primary ── */
.text-dark {
    color: var(--text-primary) !important;
}

/* ── 4. .table-light — thead rows ── */
.table-light,
.table-light > th,
.table-light > td,
thead.table-light > tr > th {
    --bs-table-bg: var(--slate-bg) !important;
    background-color: var(--slate-bg) !important;
    color: var(--text-secondary);
    border-color: var(--divider) !important;
}

/* ── 5. .btn-light ── */
.btn-light {
    background-color: var(--slate-bg);
    border: 1.5px solid var(--divider);
    color: var(--text-primary);
    box-shadow: none;
}
.btn-light:hover {
    background-color: #E2E8F0;
    border-color: var(--divider);
    color: var(--text-primary);
}

/* ── 6. .btn-outline-dark ── */
.btn-outline-dark {
    border: 1.5px solid var(--text-primary);
    color: var(--text-primary);
    background: transparent;
}
.btn-outline-dark:hover {
    background: var(--text-primary);
    color: #fff;
}

/* ── 7. .input-group-text ── */
.input-group-text {
    background-color: var(--slate-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-secondary);
    font-size: .82rem;
}

/* ── 8. .offcanvas (role editor panel) ── */
.offcanvas {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--card-border);
}
.offcanvas-header {
    border-bottom: 1px solid var(--divider);
}
.offcanvas-title {
    color: var(--text-primary);
}

/* ── 9. .badge.bg-light / .badge.bg-white ── */
.badge.bg-light {
    background-color: var(--slate-bg) !important;
    color: var(--text-primary) !important;
}
.badge.bg-white {
    background-color: #fff !important;
    color: var(--text-primary) !important;
}

/* ── 10. .card-footer — explicit theme styling ── */
.card-footer {
    background-color: transparent;
    border-top: 1px solid var(--card-border);
    padding: .65rem 1.15rem;
}

/* ── 11. .card-body ── */
.card-body {
    color: var(--text-primary);
}

/* ── 12. .form-check-input ── */
.form-check-input {
    background-color: var(--slate-bg);
    border-color: var(--input-border);
}
.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.form-check-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ── 13. .dropdown-menu — add missing background ── */
.dropdown-menu {
    background-color: var(--card-bg);
}

/* ── 14. .form-label ── */
.form-label {
    color: var(--text-primary);
    font-size: .82rem;
    font-weight: 400;
}

/* ── 15. .dropdown-divider / .dropdown-header ── */
.dropdown-divider {
    border-top-color: var(--divider);
}
.dropdown-header {
    color: var(--text-muted);
    font-size: .72rem;
}

/* ── 16. Border utilities ── */
.border-bottom {
    border-bottom-color: var(--divider) !important;
}
.border-top {
    border-top-color: var(--divider) !important;
}

/* ── 17. Comprehensive element overrides — catch remaining white backgrounds ── */
.card,
.card-header {
    background-color: var(--card-bg) !important;
    color: var(--text-primary);
}
.modal-content {
    background-color: var(--card-bg);
    color: var(--text-primary);
}
.modal-header,
.modal-footer {
    background-color: var(--card-bg);
    border-color: var(--divider);
}
.list-group-item {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--divider);
}
.popover {
    background-color: var(--card-bg);
    color: var(--text-primary);
}
.toast {
    background-color: var(--card-bg);
}
.accordion-button {
    background-color: var(--card-bg);
    color: var(--text-primary);
}
.accordion-button:not(.collapsed) {
    background-color: var(--slate-bg);
    color: var(--text-primary);
}
.accordion-body {
    background-color: var(--card-bg);
}
.nav-tabs .nav-link.active {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--divider) var(--divider) var(--card-bg);
}
.form-control,
.form-select {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--input-border);
}
.form-control:focus,
.form-select:focus {
    background-color: var(--card-bg);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
.alert {
    border-color: var(--divider);
}
.breadcrumb {
    background-color: transparent;
}
.page-link {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--divider);
}
.page-item.active .page-link {
    background-color: var(--accent);
    border-color: var(--accent);
}
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
}
.table > :not(caption) > * > * {
    background-color: transparent;
    border-bottom-color: var(--divider);
}
.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: var(--slate-bg);
    color: var(--text-primary);
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: var(--slate-bg);
    color: var(--text-primary);
}

/* ── 18. Scrollbar styling ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--slate-bg); }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
