/* ============================================================
   CBAHI Ambulatory Care Portal — Professional Design System
   Modern Healthcare SaaS | 2026 | Complete Redesign
   ============================================================ */

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
    /* Primary — Warm Navy to Blue */
    --primary-950: #0F1D35;
    --primary-900: #1A2D4F;
    --primary-800: #1E3A5F;
    --primary-700: #254E7A;
    --primary-600: #2D6BA6;
    --primary-500: #3B82F6;
    --primary-400: #60A5FA;
    --primary-300: #93C5FD;
    --primary-200: #BFDBFE;
    --primary-100: #DBEAFE;
    --primary-50: #EFF6FF;

    /* Accent — Teal */
    --accent-800: #115E59;
    --accent-700: #0F766E;
    --accent-600: #0D9488;
    --accent-500: #14B8A6;
    --accent-400: #2DD4BF;
    --accent-100: #CCFBF1;
    --accent-50: #F0FDFA;

    /* Neutrals — Warm */
    --white: #FFFFFF;
    --gray-50: #F8F9FB;
    --gray-100: #F0F2F5;
    --gray-150: #E8EBF0;
    --gray-200: #DDE1E8;
    --gray-300: #C5CAD4;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --gray-950: #030712;

    /* Status — More vibrant */
    --success: #059669;
    --success-light: #D1FAE5;
    --success-dark: #065F46;
    --warning: #D97706;
    --warning-light: #FEF3C7;
    --warning-dark: #92400E;
    --danger: #DC2626;
    --danger-light: #FEE2E2;
    --danger-dark: #991B1B;
    --info: #2563EB;
    --info-light: #DBEAFE;
    --info-dark: #1E40AF;

    /* Shadows — Softer, more dimensional */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.10), 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 0 4px var(--primary-100);

    /* Radius — More rounded, modern */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-xxl: 20px;
    --radius-full: 9999px;

    /* Typography — Cleaner scale */
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.8rem;
    --font-size-base: 0.875rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.125rem;
    --font-size-2xl: 1.35rem;
    --font-size-3xl: 1.75rem;

    /* Spacing system */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Layout */
    --sidebar-w: 260px;
    --header-h: 64px;
    --content-max-w: 1280px;

    /* Transitions — Smooth */
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 150ms;
    --dur: 200ms;
    --dur-slow: 300ms;
}

/* ============================================================
   2. BASE & RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--primary-600); text-decoration: none; transition: color var(--dur) var(--ease-out); }
a:hover { color: var(--primary-700); }
a:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; border-radius: var(--radius-xs); }

::selection { background: var(--primary-100); color: var(--primary-800); }
:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; border-radius: var(--radius-xs); }

img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
table { border-collapse: collapse; }
input, button, textarea, select { font: inherit; }
svg { display: block; }

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.3;
    letter-spacing: -0.01em;
}
h1 { font-size: var(--font-size-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p { margin-bottom: 0.75rem; line-height: 1.7; }

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }

.text-muted { color: var(--gray-500) !important; }
.text-secondary { color: var(--gray-600) !important; }
.text-primary { color: var(--primary-600) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ============================================================
   4. APP SHELL LAYOUT
   ============================================================ */
.app-shell {
    min-height: 100vh;
    display: flex;
}

/* ============================================================
   5. SIDEBAR — Complete Redesign
   ============================================================ */
.app-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--primary-950) 0%, var(--primary-900) 100%);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform var(--dur-slow) var(--ease-out);
    overflow: hidden;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.06);
}

/* Brand area */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    min-height: var(--header-h);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-600), var(--accent-500));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--white);
    line-height: 1.2;
}

.sidebar-brand-text small {
    display: block;
    font-weight: 400;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.3px;
    margin-top: 0.05rem;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: var(--radius-full); }

.nav-section {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-section-header {
    padding: 0.85rem 1.25rem 0.35rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.3);
}

/* Nav links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    margin: 0.1rem 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--dur) var(--ease-out);
    position: relative;
    text-decoration: none;
    cursor: pointer;
}

.nav-link:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.12);
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    inset-inline-start: -0.65rem;
    inset-block: 0.4rem;
    width: 3px;
    background: var(--accent-500);
    border-radius: var(--radius-full);
    box-shadow: 0 0 8px rgba(20, 184, 166, 0.4);
}

.nav-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-link.active .nav-icon { opacity: 1; }
.nav-link p { margin: 0; flex: 1; }

.nav-link .nav-chevron {
    font-size: 0.6rem;
    transition: transform var(--dur) var(--ease);
    color: rgba(255, 255, 255, 0.3);
}

.nav-link[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

/* Sub navigation */
.nav-sub {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: max-height var(--dur-slow) var(--ease-out);
}

.nav-sub .nav-link {
    padding-inline-start: 2.8rem;
    font-size: 0.8rem;
    margin-inline: 0;
    border-radius: 0;
    border-inline-start: 2px solid transparent;
    margin: 0;
}

.nav-sub .nav-link.active {
    border-inline-start-color: var(--accent-500);
    background: rgba(255, 255, 255, 0.08);
    margin: 0;
    border-radius: 0;
}

.nav-sub .nav-link.active::before { display: none; }

.nav-sub .nav-link:hover {
    border-inline-start-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 29, 53, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1035;
}

/* ============================================================
   6. HEADER — Clean & Minimal
   ============================================================ */
.app-header {
    position: fixed;
    inset-block-start: 0;
    inset-inline-start: var(--sidebar-w);
    inset-inline-end: 0;
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1030;
    transition: inset-inline-start var(--dur-slow) var(--ease-out);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-hamburger {
    background: transparent;
    border: none;
    color: var(--gray-400);
    font-size: 1.15rem;
    padding: 0.4rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--dur) var(--ease-out);
}

.header-hamburger:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.header-brand {
    display: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn {
    background: transparent;
    border: 1px solid var(--gray-200);
    color: var(--gray-500);
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--dur) var(--ease-out);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    position: relative;
}

.header-btn:hover {
    background: var(--gray-50);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.header-badge {
    position: absolute;
    inset-block-start: -4px;
    inset-inline-end: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.55rem;
    font-weight: 700;
    background: var(--danger);
    color: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
}

/* Language toggle */
.header-lang {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.header-lang-btn {
    background: transparent;
    border: none;
    color: var(--gray-400);
    padding: 0.3rem 0.55rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--dur) var(--ease-out);
    text-transform: uppercase;
    line-height: 1;
}

.header-lang-btn:hover { color: var(--gray-700); }
.header-lang-btn.active {
    background: var(--white);
    color: var(--primary-700);
    box-shadow: var(--shadow-sm);
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    padding: 0.3rem 0.5rem 0.3rem 0.3rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--dur) var(--ease-out);
    text-decoration: none;
}

.user-menu:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-700);
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dropdowns */
.header-dropdown {
    background: var(--white);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-xl);
    margin-top: 0.5rem !important;
    padding: 0.5rem;
    min-width: 220px;
}

.header-dropdown .dropdown-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--gray-700);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all var(--dur) var(--ease-out);
}

.header-dropdown .dropdown-item:hover {
    background: var(--gray-50);
    color: var(--primary-600);
}

.header-dropdown .dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--gray-400);
}

.header-dropdown .dropdown-divider {
    margin: 0.35rem 0;
    border-color: var(--gray-100);
}

/* User card dropdown */
.user-card-header {
    text-align: center;
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.user-card-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 auto 0.5rem;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.user-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-900);
}

.user-card-email {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.user-card-role {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--primary-700);
    background: var(--primary-100);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
}

.user-card-body {
    padding: 0.5rem;
}

.user-card-footer {
    padding: 0.5rem;
    border-top: 1px solid var(--gray-100);
}

/* Notification dropdown */
.notif-dropdown {
    width: 360px;
    padding: 0;
}

.notif-header {
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
    font-weight: 600;
    font-size: 0.85rem;
}

.notif-header button {
    background: none;
    border: none;
    color: var(--primary-600);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.notif-header button:hover { color: var(--primary-700); text-decoration: underline; }

.notif-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    transition: background var(--dur) var(--ease-out);
    cursor: pointer;
}

.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: var(--primary-50); }

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--primary-500);
    flex-shrink: 0;
    margin-top: 0.35rem;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.notif-item.read .notif-dot { background: var(--gray-300); box-shadow: none; }

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 0.8rem; font-weight: 600; color: var(--gray-800); }
.notif-desc { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 0.65rem; color: var(--gray-400); display: block; margin-top: 0.2rem; }

