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

:root {
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Brand Color Tokens */
    --brand-primary: #0284c7;
    --brand-primary-rgb: 2, 132, 199;
    --brand-primary-hover: #0369a1;
    --brand-primary-active: #075985;
    --brand-primary-light: #e0f2fe;
    --brand-secondary: #0d9488;
    --brand-accent: #3b82f6;

    /* Gradients */
    --brand-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    --brand-gradient-teal: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(37, 99, 235, 0.04) 100%);

    /* Surface & Background Tokens */
    --bg-body: #f8fafc;
    --surface-card: #ffffff;
    --surface-sidebar: #ffffff;
    --surface-topbar: rgba(255, 255, 255, 0.88);
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;

    /* Text Tokens */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px -3px rgba(2, 132, 199, 0.25);
    --card-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 6px 16px -2px rgba(15, 23, 42, 0.04);
    --card-shadow-hover: 0 16px 32px -4px rgba(2, 132, 199, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.04);

    /* Radii */
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.125rem;
    --radius-2xl: 1.5rem;
}

[data-bs-theme="dark"] {
    --bg-body: #0b111e;
    --surface-card: #131d2e;
    --surface-sidebar: #0f172a;
    --surface-topbar: rgba(15, 23, 42, 0.88);
    --border-color: #1e293b;
    --border-subtle: #162032;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --brand-primary-light: rgba(var(--brand-primary-rgb), 0.2);
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.45);
    --card-shadow-hover: 0 16px 36px -4px rgba(var(--brand-primary-rgb), 0.25);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(var(--brand-primary-rgb), 0.18) 0%, rgba(var(--brand-primary-rgb), 0.06) 100%);
}

/* ========================================================
   Dynamic Color Palettes
   ======================================================== */
/* Cyan (Default Medical) */
html[data-color-theme="cyan"], [data-color-theme="cyan"] {
    --brand-primary: #0284c7;
    --brand-primary-rgb: 2, 132, 199;
    --brand-primary-hover: #0369a1;
    --brand-primary-active: #075985;
    --brand-primary-light: #e0f2fe;
    --brand-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(37, 99, 235, 0.04) 100%);
    --bs-primary: #0284c7;
    --bs-primary-rgb: 2, 132, 199;
}

/* Emerald Teal */
html[data-color-theme="teal"], [data-color-theme="teal"] {
    --brand-primary: #0d9488;
    --brand-primary-rgb: 13, 148, 136;
    --brand-primary-hover: #0f766e;
    --brand-primary-active: #115e59;
    --brand-primary-light: #ccfbf1;
    --brand-gradient: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(13, 148, 136, 0.08) 0%, rgba(2, 132, 199, 0.04) 100%);
    --bs-primary: #0d9488;
    --bs-primary-rgb: 13, 148, 136;
}

/* Royal Indigo */
html[data-color-theme="indigo"], [data-color-theme="indigo"] {
    --brand-primary: #4f46e5;
    --brand-primary-rgb: 79, 70, 229;
    --brand-primary-hover: #4338ca;
    --brand-primary-active: #3730a3;
    --brand-primary-light: #e0e7ff;
    --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(124, 58, 237, 0.04) 100%);
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
}

/* Sapphire Blue */
html[data-color-theme="blue"], [data-color-theme="blue"] {
    --brand-primary: #2563eb;
    --brand-primary-rgb: 37, 99, 235;
    --brand-primary-hover: #1d4ed8;
    --brand-primary-active: #1e40af;
    --brand-primary-light: #dbeafe;
    --brand-gradient: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
}

/* Rose Crimson */
html[data-color-theme="rose"], [data-color-theme="rose"] {
    --brand-primary: #e11d48;
    --brand-primary-rgb: 225, 29, 72;
    --brand-primary-hover: #be123c;
    --brand-primary-active: #9f1239;
    --brand-primary-light: #ffe4e6;
    --brand-gradient: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(225, 29, 72, 0.08) 0%, rgba(244, 63, 94, 0.04) 100%);
    --bs-primary: #e11d48;
    --bs-primary-rgb: 225, 29, 72;
}

/* Luxury Violet */
html[data-color-theme="purple"], [data-color-theme="purple"] {
    --brand-primary: #9333ea;
    --brand-primary-rgb: 147, 51, 234;
    --brand-primary-hover: #7e22ce;
    --brand-primary-active: #6b21a8;
    --brand-primary-light: #f3e8ff;
    --brand-gradient: linear-gradient(135deg, #9333ea 0%, #a855f7 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(147, 51, 234, 0.08) 0%, rgba(168, 85, 247, 0.04) 100%);
    --bs-primary: #9333ea;
    --bs-primary-rgb: 147, 51, 234;
}

/* Forest Emerald */
html[data-color-theme="emerald"], [data-color-theme="emerald"] {
    --brand-primary: #059669;
    --brand-primary-rgb: 5, 150, 105;
    --brand-primary-hover: #047857;
    --brand-primary-active: #065f46;
    --brand-primary-light: #d1fae5;
    --brand-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --brand-gradient-subtle: linear-gradient(135deg, rgba(5, 150, 105, 0.08) 0%, rgba(16, 185, 129, 0.04) 100%);
    --bs-primary: #059669;
    --bs-primary-rgb: 5, 150, 105;
}

/* Color theme palette button in dropdown */
.color-swatch-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px var(--border-color);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: inline-block;
    padding: 0;
}

.color-swatch-btn:hover {
    transform: scale(1.15);
}

.color-theme-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: background-color 0.15s ease;
}

.color-theme-item:hover {
    background-color: var(--border-subtle);
}

.color-theme-item.active {
    background-color: var(--brand-primary-light);
    color: var(--brand-primary);
    font-weight: 600;
}

/* ========================================================
   Base & Typography
   ======================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
    font-weight: 700;
    color: var(--text-primary);
}

/* Smooth custom scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.55);
}

/* ========================================================
   Layout Shell: Sidebar & Topbar
   ======================================================== */
#app-shell {
    min-height: 100vh;
    background-color: var(--bg-body);
}

#app-shell aside {
    background-color: var(--surface-sidebar) !important;
    border-color: var(--border-color) !important;
    box-shadow: 1px 0 10px 0 rgba(0, 0, 0, 0.02);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1030;
}

.brand-logo-badge {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--brand-gradient);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px -1px rgba(2, 132, 199, 0.4);
    flex-shrink: 0;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.sidebar-category-header {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.75rem 0.75rem 0.25rem;
}

/* Sidebar Nav Pills */
.nav-pills .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: all 0.15s ease-in-out;
    position: relative;
}

.nav-pills .nav-link i {
    font-size: 1.05rem;
    opacity: 0.85;
    transition: transform 0.15s ease;
}

.nav-pills .nav-link:hover {
    color: var(--brand-primary);
    background-color: var(--brand-primary-light);
    transform: translateX(2px);
}

.nav-pills .nav-link:hover i {
    transform: scale(1.1);
    opacity: 1;
}

.nav-pills .nav-link.active {
    background: var(--brand-gradient);
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 4px 14px -1px rgba(2, 132, 199, 0.35);
}

.nav-pills .nav-link.active i {
    opacity: 1;
    color: #ffffff;
}

.sidebar-submenu {
    position: relative;
    padding-left: 0.75rem;
    margin-left: 1.15rem;
    border-left: 1.5px solid var(--border-color);
}