.notif-footer {
    display: block;
    padding: 0.65rem 1rem;
    text-align: center;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-600);
}

.notif-footer:hover { background: var(--gray-50); }

/* ============================================================
   7. CONTENT AREA
   ============================================================ */
.content-wrapper {
    margin-inline-start: var(--sidebar-w);
    padding-block-start: var(--header-h);
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-inline-start var(--dur-slow) var(--ease-out);
}

.content-area {
    flex: 1;
    min-width: 0;
    padding: var(--space-6);
    max-width: var(--content-max-w);
    width: 100%;
    margin-inline: auto;
    animation: fadeIn var(--dur-slow) var(--ease-out);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   8. PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.page-header-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.page-header-title h1 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.page-header-title .page-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.page-header-subtitle {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
    margin-top: 0.15rem;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================
   9. BREADCRUMB
   ============================================================ */
.breadcrumb {
    flex-wrap: wrap;
}

.breadcrumb-item {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breadcrumb-item a {
    display: inline;
}

/* ============================================================
   10. FOOTER
   ============================================================ */
.app-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--gray-400);
    border-top: 1px solid var(--gray-100);
    margin-inline-start: var(--sidebar-w);
    transition: margin-inline-start var(--dur-slow) var(--ease-out);
}

/* ============================================================
   11. CARDS — Premium Elevated Design
   ============================================================ */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--dur) var(--ease-out);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i { color: var(--gray-400); font-size: 0.85rem; }

.card-body { padding: 1.25rem; }

.card-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8rem;
}

/* Card color variants — subtle top accent */
.card-primary { border-top: 3px solid var(--primary-500); }
.card-primary .card-title i { color: var(--primary-500); }
.card-secondary { border-top: 3px solid var(--gray-500); }
.card-success { border-top: 3px solid var(--success); }
.card-success .card-title i { color: var(--success); }
.card-warning { border-top: 3px solid var(--warning); }
.card-warning .card-title i { color: var(--warning); }
.card-danger { border-top: 3px solid var(--danger); }
.card-danger .card-title i { color: var(--danger); }
.card-info { border-top: 3px solid var(--info); }
.card-info .card-title i { color: var(--info); }

.card-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ============================================================
   12. METRIC CARDS — Modern KPI Display
   ============================================================ */
.metric-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all var(--dur) var(--ease-out);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xs);
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--gray-300);
}

.metric-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.metric-icon.primary { background: var(--primary-100); color: var(--primary-600); }
.metric-icon.success { background: var(--success-light); color: var(--success); }
.metric-icon.warning { background: var(--warning-light); color: var(--warning); }
.metric-icon.danger { background: var(--danger-light); color: var(--danger); }
.metric-icon.info { background: var(--info-light); color: var(--info); }
.metric-icon.accent { background: var(--accent-100); color: var(--accent-600); }

.metric-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.metric-badge.up { background: var(--success-light); color: var(--success); }
.metric-badge.down { background: var(--danger-light); color: var(--danger); }
.metric-badge.neutral { background: var(--gray-100); color: var(--gray-600); }

.metric-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 0.15rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.1;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.metric-subtitle {
    font-size: var(--font-size-sm);
    color: var(--gray-400);
}

.metric-footer {
    margin-top: auto;
    padding-top: var(--space-3);
    border-top: 1px solid var(--gray-100);
}

.metric-footer a {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--primary-600);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.metric-footer a:hover {
    color: var(--primary-700);
    gap: 0.5rem;
}

/* ============================================================
   13. FORMS — Clean & Accessible
   ============================================================ */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

.form-label .required { color: var(--danger); margin-inline-start: 0.15rem; }

.form-control {
    display: block;
    width: 100%;
    height: 42px;
    padding: 0.5rem 0.85rem;
    font-size: var(--font-size-base);
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--white);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: all var(--dur) var(--ease-out);
    outline: none;
}

.form-control:hover { border-color: var(--gray-400); }

.form-control:focus {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-glow);
}

.form-control::placeholder { color: var(--gray-400); }
.form-control:disabled { background: var(--gray-100); color: var(--gray-500); cursor: not-allowed; opacity: 0.7; }

textarea.form-control { height: auto; min-height: 90px; resize: vertical; line-height: 1.6; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.form-help {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
    margin-top: 0.3rem;
}

.form-error {
    font-size: var(--font-size-sm);
    color: var(--danger);
    margin-top: 0.3rem;
}

.form-control.error, .form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.error:focus, .form-control.is-invalid:focus {
    box-shadow: 0 0 0 4px var(--danger-light);
}

/* Input group */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    position: relative;
}

.input-group .input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    background: var(--gray-100);
    border: 1.5px solid var(--gray-300);
    border-inline-end: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    color: var(--gray-500);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.input-group .form-control:first-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

.input-group .toggle-password {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    background: var(--white);
    border: 1.5px solid var(--gray-300);
    border-inline-start: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--gray-500);
    cursor: pointer;
    transition: color var(--dur) var(--ease-out);
    font-size: 0.85rem;
}

.input-group .toggle-password:hover { color: var(--gray-700); background: var(--gray-50); }

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-xs);
    accent-color: var(--primary-600);
    cursor: pointer;
    transition: all var(--dur) var(--ease-out);
}

.form-check-input:checked { border-color: var(--primary-600); }

.form-check-label {
    font-size: var(--font-size-base);
    color: var(--gray-700);
    cursor: pointer;
}

/* Form section */
.form-section {
    margin-bottom: var(--space-6);
}

.form-section-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: var(--space-4);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

/* ============================================================
   14. BUTTONS — Modern & Clean
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: var(--font);
    line-height: 1.5;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--dur) var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
    height: 38px;
}

.btn:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: var(--white);
    border-color: transparent;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    box-shadow: var(--shadow-sm);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: var(--white);
    border-color: transparent;
}
.btn-success:hover { box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35); transform: translateY(-1px); }

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #D97706);
    color: var(--white);
    border-color: transparent;
}
.btn-warning:hover { box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35); transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #DC2626);
    color: var(--white);
    border-color: transparent;
}
.btn-danger:hover { box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35); transform: translateY(-1px); }

.btn-info {
    background: linear-gradient(135deg, var(--info), #2563EB);
    color: var(--white);
    border-color: transparent;
}
.btn-info:hover { box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35); transform: translateY(-1px); }

.btn-outline-primary {
    background: transparent;
    color: var(--primary-600);
    border-color: var(--primary-500);
}

.btn-outline-primary:hover {
    background: var(--primary-50);
    color: var(--primary-700);
    border-color: var(--primary-600);
}

.btn-sm { height: 32px; padding: 0.3rem 0.75rem; font-size: var(--font-size-xs); border-radius: var(--radius-sm); }
.btn-lg { height: 46px; padding: 0.65rem 1.35rem; font-size: var(--font-size-base); border-radius: var(--radius-md); }
.btn-xs { height: 26px; padding: 0.15rem 0.5rem; font-size: 0.65rem; border-radius: var(--radius-xs); }

.btn-icon { width: 38px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-xs { width: 26px; }

/* Loading button */
.btn.loading { position: relative; pointer-events: none; }
.btn.loading .btn-text { visibility: hidden; }
.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-secondary.loading::after { border-color: rgba(0,0,0,0.1); border-top-color: var(--gray-600); }
.btn-ghost.loading::after { border-color: rgba(0,0,0,0.1); border-top-color: var(--gray-600); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   15. TABLES — Clean Data Display
   ============================================================ */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--white);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

.table thead th {
    padding: 0.75rem 1rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    text-align: start;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--gray-50); }
.table tbody tr:nth-child(even) td { background: var(--gray-50/50); }

.table .cell-title {
    font-weight: 600;
    color: var(--gray-900);
}

.table .cell-sub {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
    display: block;
}

/* Table toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}

/* Table pagination */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.page-info {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
}

/* ============================================================
   16. BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
    line-height: 1.4;
}

.badge-primary { background: var(--primary-100); color: var(--primary-700); }
.badge-success { background: var(--success-light); color: var(--success-dark); }
.badge-warning { background: var(--warning-light); color: var(--warning-dark); }
.badge-danger { background: var(--danger-light); color: var(--danger-dark); }
.badge-info { background: var(--info-light); color: var(--info-dark); }
.badge-neutral { background: var(--gray-100); color: var(--gray-600); }

.badge-lg { padding: 0.3rem 0.85rem; font-size: var(--font-size-sm); }
.badge-sm { padding: 0.1rem 0.4rem; font-size: 0.6rem; }

/* ============================================================
   17. STATUS PILL
   ============================================================ */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.7rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.status-pill::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-pill.complete,