.sidebar-submenu .nav-link {
    padding: 0.35rem 0.65rem;
    font-size: 0.825rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: transparent !important;
    box-shadow: none !important;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar-submenu .nav-link:hover {
    transform: translateX(2px);
    color: var(--brand-primary) !important;
    background: rgba(var(--brand-primary-rgb), 0.06) !important;
}

.sidebar-submenu .nav-link.active,
.sidebar-submenu .nav-link.fw-bold {
    color: var(--brand-primary) !important;
    background: rgba(var(--brand-primary-rgb), 0.12) !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.chevron-rotate {
    transition: transform 0.2s ease;
}
[aria-expanded="true"] .chevron-rotate {
    transform: rotate(180deg);
}

/* Header / Topbar */
header {
    background-color: var(--surface-topbar) !important;
    border-color: var(--border-color) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.02);
}

.topbar-search {
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.25rem 0.5rem 0.25rem 0.85rem;
    transition: all 0.2s ease;
}

.topbar-search:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.15);
    background-color: var(--surface-card);
}

.topbar-search input {
    background: transparent;
    border: none;
    font-size: 0.825rem;
    color: var(--text-primary);
}

.topbar-search input:focus {
    outline: none;
    box-shadow: none;
}

.topbar-kbd {
    font-size: 0.7rem;
    font-family: inherit;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-icon-soft {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid var(--border-color);
    transition: all 0.15s ease;
}

.btn-icon-soft:hover {
    color: var(--brand-primary);
    background-color: var(--brand-primary-light);
    border-color: var(--brand-primary-light);
    transform: translateY(-1px);
}

.avatar-ring {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

/* ========================================================
   Cards & Surfaces
   ======================================================== */
.card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.15rem 1.35rem;
    font-weight: 600;
}

.card-body {
    padding: 1.35rem;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover) !important;
    border-color: rgba(var(--brand-primary-rgb), 0.3) !important;
}

/* Stat & Metric Cards */
.dash-card {
    border-radius: var(--radius-xl);
    background-color: var(--surface-card);
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease;
    overflow: hidden;
    position: relative;
}

.dash-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: background 0.2s ease;
}

.dash-card-link:hover .dash-card {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover) !important;
    border-color: rgba(var(--brand-primary-rgb), 0.35) !important;
}

.dash-card-link:hover .dash-card::before {
    background: var(--brand-gradient);
}

.dash-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.dash-card-link:hover .dash-icon {
    transform: scale(1.08) rotate(2deg);
}

/* ========================================================
   Buttons & Badges
   ======================================================== */
.btn {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-primary {
    background: var(--brand-gradient);
    border: none;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(2, 132, 199, 0.3);
}

.btn-outline-primary {
    color: var(--brand-primary);
    border-color: rgba(var(--brand-primary-rgb), 0.4);
    background-color: transparent;
}

.btn-outline-primary:hover {
    background: var(--brand-gradient);
    border-color: transparent;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background-color: var(--border-subtle);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline-danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
}

.btn-outline-danger:hover {
    background-color: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* Badges */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.35em 0.7em;
    border-radius: 9999px;
    letter-spacing: 0.01em;
}

.badge.bg-success-subtle, .badge-status-active {
    background-color: rgba(16, 185, 129, 0.12) !important;
    color: #059669 !important;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge.bg-danger-subtle, .badge-status-danger {
    background-color: rgba(239, 68, 68, 0.12) !important;
    color: #dc2626 !important;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge.bg-warning-subtle, .badge-status-warning {
    background-color: rgba(245, 158, 11, 0.12) !important;
    color: #d97706 !important;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge.bg-info-subtle, .badge-status-info {
    background-color: rgba(14, 165, 233, 0.12) !important;
    color: #0284c7 !important;
    border: 1px solid rgba(14, 165, 233, 0.25);
}

.badge.bg-primary-subtle {
    background-color: var(--brand-primary-light) !important;
    color: var(--brand-primary) !important;
    border: 1px solid rgba(var(--brand-primary-rgb), 0.25);
}

.badge.bg-secondary-subtle {
    background-color: rgba(100, 116, 139, 0.12) !important;
    color: var(--text-muted) !important;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

/* ========================================================
   Tables
   ======================================================== */
.table-responsive {
    border-radius: var(--radius-xl);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background-color: var(--border-subtle);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.95rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--brand-primary-rgb), 0.035);
}