.status-pill.approved,
.status-pill.compliant { background: var(--success-light); color: var(--success-dark); }
.status-pill.complete::before,
.status-pill.approved::before,
.status-pill.compliant::before { background: var(--success); box-shadow: 0 0 6px rgba(5, 150, 105, 0.4); }

.status-pill.pending,
.status-pill.partial { background: var(--warning-light); color: var(--warning-dark); }
.status-pill.pending::before,
.status-pill.partial::before { background: var(--warning); box-shadow: 0 0 6px rgba(217, 119, 6, 0.4); }

.status-pill.incomplete,
.status-pill.expired,
.status-pill.inactive,
.status-pill.non-compliant,
.status-pill.missing { background: var(--danger-light); color: var(--danger-dark); }
.status-pill.incomplete::before,
.status-pill.expired::before,
.status-pill.inactive::before,
.status-pill.non-compliant::before,
.status-pill.missing::before { background: var(--danger); box-shadow: 0 0 6px rgba(220, 38, 38, 0.4); }

.status-pill.needs-review,
.status-pill.draft { background: var(--info-light); color: var(--info-dark); }
.status-pill.needs-review::before,
.status-pill.draft::before { background: var(--info); box-shadow: 0 0 6px rgba(37, 99, 235, 0.4); }

.status-pill.active { background: var(--success-light); color: var(--success-dark); }
.status-pill.active::before { background: var(--success); box-shadow: 0 0 6px rgba(5, 150, 105, 0.4); }

.status-pill.ticket-new { background: var(--info-light); color: var(--info-dark); }
.status-pill.ticket-new::before { background: var(--info); box-shadow: 0 0 6px rgba(37, 99, 235, 0.4); }

.status-pill.ticket-in-progress { background: var(--warning-light); color: var(--warning-dark); }
.status-pill.ticket-in-progress::before { background: var(--warning); box-shadow: 0 0 6px rgba(217, 119, 6, 0.4); }

.status-pill.ticket-resolved { background: var(--success-light); color: var(--success-dark); }
.status-pill.ticket-resolved::before { background: var(--success); box-shadow: 0 0 6px rgba(5, 150, 105, 0.4); }

.status-pill.ticket-cancelled { background: var(--danger-light); color: var(--danger-dark); }
.status-pill.ticket-cancelled::before { background: var(--danger); box-shadow: 0 0 6px rgba(220, 38, 38, 0.4); }

/* ============================================================
   18. ACCORDION
   ============================================================ */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.accordion-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--white);
    box-shadow: var(--shadow-xs);
}

.accordion-header { margin: 0; display: flex; align-items: center; }

.accordion-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    width: 100%;
    padding: 0.9rem 1.1rem;
    background: var(--white);
    border: none;
    font-size: var(--font-size-base);
    font-weight: 500;
    font-family: var(--font);
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--dur) var(--ease-out);
    text-align: start;
}

.accordion-btn:hover { background: var(--gray-50); }
.accordion-btn .accordion-chevron {
    margin-inline-start: auto;
    font-size: 0.65rem;
    color: var(--gray-400);
    transition: transform var(--dur) var(--ease-out);
}

.accordion-btn[aria-expanded="true"] .accordion-chevron {
    transform: rotate(180deg);
}

.accordion-body {
    padding: 0 1.1rem 1.1rem;
    border-top: 1px solid var(--gray-100);
    padding-top: 1rem;
}

/* ============================================================
   19. ALERTS
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    animation: slideDown 0.25s var(--ease-out);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert i { font-size: 1.1rem; margin-top: 0.1rem; flex-shrink: 0; }
.alert-content { flex: 1; }
.alert .btn-close {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.5;
    padding: 0.15rem;
    flex-shrink: 0;
    transition: opacity var(--dur) var(--ease-out);
}
.alert .btn-close:hover { opacity: 0.8; }

.alert-success { background: var(--success-light); color: var(--success-dark); border-color: #A7F3D0; }
.alert-danger { background: var(--danger-light); color: var(--danger-dark); border-color: #FECACA; }
.alert-warning { background: var(--warning-light); color: var(--warning-dark); border-color: #FDE68A; }
.alert-info { background: var(--info-light); color: var(--info-dark); border-color: #BFDBFE; }

/* ============================================================
   20. PROGRESS
   ============================================================ */
.progress {
    height: 8px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s var(--ease-out);
}

.progress-bar.bg-success { background: var(--success); }
.progress-bar.bg-warning { background: var(--warning); }
.progress-bar.bg-danger { background: var(--danger); }
.progress-bar.bg-primary { background: var(--primary-500); }

/* ============================================================
   21. DETAIL LIST
   ============================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4) var(--space-6);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--gray-100);
}

.detail-label {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.detail-value {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--gray-800);
}

/* ============================================================
   22. ACTION BUTTONS GRID
   ============================================================ */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-3);
}

.action-card-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: var(--space-5) var(--space-4);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    transition: all var(--dur) var(--ease-out);
    cursor: pointer;
    text-decoration: none !important;
    text-align: center;
    font-family: var(--font);
    box-shadow: var(--shadow-xs);
}

.action-card-btn:hover {
    border-color: var(--primary-400);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.action-card-btn i {
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--dur) var(--ease-out);
}

.action-card-btn:hover i {
    transform: scale(1.1);
}

.action-card-btn .action-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-800);
}

.action-card-btn .action-desc {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
}

/* Color variants */
.action-card-btn.primary i { background: var(--primary-100); color: var(--primary-600); }
.action-card-btn.success i { background: var(--success-light); color: var(--success); }
.action-card-btn.warning i { background: var(--warning-light); color: var(--warning); }
.action-card-btn.danger i { background: var(--danger-light); color: var(--danger); }
.action-card-btn.info i { background: var(--info-light); color: var(--info); }

/* ============================================================
   23. EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state h4 {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 0.35rem;
}

.empty-state p {
    font-size: var(--font-size-sm);
    color: var(--gray-400);
    margin: 0;
}

/* ============================================================
   24. LOADING & SKELETON
   ============================================================ */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--gray-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-sm { width: 14px; height: 14px; border-width: 2px; }

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-150) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   25. PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-item.disabled { opacity: 0.4; pointer-events: none; }
.page-item.active .page-link {
    background: var(--primary-500);
    color: var(--white);
    border-color: var(--primary-500);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.5rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-600);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--dur) var(--ease-out);
}

.page-link:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-800);
    box-shadow: var(--shadow-sm);
}

/* ============================================================
   26. MODALS — Modern & Clean
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 29, 53, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s var(--ease-out);
    padding: 1rem;
}

.modal-overlay .modal {
    background: var(--white);
    border-radius: var(--radius-xxl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.2s var(--ease-out);
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-xs);
    transition: all var(--dur) var(--ease-out);
}

.modal-close:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

.modal-body { padding: 1.25rem; }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-100);
}

/* ============================================================
   27. SEARCH / FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.filter-bar .search-input {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.filter-bar .search-input i {
    position: absolute;
    inset-inline-start: 0.75rem;
    inset-block-start: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.85rem;
    pointer-events: none;
}

.filter-bar .search-input .form-control {
    padding-inline-start: 2.25rem;
    height: 38px;
}

/* Search box (table toolbar inline) */
.search-box {
    position: relative;
}

.search-box .search-icon {
    position: absolute;
    inset-inline-start: 0.75rem;
    inset-block-start: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.8rem;
    pointer-events: none;
}

.search-box .form-control {
    padding-inline-start: 2.1rem;
    height: 34px;
    font-size: var(--font-size-sm);
}

/* ============================================================
   28. RTL SUPPORT
   ============================================================ */
html[dir="rtl"] body.sidebar-collapsed .app-sidebar {
    transform: translateX(100%);
}

html[dir="rtl"] select.form-control {
    background-position: left 0.75rem center;
    padding-right: 0.85rem;
    padding-left: 2.25rem;
}

html[dir="rtl"] .filter-bar .search-input i {
    inset-inline-start: auto;
    inset-inline-end: 0.75rem;
}

html[dir="rtl"] .filter-bar .search-input .form-control,
html[dir="rtl"] .search-box .form-control {
    padding-inline-start: 0.85rem;
    padding-inline-end: 2.25rem;
}

html[dir="rtl"] .search-box .search-icon {
    inset-inline-start: auto;
    inset-inline-end: 0.75rem;
}

html[dir="rtl"] .input-group .form-control {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

html[dir="rtl"] .pagination .page-link i {
    transform: scaleX(-1);
}

/* ============================================================
   29. SIDEBAR STATES
   ============================================================ */
body.sidebar-collapsed .app-sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .content-wrapper {
    margin-inline-start: 0;
    overflow-x: hidden;
}

body.sidebar-collapsed .app-header {
    inset-inline-start: 0;
}

body.sidebar-collapsed .app-footer {
    margin-inline-start: 0;
}

body.sidebar-mobile-open .sidebar-overlay {
    display: block;
}

/* ============================================================
   30. COMPLIANCE WIDGET
   ============================================================ */
.score-ring {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.score-ring svg { transform: rotate(-90deg); }

.score-value {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.score-label {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    text-align: center;
    margin-top: 0.25rem;
}

/* ============================================================
   31. HEALTH INFO ROWS
   ============================================================ */
.health-info-row {
    display: flex;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.health-info-row:last-child { border-bottom: none; }

.hi-label {
    width: 160px;
    flex-shrink: 0;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-500);
}

.hi-value {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--gray-800);
}

/* ============================================================
   32. READINESS / GAUGE
   ============================================================ */
.readiness-score {
    text-align: center;
}

.score-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.score-ring svg {
    transform: rotate(-90deg);
}

.score-value {
    position: absolute;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.score-value.success { color: var(--success); }
.score-value.warning { color: var(--warning); }
.score-value.danger { color: var(--danger); }

.score-label {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
    margin-top: 0.1rem;
}

/* ============================================================
   33. ALERT OVERRIDE (legacy Bootstrap compat)
   ============================================================ */
.alert-dismissible .btn-close {
    position: absolute;
    top: 0.85rem;
    inset-inline-end: 1.1rem;
}

.alert-dismissible {
    position: relative;
    padding-inline-end: 2.5rem;
}

/* ============================================================
   34. RESPONSIVE DESIGN
   ============================================================ */
@media (max-width: 1199.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .content-wrapper { margin-inline-start: 0 !important; overflow-x: hidden; }
    .app-header { inset-inline-start: 0 !important; }
    .app-footer { margin-inline-start: 0 !important; }

    body.sidebar-mobile-open .app-sidebar { transform: translateX(0); }

    html[dir="rtl"] .app-sidebar { transform: translateX(100%); }
    html[dir="rtl"] .app-header { inset-inline-end: 0 !important; }
    html[dir="rtl"] body.sidebar-mobile-open .app-sidebar { transform: translateX(0); }
}

@media (max-width: 991.98px) {
    .detail-grid { grid-template-columns: 1fr; }
    .action-grid { grid-template-columns: repeat(2, 1fr); }
    .content-area { padding: var(--space-4); }
    .table-container { border-radius: var(--radius-md); }
}

@media (max-width: 767.98px) {
    :root {
        --font-size-3xl: 1.5rem;
        --font-size-2xl: 1.2rem;
    }

    .content-area { padding: var(--space-3); }
    .page-header { flex-direction: column; align-items: flex-start; }
    .metric-card .metric-value { font-size: 1.4rem; }
    .action-grid { grid-template-columns: 1fr 1fr; }
    .user-name { display: none; }
    .table thead th { font-size: 0.65rem; padding: 0.5rem 0.65rem; }
    .table tbody td { padding: 0.5rem 0.65rem; font-size: var(--font-size-sm); }
    .detail-grid { gap: var(--space-3); }
    .card-header { padding: 0.85rem 1rem; }
    .card-body { padding: 1rem; }
    .header-lang-btn { padding: 0.25rem 0.45rem; font-size: 0.6rem; }
    .modal-overlay .modal { max-width: 100%; margin: 0.5rem; }
    .table-footer { flex-direction: column; align-items: center; text-align: center; }
}

@media (max-width: 575.98px) {
    .action-grid { grid-template-columns: 1fr; }
    .filter-bar .search-input { max-width: 100%; }
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { flex: 1; }
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .table-toolbar .search-box { width: 100%; }
    .table-toolbar .search-box .form-control { width: 100%; }
    .pagination { gap: 0.15rem; }
    .page-link { min-width: 30px; height: 30px; font-size: var(--font-size-xs); }
}

/* ============================================================
   35. LEGACY COMPATIBILITY
   ============================================================ */
.form-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); margin-bottom: 1.5rem; }
.form-card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-100); font-weight: 600; }
.form-card-body { padding: 1.25rem; }
.form-card-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--gray-100); }
.data-table-wrapper { overflow-x: auto; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); }
.data-table-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); }
.page-info { font-size: var(--font-size-sm); color: var(--gray-500); }
pre { font-family: var(--font-mono, monospace); }
code { background: var(--gray-100); padding: 0.15rem 0.35rem; border-radius: var(--radius-xs); font-size: 0.8em; }
.bg-gray-50 { background: var(--gray-50) !important; }
.px-2 { padding-inline: 0.5rem; }
.py-1 { padding-block: 0.25rem; }
.py-3 { padding-block: 0.75rem; }
.py-4 { padding-block: 1rem; }
.py-5 { padding-block: 1.25rem; }

/* Bootstrap-specific modal compat */
.modal.fade .modal-dialog { transition: transform 0.3s ease; }
.modal-content { background: var(--white); border: none; border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.modal-header .modal-title { font-size: 1rem; font-weight: 600; }
.modal-header .btn-close { background: none; border: none; font-size: 1.2rem; color: var(--gray-400); cursor: pointer; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 0.5rem; }
.modal-dialog { max-width: 500px; margin: 1.75rem auto; }
.fade { transition: opacity 0.15s linear; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 29, 53, 0.5); z-index: 1040; }

/* Utility classes */
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.d-block { display: block; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-fill { flex: 1 1 auto; }
.flex-grow-1 { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.5rem; }
.m-0 { margin: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.me-1 { margin-inline-end: 0.25rem; }
.me-2 { margin-inline-end: 0.5rem; }
.ms-auto { margin-inline-start: auto; }
.ms-1 { margin-inline-start: 0.25rem; }
.ms-2 { margin-inline-start: 0.5rem; }
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.text-center { text-align: center; }
.text-start { text-align: start; }
.text-end { text-align: end; }
.text-nowrap { white-space: nowrap; }
.overflow-hidden { overflow: hidden; }
.position-relative { position: relative; }
.bg-white { background: var(--white); }
.border-0 { border: none; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.fade-in { animation: fadeIn var(--dur-slow) var(--ease-out); }

/* Grid system */
.row { display: flex; flex-wrap: wrap; margin: 0 -0.75rem; }
.row > * { padding: 0 0.75rem; }
.col { flex: 1; min-width: 0; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }

@media (min-width: 768px) {
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-md-5 { flex: 0 0 41.667%; max-width: 41.667%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-7 { flex: 0 0 58.333%; max-width: 58.333%; }
    .col-md-8 { flex: 0 0 66.667%; max-width: 66.667%; }
}

@media (min-width: 992px) {
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-lg-5 { flex: 0 0 41.667%; max-width: 41.667%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-7 { flex: 0 0 58.333%; max-width: 58.333%; }
    .col-lg-8 { flex: 0 0 66.667%; max-width: 66.667%; }
}

@media (min-width: 1200px) {
    .col-xl-3 { flex: 0 0 25%; max-width: 25%; }
    .col-xl-4 { flex: 0 0 33.333%; max-width: 33.333%; }
}

/* Developer toast */
#developerToast {
    position: fixed;
    bottom: 1.5rem;
    inset-inline-end: 1.5rem;
    background: var(--primary-800);
    color: var(--white);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    transform: translateY(1rem);
    transition: all var(--dur-slow) var(--ease-out);
    pointer-events: none;
}

#developerToast.active {
    opacity: 1;
    transform: translateY(0);
}

/* Progress bar size variants */
.progress-md { height: 8px; }
.progress-sm { height: 4px; }

/* Progress group */
.progress-group { margin-bottom: 0.75rem; }
.progress-text { font-size: var(--font-size-sm); color: var(--gray-600); }

/* ============================================================
   36. ENHANCED UTILITY CLASSES
   ============================================================ */
.form-control-static {
    padding: 0.5rem 0;
    font-size: var(--font-size-base);
    color: var(--gray-800);
    min-height: 42px;
    display: flex;
    align-items: center;
}
.border { border: 1px solid var(--gray-200) !important; }
.border-top { border-top: 1px solid var(--gray-100) !important; }
.border-bottom { border-bottom: 1px solid var(--gray-100) !important; }
.border-danger { border-color: var(--danger) !important; }
.border-success { border-color: var(--success) !important; }
.border-warning { border-color: var(--warning) !important; }
.border-info { border-color: var(--info) !important; }
.bg-light { background: var(--gray-50) !important; }
.text-sm { font-size: var(--font-size-sm) !important; }
.text-xs { font-size: var(--font-size-xs) !important; }
.font-medium { font-weight: 500 !important; }

/* Table row variants — override Bootstrap */
.table-danger td { background: var(--danger-light) !important; color: var(--danger-dark) !important; }
.table-warning td { background: var(--warning-light) !important; color: var(--warning-dark) !important; }
.table-success td { background: var(--success-light) !important; color: var(--success-dark) !important; }

/* Enhanced form-select styling */
.form-select {
    display: block;
    width: 100%;
    height: 42px;
    padding: 0.5rem 2.25rem 0.5rem 0.85rem;
    font-size: var(--font-size-base);
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: all var(--dur) var(--ease-out);
    outline: none;
    appearance: none;
    cursor: pointer;
}
.form-select:hover { border-color: var(--gray-400); }
.form-select:focus {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-glow);
}
.form-select:disabled { background: var(--gray-100); color: var(--gray-500); cursor: not-allowed; }

/* ============================================================
   37. DASHBOARD — Premium Welcome & Enhanced Widgets
   ============================================================ */

/* Welcome hero section */
.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary-950) 0%, var(--primary-800) 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
    box-shadow: 0 8px 24px rgba(15, 29, 53, 0.15);
    position: relative;
    overflow: hidden;
}