/* ========================================================
   Forms & Inputs
   ======================================================== */
.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    padding: 0.55rem 0.85rem;
    transition: all 0.18s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface-card);
    border-color: var(--brand-primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.input-group-text {
    background-color: var(--border-subtle);
    border-color: var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* Form validation styling */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #ef4444;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ef4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ef4444' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 0.25rem rgba(239, 68, 68, 0.2);
}

.invalid-feedback {
    font-size: 0.8125rem;
    margin-top: 0.3rem;
    font-weight: 500;
    color: #ef4444;
}

/* ========================================================
   Dropdowns & Modals
   ======================================================== */
.dropdown-menu {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 0.4rem;
    animation: dropdownFadeIn 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.dropdown-item {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    transition: all 0.12s ease;
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: var(--brand-primary-light);
    color: var(--brand-primary);
}

.dropdown-item.text-danger:hover {
    background-color: rgba(239, 68, 68, 0.12);
    color: #ef4444 !important;
}

.modal-content {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* ========================================================
   Alerts & Banners
   ======================================================== */
.alert {
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.85rem 1.15rem;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: #065f46;
}

[data-bs-theme="dark"] .alert-success {
    color: #34d399;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #991b1b;
}

[data-bs-theme="dark"] .alert-danger {
    color: #f87171;
}

.alert-secondary {
    background-color: var(--border-subtle);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* ========================================================
   Pagination Styling
   ======================================================== */
.pagination svg,
nav[role="navigation"] svg {
    width: 1rem;
    height: 1rem;
    vertical-align: middle;
}

.pagination {
    margin-bottom: 0;
    gap: 0.35rem;
}

.pagination .page-item .page-link {
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    transition: all 0.15s ease;
}

.pagination .page-item .page-link:hover {
    background-color: var(--brand-primary-light);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.pagination .page-item.active .page-link {
    background: var(--brand-gradient);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.pagination .page-item.disabled .page-link {
    color: var(--text-muted);
    background-color: transparent;
    opacity: 0.5;
}

/* ========================================================
   Auth Layout & Screens (Dental Software Theme)
   ======================================================== */
.auth-wrapper {
    min-height: 100vh;
    background-color: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: 36px 36px;
    background-image: 
        linear-gradient(to right, rgba(148, 163, 184, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
    pointer-events: none;
    z-index: 1;
}

/* Animated Ambient Glow Blobs */
.animated-bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    will-change: transform;
}

.blob-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #0284c7 0%, rgba(2, 132, 199, 0.15) 70%, transparent 100%);
    top: -10%;
    left: -10%;
    animation: floatOrb1 18s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #0d9488 0%, rgba(13, 148, 136, 0.15) 70%, transparent 100%);
    bottom: -15%;
    right: -10%;
    animation: floatOrb2 22s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate;
}

.blob-3 {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, #4f46e5 0%, rgba(79, 70, 229, 0.12) 70%, transparent 100%);
    top: -5%;
    right: 15%;
    animation: floatOrb3 20s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate;
}

.blob-4 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, #06b6d4 0%, rgba(6, 182, 212, 0.15) 70%, transparent 100%);
    bottom: 5%;
    left: 20%;
    animation: floatOrb4 24s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite alternate;
}

@keyframes floatOrb1 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(120px, 80px) scale(1.15); }
    100% { transform: translate(40px, 140px) scale(0.9); }
}

@keyframes floatOrb2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-140px, -90px) scale(1.2); }
    100% { transform: translate(-70px, -150px) scale(0.95); }
}

@keyframes floatOrb3 {
    0% { transform: translate(0, 0) scale(0.95); }
    50% { transform: translate(-100px, 110px) scale(1.1); }
    100% { transform: translate(-40px, 60px) scale(1); }
}

@keyframes floatOrb4 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(100px, -80px) scale(1.18); }
    100% { transform: translate(50px, -40px) scale(0.88); }
}