.dashboard-welcome::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 600px 200px at 80% 50%, rgba(20, 184, 166, 0.08), transparent);
    pointer-events: none;
}

.dashboard-welcome::after {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-end: -40px;
    width: 200px;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.06), transparent 70%);
    pointer-events: none;
}

.welcome-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: relative;
    z-index: 1;
}

.welcome-greeting {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.welcome-clinic-name {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--white);
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.welcome-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-1);
}

.welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.75rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.welcome-badge i {
    font-size: 0.6rem;
    opacity: 0.7;
}

.welcome-license {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.welcome-license.expiring {
    color: var(--warning-light);
}

.welcome-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    position: relative;
    z-index: 1;
}

.welcome-stat {
    text-align: center;
    padding: var(--space-3) var(--space-4);
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 100px;
}

.welcome-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1;
}

.welcome-stat-label {
    font-size: 0.6rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Dashboard alert banner */
.dashboard-alert {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 500;
    animation: slideDown 0.3s var(--ease-out);
    border: 1px solid transparent;
}

.dashboard-alert i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dashboard-alert-warning {
    background: var(--warning-light);
    color: var(--warning-dark);
    border-color: #FDE68A;
}

.dashboard-alert-danger {
    background: var(--danger-light);
    color: var(--danger-dark);
    border-color: #FECACA;
}

.dashboard-alert-success {
    background: var(--success-light);
    color: var(--success-dark);
    border-color: #A7F3D0;
}

.dashboard-alert-info {
    background: var(--info-light);
    color: var(--info-dark);
    border-color: #BFDBFE;
}

.dashboard-alert .alert-close {
    margin-inline-start: auto;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.5;
    padding: 0.15rem;
    transition: opacity var(--dur) var(--ease-out);
    color: inherit;
}

.dashboard-alert .alert-close:hover { opacity: 0.8; }

/* Compliance gauge — large variant */
.compliance-ring-large {
    position: relative;
    width: 160px;
    height: 160px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.compliance-ring-large .score-value {
    position: absolute;
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
}

.compliance-ring-large .score-value sup {
    font-size: 1rem;
    font-weight: 400;
    vertical-align: super;
}

/* Score breakdown */
.score-breakdown {
    display: grid;
    gap: var(--space-3);
}

.score-breakdown-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.score-breakdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-size-sm);
}

.score-breakdown-header .sbd-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--gray-600);
    font-weight: 500;
}

.score-breakdown-header .sbd-value {
    font-weight: 600;
    color: var(--gray-800);
}

.score-breakdown-bar {
    height: 6px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.score-breakdown-bar .sbd-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s var(--ease-out);
}

/* Last calculated info */
.score-timestamp {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--gray-100);
}

/* Dashboard grid for quick items */
.dashboard-section-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-section-title i {
    font-size: 0.7rem;
    color: var(--gray-300);
}

/* Enhanced action cards */
.action-card-btn .action-badge {
    position: absolute;
    inset-block-start: -4px;
    inset-inline-end: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 0.55rem;
    font-weight: 700;
    background: var(--danger);
    color: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
}

.action-card-btn {
    position: relative;
}

/* Clinic profile card — premium */
.profile-card-header {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    padding: var(--space-5) var(--space-5);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: calc(-1.25rem) calc(-1.25rem) 0;
}

.profile-card-avatar {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--white);
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.profile-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.profile-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.2;
}

.profile-card-type {
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-card-body {
    padding-top: calc(var(--space-5) + 52px + var(--space-4));
}

/* Metric card entrance stagger */
.metric-card {
    animation: fadeInUp 0.4s var(--ease-out) both;
}

.metric-card:nth-child(1) { animation-delay: 0.05s; }
.metric-card:nth-child(2) { animation-delay: 0.1s; }
.metric-card:nth-child(3) { animation-delay: 0.15s; }
.metric-card:nth-child(4) { animation-delay: 0.2s; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Counter animation support */
.counter-value {
    display: inline-block;
}

/* Responsive dashboard */
@media (max-width: 991.98px) {
    .dashboard-welcome { padding: var(--space-5); }
    .welcome-clinic-name { font-size: 1.3rem; }
    .welcome-right { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .welcome-stat { min-width: 80px; padding: var(--space-2) var(--space-3); }
    .welcome-stat-value { font-size: 1.1rem; }
    .compliance-ring-large { width: 120px; height: 120px; }
    .compliance-ring-large .score-value { font-size: 1.6rem; }
}

@media (max-width: 767.98px) {
    .dashboard-welcome { padding: var(--space-4); flex-direction: column; align-items: flex-start; }
    .welcome-greeting { font-size: 0.65rem; }
    .welcome-clinic-name { font-size: 1.1rem; }
    .welcome-meta { font-size: var(--font-size-xs); }
    .welcome-stat { min-width: 70px; }
    .welcome-stat-value { font-size: 0.95rem; }
    .compliance-ring-large { width: 100px; height: 100px; }
    .compliance-ring-large .score-value { font-size: 1.35rem; }
    .score-breakdown { gap: var(--space-2); }
    .profile-card-header { padding: var(--space-4); }
    .profile-card-avatar { width: 42px; height: 42px; font-size: 1.1rem; }
}

@media (max-width: 575.98px) {
    .welcome-stat { min-width: calc(50% - var(--space-2)); flex: 1; }
}

/* ============================================================
   38. DOCUMENT LIBRARY — Clinic Templates & Document Registry
   ============================================================ */

/* Summary bar */
.doc-summary {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.doc-summary-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-600);
    padding: var(--space-1) var(--space-3);
    background: var(--gray-50);
    border-radius: var(--radius-full);
    border: 1px solid var(--gray-200);
}

.doc-summary-item i {
    font-size: 0.75rem;
}

.doc-summary-count {
    font-weight: 700;
    color: var(--gray-800);
}

/* Standards tabs — premium pill style */
.standards-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: var(--space-2) 0;
}

.standards-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-600);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    transition: all var(--dur) var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
}

.standards-tabs .nav-link:hover {
    border-color: var(--primary-300);
    color: var(--primary-600);
    background: var(--primary-50);
}

.standards-tabs .nav-link.active {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: var(--white);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.standards-tabs .nav-link.active:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
    color: var(--white);
}

/* Table enhancements for document registry */
.doc-title-cell {
    max-width: 360px;
}

.doc-title-en {
    font-weight: 600;
    color: var(--gray-900);
    display: block;
    line-height: 1.3;
}

.doc-title-ar {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
    display: block;
    line-height: 1.3;
    margin-top: 0.15rem;
}

.doc-expiry-cell {
    font-weight: 500;
    white-space: nowrap;
}

.doc-expiry-cell.overdue {
    color: var(--danger);
}

.doc-expiry-cell.impending {
    color: var(--warning);
}

.doc-expiry-cell.valid {
    color: var(--success);
}

.doc-expiry-relative {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 400;
    opacity: 0.7;
}

/* Action button enhancements */
.doc-action-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-500);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--dur) var(--ease-out);
    text-decoration: none;
}

.doc-action-btn:hover {
    background: var(--primary-50);
    border-color: var(--primary-400);
    color: var(--primary-600);
    box-shadow: var(--shadow-sm);
}

.doc-action-btn.download:hover {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

/* Filter toolbar refinements */
.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.filter-group .form-select-sm {
    height: 34px;
    padding: 0.2rem 2rem 0.2rem 0.65rem;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-md);
    min-width: 140px;
}

/* Responsive document library */
@media (max-width: 991.98px) {
    .doc-summary { gap: var(--space-2); }
    .doc-summary-item { font-size: var(--font-size-xs); padding: 0.15rem 0.65rem; }
}

@media (max-width: 767.98px) {
    .standards-tabs .nav-link { padding: 0.3rem 0.75rem; font-size: var(--font-size-xs); }
    .doc-title-en { font-size: var(--font-size-sm); }
    .doc-title-ar { font-size: var(--font-size-xs); }
}

@media (max-width: 575.98px) {
    .doc-summary { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   39. ACCOUNT PROFILE — User Profile Card
   ============================================================ */
.profile-avatar-xl {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.75rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.profile-header-gradient {
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-600) 100%);
    padding: var(--space-8) var(--space-6);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    text-align: center;
    margin: calc(-1.25rem) calc(-1.25rem) 0;
    position: relative;
    overflow: hidden;
}

.profile-header-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 400px 150px at 50% 0%, rgba(20, 184, 166, 0.08), transparent);
    pointer-events: none;
}

.profile-header-gradient::after {
    content: '';
    position: absolute;
    inset-block-end: 0;
    inset-inline: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.profile-header-gradient .profile-avatar-xl {
    margin: 0 auto var(--space-3);
}

.profile-name-display {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--white);
    margin: 0;
    line-height: 1.2;
}

.profile-name-ar {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.15rem;
    display: block;
}

.profile-role-badge {
    display: inline-block;
    margin-top: var(--space-2);
    padding: 0.2rem 0.85rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-section {
    padding-top: var(--space-5);
    margin-top: var(--space-4);
    border-top: 1px solid var(--gray-100);
}

.profile-section:first-of-type {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

.profile-section-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.profile-section-title i {
    color: var(--gray-300);
    font-size: 0.65rem;
}

@media (max-width: 767.98px) {
    .profile-header-gradient { padding: var(--space-6) var(--space-4); }
    .profile-avatar-xl { width: 64px; height: 64px; font-size: 1.35rem; }
    .profile-name-display { font-size: 1.1rem; }
}

/* ══════════════════════════════════════════════════════
   GLOBAL TOAST SYSTEM
   ══════════════════════════════════════════════════════ */
#globalToastContainer {
    position: fixed;
    top: 80px;
    right: 1.5rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 400px;
    width: 100%;
}

html[dir="rtl"] #globalToastContainer {
    right: auto;
    left: 1.5rem;
}

.global-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: globalToastIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    transition: opacity 0.25s ease, transform 0.25s ease;
    position: relative;
    overflow: hidden;
}

.global-toast.removing {
    opacity: 0;
    transform: translateX(24px);
}

html[dir="rtl"] .global-toast.removing {
    transform: translateX(-24px);
}

.global-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.global-toast-icon i {
    font-size: 0.95rem;
}

.global-toast-body {
    flex: 1;
    line-height: 1.4;
}

.global-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.15rem;
    font-size: 0.85rem;
    line-height: 1;
    transition: color 0.15s ease;
}

.global-toast-close:hover {
    color: #fff;
}

.global-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    transition: width linear;
}

/* Toast variants */
.global-toast-success {
    background: linear-gradient(135deg, #059669, #047857);
}

.global-toast-error {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
}

.global-toast-warning {
    background: linear-gradient(135deg, #D97706, #B45309);
}

.global-toast-info {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
}

/* Animations */
@keyframes globalToastIn {
    from {
        opacity: 0;
        transform: translateX(24px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

html[dir="rtl"] .global-toast {
    animation-name: globalToastInRtl;
}

@keyframes globalToastInRtl {
    from {
        opacity: 0;
        transform: translateX(-24px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Responsive */
@media (max-width: 767.98px) {
    #globalToastContainer {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .global-toast {
        max-width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .global-toast {
        animation: none;
    }

    .global-toast-progress {
        transition: none;
    }
}

/* ══════════════════════════════════════════════════════
   CLICKABLE TABLE ROWS
   ══════════════════════════════════════════════════════ */
.table-clickable tbody tr[data-href] {
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.table-clickable tbody tr[data-href]:hover {
    background: var(--primary-light);
}

.table-clickable tbody tr[data-href]:active {
    background: var(--primary-lighter, rgba(59, 130, 246, 0.08));
}

html[data-theme="dark"] .table-clickable tbody tr[data-href]:hover {
    background: rgba(59, 130, 246, 0.12);
}

html[data-theme="dark"] .table-clickable tbody tr[data-href]:active {
    background: rgba(59, 130, 246, 0.18);
}

.table-clickable tbody tr[data-href] td {
    position: relative;
}

.table-clickable tbody tr[data-href] td:last-child::after {
    content: '\f061';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    color: var(--gray-300);
    opacity: 0;
    transition: opacity 0.15s ease;
    margin-left: 0.5rem;
}

.table-clickable tbody tr[data-href]:hover td:last-child::after {
    opacity: 1;
}

html[dir="rtl"] .table-clickable tbody tr[data-href] td:last-child::after {
    content: '\f060';
    margin-left: 0;
    margin-right: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .table-clickable tbody tr[data-href] {
        transition: none;
    }
}

/* ══════════════════════════════════════════════════════
   GLOBAL LOADING OVERLAY
   ══════════════════════════════════════════════════════ */
#globalLoadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#globalLoadingOverlay.active {
    display: flex;
}

html[data-theme="dark"] #globalLoadingOverlay {
    background: rgba(0, 0, 0, 0.5);
}

.global-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: globalSpin 0.6s linear infinite;
}

@keyframes globalSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .global-loading-spinner {
        animation: none;
        border-top-color: var(--color-primary);
    }
}

/* ══════════════════════════════════════════════════════
   METRIC CARD TREND INDICATORS
   ══════════════════════════════════════════════════════ */
.metric-trend-icon {
    font-size: 0.6rem;
    margin-right: 0.2rem;
    vertical-align: middle;
}

html[dir="rtl"] .metric-trend-icon {
    margin-right: 0;
    margin-left: 0.2rem;
}

.metric-trend-up .metric-badge {
    background: rgba(5, 150, 105, 0.12) !important;
    color: #059669 !important;
}

.metric-trend-up .metric-value {
    color: #059669;
}

.metric-trend-down .metric-badge {
    background: rgba(220, 38, 38, 0.12) !important;
    color: #DC2626 !important;
}

.metric-trend-down .metric-value {
    color: #DC2626;
}

.metric-trend-neutral .metric-badge {
    background: rgba(107, 114, 128, 0.12) !important;
    color: #6B7280 !important;
}

html[data-theme="dark"] .metric-trend-up .metric-badge {
    background: rgba(5, 150, 105, 0.2) !important;
    color: #34D399 !important;
}

html[data-theme="dark"] .metric-trend-down .metric-badge {
    background: rgba(220, 38, 38, 0.2) !important;
    color: #F87171 !important;
}

/* ============================================================
    40. ENTERPRISE DASHBOARD — Premium Redesign
    ============================================================ */

/* ── Welcome Hero ── */
.ent-welcome {
    background: linear-gradient(135deg, var(--primary-950) 0%, var(--primary-800) 50%, var(--primary-700) 100%);
    border-radius: var(--radius-xl);
    padding: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(15, 29, 53, 0.2), 0 4px 12px rgba(15, 29, 53, 0.1);
}

.ent-welcome-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.ent-welcome-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
}

.ent-welcome-orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.12), transparent 70%);
    top: -100px;
    right: -50px;
}

.ent-welcome-orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1), transparent 70%);
    bottom: -80px;
    left: 20%;
}