/* Floating Healthcare Particles */
.floating-particle {
    position: absolute;
    color: rgba(2, 132, 199, 0.22);
    pointer-events: none;
    z-index: 1;
    animation: floatParticle 14s ease-in-out infinite;
}

.particle-1 { top: 18%; left: 8%; font-size: 1.4rem; animation-delay: 0s; }
.particle-2 { top: 72%; left: 12%; font-size: 1.6rem; animation-delay: 3s; color: rgba(13, 148, 136, 0.25); }
.particle-3 { top: 25%; right: 10%; font-size: 1.3rem; animation-delay: 1.5s; color: rgba(79, 70, 229, 0.22); }
.particle-4 { top: 80%; right: 14%; font-size: 1.5rem; animation-delay: 4.5s; color: rgba(6, 182, 212, 0.25); }
.particle-5 { top: 10%; left: 45%; font-size: 1.1rem; animation-delay: 2.2s; }

@keyframes floatParticle {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-24px) rotate(180deg);
        opacity: 0.75;
    }
}

/* ==========================================================================
   Enterprise Auth Page & Login Card Styling
   ========================================================================== */
.auth-page-body {
    background-color: #f8fafc;
    background-image: 
        radial-gradient(ellipse at 50% -10%, rgba(2, 132, 199, 0.12) 0%, transparent 60%),
        radial-gradient(circle at 10% 90%, rgba(13, 148, 136, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(37, 99, 235, 0.06) 0%, transparent 40%);
    min-height: 100vh;
}

[data-bs-theme="dark"] .auth-page-body {
    background-color: #090d16;
    background-image: 
        radial-gradient(ellipse at 50% -10%, rgba(2, 132, 199, 0.18) 0%, transparent 60%),
        radial-gradient(circle at 10% 90%, rgba(13, 148, 136, 0.1) 0%, transparent 40%);
}

.dental-login-card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    border-radius: 20px;
    box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.03) !important;
    overflow: hidden;
    width: 100%;
    max-width: 880px;
    margin: auto;
    position: relative;
    z-index: 10;
}

[data-bs-theme="dark"] .dental-login-card {
    background: #0f172a;
    border-color: #1e293b !important;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5) !important;
}

.dental-login-showcase {
    background: linear-gradient(155deg, #07192f 0%, #0a2d52 50%, #0369a1 100%);
    color: #ffffff;
    padding: 3rem 2.25rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.dental-login-showcase::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.2) 0%, transparent 70%);
}

.dental-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.75rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #38bdf8;
}

.dental-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.9rem;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.dental-feature-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(3px);
}

.dental-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25) 0%, rgba(2, 132, 199, 0.45) 100%);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #38bdf8;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-input-group {
    position: relative;
    transition: all 0.2s ease;
}

.login-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 5;
    transition: color 0.2s ease;
}

.login-form-control {
    padding: 0.75rem 1rem 0.75rem 2.85rem !important;
    font-size: 0.935rem !important;
    border-radius: 10px !important;
    border: 1.5px solid #cbd5e1 !important;
    background-color: #ffffff !important;
    color: #0f172a !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.login-form-control::placeholder {
    color: #94a3b8 !important;
    opacity: 1;
}

[data-bs-theme="dark"] .login-form-control {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.login-form-control:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.14) !important;
    background-color: #ffffff !important;
}

.login-input-group:focus-within .login-input-icon {
    color: var(--brand-primary);
}

.login-submit-btn {
    background: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.8rem 1.5rem;
    letter-spacing: -0.01em;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
    transition: all 0.2s ease;
}

.login-submit-btn:hover {
    background: linear-gradient(135deg, #0369a1 0%, #1e40af 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}

.login-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}


.login-submit-btn:hover {
    background-position: right center;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -4px rgba(2, 132, 199, 0.55);
}

.login-submit-btn:active {
    transform: translateY(0);
}

.login-submit-btn i {
    transition: transform 0.2s ease;
}

.login-submit-btn:hover i {
    transform: translateX(4px);
}

.avatar-stack {
    display: flex;
    align-items: center;
}

.avatar-stack-item {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #062038;
    margin-left: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffffff;
}

.avatar-stack-item:first-child {
    margin-left: 0;
}

.auth-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(8px);
}