.ent-welcome-orb-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.08), transparent 70%);
    top: 30%;
    left: -40px;
}

.ent-welcome-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    padding: var(--space-8);
}

.ent-welcome-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
}

.ent-welcome-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ent-welcome-label i {
    font-size: 0.75rem;
    color: var(--accent-400);
}

.ent-welcome-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--white);
    margin: 0;
    letter-spacing: -0.03em;
    line-height: 1.15;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.85) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ent-welcome-subtitle {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    line-height: 1.5;
}

.ent-welcome-subtitle strong {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
}

.ent-welcome-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-1);
}

.ent-welcome-meta .status-pill {
    font-size: 0.6rem;
    padding: 0.2rem 0.65rem;
}

.ent-welcome-license {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ent-welcome-license.expiring {
    color: var(--warning-light);
}

.ent-welcome-right {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    flex-shrink: 0;
}

.ent-welcome-score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    backdrop-filter: blur(8px);
}

.ent-welcome-gauge {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ent-welcome-gauge svg {
    width: 100%;
    height: 100%;
}

.ent-welcome-gauge-value {
    position: absolute;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--white);
    line-height: 1;
    letter-spacing: -0.02em;
}

.ent-welcome-gauge-value sup {
    font-size: 0.75rem;
    font-weight: 500;
    vertical-align: super;
}

.ent-welcome-grade {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ent-welcome-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.ent-welcome-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    min-width: 90px;
    transition: all var(--dur) var(--ease-out);
}

.ent-welcome-stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.ent-welcome-stat-num {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1;
}

.ent-welcome-stat-text {
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.2rem;
}

/* ── KPI Cards ── */
.ent-kpi-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all var(--dur) var(--ease-out);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.ent-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gray-200);
    transition: all var(--dur) var(--ease-out);
}

.ent-kpi-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--gray-300);
}

.ent-kpi-card:hover::before {
    height: 4px;
}

.ent-kpi-primary::before { background: linear-gradient(90deg, var(--primary-500), var(--primary-400)); }
.ent-kpi-success::before { background: linear-gradient(90deg, var(--success), #34D399); }
.ent-kpi-warning::before { background: linear-gradient(90deg, var(--warning), #FBBF24); }
.ent-kpi-danger::before { background: linear-gradient(90deg, var(--danger), #F87171); }
.ent-kpi-info::before { background: linear-gradient(90deg, var(--info), #60A5FA); }

.ent-kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.ent-kpi-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--dur) var(--ease-out);
}

.ent-kpi-card:hover .ent-kpi-icon-wrap {
    transform: scale(1.08);
}

.ent-kpi-primary .ent-kpi-icon-wrap { background: var(--primary-100); color: var(--primary-600); }
.ent-kpi-success .ent-kpi-icon-wrap { background: var(--success-light); color: var(--success); }
.ent-kpi-warning .ent-kpi-icon-wrap { background: var(--warning-light); color: var(--warning); }
.ent-kpi-danger .ent-kpi-icon-wrap { background: var(--danger-light); color: var(--danger); }
.ent-kpi-info .ent-kpi-icon-wrap { background: var(--info-light); color: var(--info); }

.ent-kpi-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
}

.ent-kpi-badge.complete { background: var(--success-light); color: var(--success-dark); }
.ent-kpi-badge.partial { background: var(--warning-light); color: var(--warning-dark); }
.ent-kpi-badge.non-compliant { background: var(--danger-light); color: var(--danger-dark); }

.ent-kpi-count-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    color: var(--gray-600);
}

.ent-kpi-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 0.15rem;
    letter-spacing: -0.03em;
}

.ent-kpi-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: var(--space-2);
}

.ent-kpi-progress {
    height: 4px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-3);
}

.ent-kpi-progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s var(--ease-out);
}

.ent-kpi-progress-bar.bg-success { background: var(--success); }
.ent-kpi-progress-bar.bg-warning { background: var(--warning); }
.ent-kpi-progress-bar.bg-danger { background: var(--danger); }

.ent-kpi-link {
    margin-top: auto;
    padding-top: var(--space-3);
    border-top: 1px solid var(--gray-100);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--primary-600);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    transition: all var(--dur) var(--ease-out);
}

.ent-kpi-link:hover {
    color: var(--primary-700);
    gap: 0.5rem;
}

/* ── Enterprise Panels ── */
.ent-panel {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--dur) var(--ease-out);
}

.ent-panel:hover {
    box-shadow: var(--shadow-md);
}

.ent-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ent-panel-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.ent-panel-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ent-panel-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ent-panel-icon-primary { background: var(--primary-100); color: var(--primary-600); }
.ent-panel-icon-success { background: var(--success-light); color: var(--success); }
.ent-panel-icon-warning { background: var(--warning-light); color: var(--warning); }

.ent-panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ent-panel-subtitle {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
    display: block;
    margin-top: 0.1rem;
}

.ent-panel-body {
    padding: 1.25rem;
}

/* ── Compliance Visual ── */
.ent-compliance-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.ent-compliance-ring {
    position: relative;
    width: 160px;
    height: 160px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ent-compliance-ring svg {
    width: 100%;
    height: 100%;
}

.ent-compliance-score-val {
    position: absolute;
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.ent-compliance-score-val sup {
    font-size: 1rem;
    font-weight: 500;
    vertical-align: super;
}

.ent-compliance-score-val.success { color: var(--success); }
.ent-compliance-score-val.warning { color: var(--warning); }
.ent-compliance-score-val.danger { color: var(--danger); }

.ent-compliance-grade {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.ent-grade-badge {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: var(--white);
}

.ent-grade-a { background: linear-gradient(135deg, var(--success), #34D399); }
.ent-grade-b { background: linear-gradient(135deg, var(--primary-500), var(--primary-400)); }
.ent-grade-c { background: linear-gradient(135deg, var(--warning), #FBBF24); }
.ent-grade-d { background: linear-gradient(135deg, #F97316, #FB923C); }
.ent-grade-f { background: linear-gradient(135deg, var(--danger), #F87171); }

.ent-grade-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Progress Section ── */
.ent-progress-section {
    margin-bottom: var(--space-3);
}

.ent-progress-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-600);
}

/* ── Detail List ── */
.ent-detail-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ent-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.ent-detail-row:last-child {
    border-bottom: none;
}

.ent-detail-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-500);
}

.ent-detail-label i {
    font-size: 0.75rem;
    width: 16px;
    text-align: center;
}

.ent-detail-value {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Timestamp ── */
.ent-timestamp {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--gray-100);
}

/* ── Quick Actions ── */
.ent-actions-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.ent-action-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    text-decoration: none !important;
    transition: all var(--dur) var(--ease-out);
    cursor: pointer;
}

.ent-action-item:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

html[dir="rtl"] .ent-action-item:hover {
    transform: translateX(-4px);
}

.ent-action-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: all var(--dur) var(--ease-out);
}

.ent-action-item:hover .ent-action-icon {
    transform: scale(1.1);
}

.ent-action-icon-primary { background: var(--primary-100); color: var(--primary-600); }
.ent-action-icon-success { background: var(--success-light); color: var(--success); }
.ent-action-icon-warning { background: var(--warning-light); color: var(--warning); }
.ent-action-icon-danger { background: var(--danger-light); color: var(--danger); }
.ent-action-icon-info { background: var(--info-light); color: var(--info); }

.ent-action-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ent-action-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.3;
}

.ent-action-desc {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
    line-height: 1.3;
}

.ent-action-arrow {
    font-size: 0.6rem;
    color: var(--gray-300);
    flex-shrink: 0;
    transition: all var(--dur) var(--ease-out);
}

.ent-action-item:hover .ent-action-arrow {
    color: var(--primary-500);
    transform: translateX(2px);
}

html[dir="rtl"] .ent-action-item:hover .ent-action-arrow {
    transform: translateX(-2px);
}

/* ── Profile Panel ── */
.ent-profile-panel {
    overflow: hidden;
}

.ent-profile-header {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    padding: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    position: relative;
    overflow: hidden;
}

.ent-profile-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 200px 100px at 80% 50%, rgba(20, 184, 166, 0.12), transparent);
    pointer-events: none;
}

.ent-profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--white);
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.ent-profile-info {
    position: relative;
    z-index: 1;
}

.ent-profile-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.2;
}