/* ========================================================
   Digital Dental Chart (Treatment module)
   ======================================================== */
.tooth-healthy { fill: #ffffff; stroke: #adb5bd; }
.tooth-decay { fill: #dc3545; }
.tooth-filled { fill: #0dcaf0; }
.tooth-crown { fill: #ffc107; }
.tooth-missing { fill: #6c757d; opacity: .3; }
.tooth-rct { fill: #6610f2; }
.tooth-implant { fill: #198754; }

/* ========================================================
   Modern UI Polish & Command Palette System
   ======================================================== */

/* Quick Command Palette (Ctrl+K) */
.cmd-modal .modal-dialog {
    max-width: 620px;
    margin-top: 10vh;
}
.cmd-modal .modal-content {
    border-radius: 18px;
    border: 1px solid rgba(2, 132, 199, 0.18);
    background: var(--surface-card);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    overflow: hidden;
}
.cmd-search-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.cmd-search-input {
    border: none;
    outline: none;
    font-size: 1.05rem;
    background: transparent;
    color: var(--text-primary);
    width: 100%;
    font-weight: 500;
}
.cmd-search-input::placeholder {
    color: var(--text-muted);
}
.cmd-kbd {
    background: rgba(100, 116, 139, 0.12);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    font-family: monospace;
}
.cmd-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 12px 20px 6px;
}
.cmd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    margin: 2px 10px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}
.cmd-item:hover, .cmd-item.active {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    transform: translateX(4px);
}
.cmd-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 132, 199, 0.1);
    color: var(--brand-primary);
    margin-right: 12px;
}

/* Modern Stat & KPI Cards */
.stat-card-modern {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.stat-card-modern:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(2, 132, 199, 0.3);
}
.operatory-chair-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible !important;
    z-index: 1;
}
.operatory-chair-card:hover,
.operatory-chair-card:focus-within {
    z-index: 100;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(2, 132, 199, 0.3);
}
.operatory-chair-card .dropdown-menu {
    z-index: 1055 !important;
    min-width: 160px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
    padding: 0.35rem;
}
.operatory-chair-card .dropdown-item {
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font-weight: 500;
}
.operatory-chair-card .dropdown-item:hover {
    background-color: var(--surface-subtle);
}
.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}
.stat-badge-trend {
    font-size: 0.725rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Pulse Live Status Dot */
.pulse-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseGlow 2s infinite;
}
.pulse-indicator-warning {
    background-color: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    animation: pulseGlowWarning 2s infinite;
}
@keyframes pulseGlow {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes pulseGlowWarning {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Refined Action Buttons */
.btn-action-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.15s ease;
}
.btn-action-icon:hover {
    transform: scale(1.08);
}

/* Friendly Empty States */
.empty-state-modern {
    padding: 3rem 1.5rem;
    text-align: center;
}
.empty-state-icon-box {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

/* ========================================================
   Mobile & Tablet Comprehensive Responsive System
   ======================================================== */

/* Sidebar Offcanvas & Backdrop */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

@media (min-width: 992px) {
    .sidebar-backdrop {
        display: none !important;
    }
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.sidebar-open {
    overflow: hidden;
}

/* Modal Backdrop Refinement (Glassmorphism, Prevents Black Screen Overlay) */
.modal-backdrop {
    --bs-backdrop-bg: #0f172a;
    --bs-backdrop-opacity: 0.45;
    background-color: var(--bs-backdrop-bg) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-backdrop.show {
    opacity: var(--bs-backdrop-opacity) !important;
}

/* Prevent duplicate backdrop accumulation */
.modal-backdrop ~ .modal-backdrop {
    display: none !important;
}

#app-shell aside {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

/* Desktop Styles (>= 992px) */
@media (min-width: 992px) {
    #app-shell aside {
        position: sticky !important;
        top: 0;
        height: 100vh;
        transform: none !important;
        flex-shrink: 0;
    }
}

/* Tablet & Mobile Styles (<= 991.98px) */
@media (max-width: 991.98px) {
    #app-shell aside {
        position: fixed !important;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1050;
        width: 280px !important;
        min-width: 280px !important;
        max-width: 85vw;
        transform: translateX(-100%);
        box-shadow: none;
    }

    html[dir="rtl"] #app-shell aside {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }

    body.sidebar-open #app-shell aside {
        transform: translateX(0) !important;
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.3);
    }

    /* Topbar Layout */
    header {
        padding: 0.65rem 1rem !important;
    }

    /* Main Container Padding */
    main {
        padding: 1rem !important;
    }

    /* Tables Responsive Enhancement */
    .table-responsive {
        border-radius: var(--radius-lg);
        -webkit-overflow-scrolling: touch;
    }

    /* Card Padding */
    .card-body {
        padding: 1.25rem;
    }

    /* Nav tabs horizontal scrolling */
    .nav-tabs, .nav-pills:not(.flex-column) {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .nav-tabs::-webkit-scrollbar, .nav-pills::-webkit-scrollbar {
        height: 4px;
    }

    .nav-tabs::-webkit-scrollbar-thumb, .nav-pills::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15);
        border-radius: 4px;
    }
}

/* Small Phones & Mobile Devices (<= 575.98px) */
@media (max-width: 575.98px) {
    .font-heading {
        font-size: 1.25rem !important;
    }

    main {
        padding: 0.75rem !important;
    }

    .card-body {
        padding: 1rem;
    }

    .stat-card-modern {
        padding: 1rem !important;
    }

    .stat-icon-wrapper {
        width: 42px !important;
        height: 42px !important;
        font-size: 1.15rem !important;
    }

    /* Modals on Small Phones */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: var(--radius-lg);
    }

    .modal-body {
        padding: 1rem !important;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-footer > * {
        width: 100%;
        margin: 0 !important;
    }

    /* Buttons minimum touch target */
    .btn {
        font-size: 0.875rem;
    }

    /* Action Icon Buttons */
    .btn-action-icon {
        width: 34px;
        height: 34px;
    }

    /* Datalist & Form Controls */
    .form-control, .form-select {
        font-size: 0.95rem;
    }
}

/* ==========================================================================
   Unified Searchable Patient Combobox Component
   ========================================================================== */
.patient-combobox-wrapper {
    position: relative;
    width: 100%;
}

.patient-combobox-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.patient-combobox-input-wrap .combo-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-primary);
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 4;
}

.patient-combobox-input {
    padding-left: 38px !important;
    padding-right: 40px !important;
    border-radius: var(--radius-md) !important;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.patient-combobox-input:focus {
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}

.patient-combobox-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 4;
    transition: all 0.15s;
}

.patient-combobox-clear-btn:hover {
    color: var(--color-danger);
    background-color: rgba(239, 68, 68, 0.1);
}

.patient-combobox-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    z-index: 1065;
    padding: 4px;
    display: none;
}

.patient-combobox-dropdown.show {
    display: block;
    animation: comboFadeIn 0.15s ease-out;
}

@keyframes comboFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.patient-combo-group-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 6px 10px 4px 10px;
    background: var(--bg-body-tertiary);
    border-radius: 4px;
    margin-top: 4px;
    margin-bottom: 2px;
}

.patient-combo-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

.patient-combo-item:hover, .patient-combo-item.active {
    background-color: #f0f9ff;
}

.patient-combo-item.selected {
    background-color: #e0f2fe;
    border-left: 3px solid var(--brand-primary);
}

.patient-combo-uhid {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.78rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e0f2fe;
    color: #0369a1;
}

.patient-combo-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
}