.ent-profile-type {
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ent-profile-body {
    padding: var(--space-4) var(--space-5);
}

.ent-profile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.ent-profile-row:last-child {
    border-bottom: none;
}

.ent-profile-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-500);
    flex-shrink: 0;
}

.ent-profile-label i {
    font-size: 0.7rem;
    width: 14px;
    text-align: center;
}

.ent-profile-value {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-800);
    text-align: end;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Standards Grid ── */
.ent-standards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.ent-standard-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-700);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    transition: all var(--dur) var(--ease-out);
}

.ent-standard-chip i {
    font-size: 0.65rem;
    color: var(--success);
}

.ent-standard-chip:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    color: var(--primary-700);
}

/* ── Enterprise Dashboard Responsive ── */
@media (max-width: 1199.98px) {
    .ent-welcome-content {
        flex-direction: column;
        align-items: stretch;
    }

    .ent-welcome-right {
        justify-content: center;
    }
}

@media (max-width: 991.98px) {
    .ent-welcome-content {
        padding: var(--space-6);
    }

    .ent-welcome-title {
        font-size: 1.4rem;
    }

    .ent-welcome-right {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .ent-welcome-gauge {
        width: 100px;
        height: 100px;
    }

    .ent-welcome-gauge-value {
        font-size: 1.3rem;
    }

    .ent-compliance-ring {
        width: 120px;
        height: 120px;
    }

    .ent-compliance-score-val {
        font-size: 1.6rem;
    }
}

@media (max-width: 767.98px) {
    .ent-welcome-content {
        padding: var(--space-4);
        gap: var(--space-4);
    }

    .ent-welcome-title {
        font-size: 1.15rem;
    }

    .ent-welcome-right {
        flex-direction: column;
        width: 100%;
    }

    .ent-welcome-score-card {
        flex-direction: row;
        gap: var(--space-3);
        width: 100%;
        padding: var(--space-3) var(--space-4);
    }

    .ent-welcome-gauge {
        width: 80px;
        height: 80px;
    }

    .ent-welcome-gauge-value {
        font-size: 1.1rem;
    }

    .ent-welcome-stats {
        flex-direction: row;
        width: 100%;
    }

    .ent-welcome-stat-item {
        flex: 1;
        min-width: 0;
        padding: var(--space-2) var(--space-3);
    }

    .ent-welcome-stat-num {
        font-size: 0.95rem;
    }

    .ent-kpi-card {
        padding: var(--space-4);
    }

    .ent-kpi-value {
        font-size: 1.5rem;
    }

    .ent-compliance-ring {
        width: 100px;
        height: 100px;
    }

    .ent-compliance-score-val {
        font-size: 1.35rem;
    }

    .ent-panel-body {
        padding: 1rem;
    }

    .ent-profile-header {
        padding: var(--space-4);
    }

    .ent-profile-body {
        padding: var(--space-3) var(--space-4);
    }

    .ent-action-item {
        padding: var(--space-2) var(--space-3);
    }

    .ent-action-icon {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
    }
}

@media (max-width: 575.98px) {
    .ent-welcome-content {
        padding: var(--space-3);
    }

    .ent-welcome-title {
        font-size: 1rem;
    }

    .ent-welcome-score-card {
        flex-direction: column;
        align-items: center;
    }

    .ent-welcome-stats {
        flex-direction: column;
    }

    .ent-welcome-stat-item {
        flex-direction: row;
        justify-content: space-between;
        padding: var(--space-2) var(--space-3);
    }

    .ent-detail-row,
    .ent-profile-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .ent-detail-value,
    .ent-profile-value {
        text-align: start;
    }
}

/* ── Dark Mode ── */
html[data-theme="dark"] .ent-welcome {
    background: linear-gradient(135deg, #0a1628 0%, #121f38 50%, #1a2d4f 100%);
}

html[data-theme="dark"] .ent-kpi-card {
    background: var(--bg-secondary, #1a1f2e);
    border-color: var(--border-color, #2a2f3e);
}

html[data-theme="dark"] .ent-kpi-card:hover {
    border-color: #3a3f4e;
}

html[data-theme="dark"] .ent-panel {
    background: var(--bg-secondary, #1a1f2e);
    border-color: var(--border-color, #2a2f3e);
}

html[data-theme="dark"] .ent-panel-header {
    border-color: var(--border-color, #2a2f3e);
}

html[data-theme="dark"] .ent-action-item {
    background: var(--bg-secondary, #1a1f2e);
    border-color: var(--border-color, #2a2f3e);
}

html[data-theme="dark"] .ent-action-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .ent-detail-row,
html[data-theme="dark"] .ent-profile-row {
    border-color: var(--border-color, #2a2f3e);
}

html[data-theme="dark"] .ent-timestamp,
html[data-theme="dark"] .ent-panel-subtitle {
    color: var(--gray-500);
}

html[data-theme="dark"] .ent-profile-header {
    background: linear-gradient(135deg, var(--primary-800), var(--primary-700));
}

html[data-theme="dark"] .ent-standard-chip {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color, #2a2f3e);
    color: var(--gray-300);
}

html[data-theme="dark"] .ent-standard-chip:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--primary-400);
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    .ent-welcome-orb { animation: none; }
    .ent-kpi-card { transition: none; }
    .ent-panel { transition: none; }
    .ent-action-item { transition: none; }
    .ent-action-item:hover { transform: none; }
    .ent-action-item:hover .ent-action-icon { transform: none; }
    .ent-action-item:hover .ent-action-arrow { transform: none; }
    .ent-kpi-card:hover { transform: none; }
}

/* ============================================================
   ACCESS DENIED (403) — Professional centered card
   ============================================================ */
.access-denied {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background-color: var(--gray-50);
    background-image:
        radial-gradient(circle at 20% 0%, rgba(59, 130, 246, 0.05), transparent 45%),
        radial-gradient(circle at 80% 100%, rgba(59, 130, 246, 0.04), transparent 45%);
}

.access-denied-card {
    width: 100%;
    max-width: 540px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: adFadeIn 0.45s var(--ease);
}

.ad-accent-bar {
    height: 5px;
    background: linear-gradient(90deg, var(--primary-700), var(--primary-500));
}

.ad-card-body {
    padding: 2.5rem 2.75rem 2rem;
    text-align: center;
}

.ad-status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ad-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background: var(--warning-light);
    color: var(--warning);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 0 0 8px rgba(217, 119, 6, 0.08);
    flex-shrink: 0;
}

.ad-status-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
}

.ad-status-code {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.ad-status-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--gray-400);
    margin-top: 0.35rem;
}

.ad-heading {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    line-height: 1.25;
}

.ad-message {
    max-width: 400px;
    margin: 0 auto 1.75rem;
    color: var(--gray-600);
    font-size: 0.975rem;
    line-height: 1.65;
}

.ad-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0 auto 1.75rem;
    max-width: 420px;
}

.ad-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.ad-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-md);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    min-width: 160px;
}

.ad-btn-primary {
    background: var(--primary-600);
    color: var(--white);
    border: 1px solid var(--primary-600);
    box-shadow: 0 8px 20px -8px rgba(45, 107, 166, 0.5);
}

.ad-btn-primary:hover {
    background: var(--primary-700);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px -8px rgba(45, 107, 166, 0.55);
}

.ad-btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.ad-btn-ghost:hover {
    background: var(--gray-50);
    color: var(--gray-900);
    border-color: var(--primary-500);
}

.ad-btn:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.ad-card-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2.75rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-150);
    color: var(--gray-500);
    font-size: 0.8rem;
    font-weight: 500;
}

.ad-card-footer i {
    color: var(--primary-600);
    opacity: 0.7;
}

@keyframes adFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* RTL: mirror the back-arrow icon */
html[dir="rtl"] .ad-back-icon {
    transform: scaleX(-1);
}

/* Responsive */
@media (max-width: 575.98px) {
    .ad-card-body {
        padding: 2rem 1.5rem 1.75rem;
    }
    .ad-card-footer,
    .ad-reference {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    .ad-status-row {
        gap: 0.75rem;
    }
    .ad-icon {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
    .ad-status-code {
        font-size: 1.5rem;
    }
    .ad-heading {
        font-size: 1.4rem;
    }
    .ad-actions {
        flex-direction: column;
    }
    .ad-btn {
        width: 100%;
    }
}
