/* ═══════════════════════════════════════════════
   DentalCare POS — Premium Dental Clinic Theme v3.0
   Glassmorphism + Premium Medical UI
   ═══════════════════════════════════════════════ */

:root {
    --primary: #0891b2;
    --primary-light: #22d3ee;
    --primary-dark: #0e7490;
    --primary-50: rgba(8, 145, 178, 0.08);
    --primary-100: rgba(8, 145, 178, 0.15);
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --purple: #8b5cf6;

    --bg: #f0f4f8;
    --bg-card: #ffffff;
    --bg-sidebar: rgba(255, 255, 255, 0.85);
    --bg-header: rgba(255, 255, 255, 0.85);
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, #0891b2 0%, #06b6d4 50%, #22d3ee 100%);
    --gradient-hero: linear-gradient(135deg, #0e7490 0%, #0891b2 30%, #06b6d4 60%, #22d3ee 100%);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: rgba(30, 41, 59, 0.9);
    --bg-header: rgba(30, 41, 59, 0.9);
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.3);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.4);
    --primary-50: rgba(8, 145, 178, 0.15);
    --primary-100: rgba(8, 145, 178, 0.25);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(51, 65, 85, 0.5);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Sidebar (Glassmorphism) ── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 20px 20px 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.3rem; font-weight: 800; color: var(--primary);
}
.sidebar-logo i { font-size: 1.5rem; }
.sidebar-close { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; margin: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary); font-weight: 500;
    transition: var(--transition); position: relative;
}
.nav-item:hover { background: var(--primary-50); color: var(--primary); transform: translateX(2px); }
.nav-item.active {
    background: var(--primary-50); color: var(--primary); font-weight: 600;
}
.nav-item.active::before {
    content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 60%; background: var(--primary); border-radius: 0 4px 4px 0;
}
.nav-item i { width: 20px; text-align: center; font-size: 1rem; }
.nav-group { margin-top: 8px; }
.nav-group-label {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.2px; color: var(--text-muted);
    padding: 12px 20px 6px; user-select: none;
}
.sidebar-footer {
    padding: 16px 20px; border-top: 1px solid var(--border);
}
.sidebar-user { display: flex; align-items: center; gap: 12px; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary-100); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.user-name { font-weight: 600; font-size: 0.85rem; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ── Top Header (Glassmorphism) ── */
.top-header {
    position: sticky; top: 0; z-index: 50;
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 1.3rem; cursor: pointer; padding: 4px; }
.breadcrumb { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 12px; }
.search-bar {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px 14px; min-width: 260px;
    transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.search-bar input {
    border: none; background: none; outline: none;
    color: var(--text); width: 100%;
}
.search-bar i { color: var(--text-muted); }
.header-icon {
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    background: none; border: 1px solid var(--border);
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); position: relative;
}
.header-icon:hover { background: var(--primary-50); color: var(--primary); border-color: var(--primary); }
.notification-badge {
    position: absolute; top: -4px; right: -4px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--danger); color: #fff;
    font-size: 0.65rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    animation: pulse 2s infinite;
}

/* ── Page Container ── */
.page-container { padding: 24px; }

/* ── Hero Banner ── */
.hero-banner {
    background: var(--gradient-hero);
    border-radius: var(--radius-xl);
    padding: 32px;
    margin-bottom: 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.hero-banner::before {
    content: ''; position: absolute; top: -50%; right: -20%; width: 400px; height: 400px;
    background: rgba(255,255,255,0.08); border-radius: 50%;
}
.hero-banner::after {
    content: ''; position: absolute; bottom: -30%; left: 10%; width: 300px; height: 300px;
    background: rgba(255,255,255,0.05); border-radius: 50%;
}
.hero-banner h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; position: relative; z-index: 1; }
.hero-banner p { opacity: 0.85; font-size: 0.9rem; position: relative; z-index: 1; }

/* ── Cards (Glassmorphism) ── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 700; }
.card-body { padding: 20px 24px; }

/* Glass Card variant */
.card-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* ── Stat Cards (Premium) ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px 24px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--gradient-primary); opacity: 0; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-card:hover::before { opacity: 1; }
.stat-icon {
    width: 52px; height: 52px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
}
.stat-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.stat-icon.green { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.stat-icon.orange { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.stat-icon.red { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.stat-icon.teal { background: rgba(8, 145, 178, 0.1); color: var(--primary); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.stat-content { flex: 1; min-width: 0; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.stat-info { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.stat-trend { font-size: 0.75rem; font-weight: 600; margin-top: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ── Tables ── */
.table-container, .table-responsive { overflow-x: auto; }
table, .data-table {
    width: 100%; border-collapse: collapse;
    font-size: 0.85rem;
}
thead, .table-light { background: var(--bg); }
th {
    padding: 12px 16px; text-align: left;
    font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    color: var(--text); vertical-align: middle;
}
tr:hover { background: var(--primary-50); }
.table-hover tr:hover { background: var(--primary-50); }
.table-striped tbody tr:nth-child(even) { background: rgba(0,0,0,0.02); }
[data-theme="dark"] .table-striped tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.table-sm td, .table-sm th { padding: 8px 12px; }
.table-actions { display: flex; gap: 6px; }
.table-wrap { overflow-x: auto; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.85rem; cursor: pointer;
    border: none; transition: var(--transition);
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(8,145,178,0.3); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-link { background: none; border: none; color: var(--primary); padding: 4px 8px; text-decoration: underline; }
.btn-link:hover { color: var(--primary-dark); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Outline buttons */
.btn-outline, .btn-outline-primary {
    background: transparent; border: 1.5px solid var(--primary);
    color: var(--primary); padding: 10px 20px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.85rem; cursor: pointer;
    transition: var(--transition); display: inline-flex; align-items: center; gap: 8px;
}
.btn-outline:hover, .btn-outline-primary:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }
.btn-outline-danger {
    background: transparent; border: 1.5px solid var(--danger);
    color: var(--danger); padding: 10px 20px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: var(--transition);
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-outline-warning {
    background: transparent; border: 1.5px solid var(--warning);
    color: var(--warning); padding: 10px 20px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: var(--transition);
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-outline-warning:hover { background: var(--warning); color: #fff; }

.btn-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); font-size: 0.8rem;
}
.btn-icon:hover { background: var(--primary-50); color: var(--primary); border-color: var(--primary); }
.btn-icon.danger:hover { background: rgba(239,68,68,0.1); color: var(--danger); border-color: var(--danger); }

/* ── Status Badges (Complete Set) ── */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-noshow { background: #f3f4f6; color: #4b5563; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-unpaid { background: #fee2e2; color: #991b1b; }
.badge-partial { background: #fef3c7; color: #92400e; }
.badge-refunded { background: #ede9fe; color: #5b21b6; }
.badge-planned { background: #dbeafe; color: #1e40af; }
.badge-ongoing { background: #fef3c7; color: #92400e; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-low { background: #fee2e2; color: #991b1b; }
.badge-ok { background: #d1fae5; color: #065f46; }

/* Generic color badges */
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f3f4f6; color: #4b5563; }
.badge-primary { background: var(--primary-100); color: var(--primary-dark); }
.badge-purple { background: #ede9fe; color: #5b21b6; }

[data-theme="dark"] .badge-pending,
[data-theme="dark"] .badge-warning { background: #78350f44; color: #fbbf24; }
[data-theme="dark"] .badge-confirmed,
[data-theme="dark"] .badge-info,
[data-theme="dark"] .badge-planned { background: #1e40af44; color: #60a5fa; }
[data-theme="dark"] .badge-completed,
[data-theme="dark"] .badge-paid,
[data-theme="dark"] .badge-active,
[data-theme="dark"] .badge-success { background: #065f4644; color: #34d399; }
[data-theme="dark"] .badge-cancelled,
[data-theme="dark"] .badge-unpaid,
[data-theme="dark"] .badge-danger { background: #991b1b44; color: #f87171; }
[data-theme="dark"] .badge-noshow,
[data-theme="dark"] .badge-secondary { background: #37415144; color: #9ca3af; }
[data-theme="dark"] .badge-ongoing,
[data-theme="dark"] .badge-partial { background: #78350f44; color: #fbbf24; }
[data-theme="dark"] .badge-refunded,
[data-theme="dark"] .badge-purple { background: #5b21b644; color: #a78bfa; }
[data-theme="dark"] .badge-primary { background: rgba(8,145,178,0.2); color: #22d3ee; }

.badge-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 10px; font-size: 0.7rem; font-weight: 700;
    background: var(--danger); color: #fff;
}

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label, .form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea,
.form-control {
    padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-card);
    color: var(--text); transition: var(--transition);
    font-size: 0.9rem; width: 100%;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-select {
    padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-card);
    color: var(--text); font-size: 0.9rem; width: 100%;
}
.form-select:focus { outline: none; border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check-input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-check-label { font-size: 0.85rem; color: var(--text); }
.form-switch { position: relative; display: inline-block; }
.form-switch .form-check-input { width: 44px; height: 24px; appearance: none; background: var(--border); border-radius: 12px; cursor: pointer; transition: var(--transition); position: relative; }
.form-switch .form-check-input:checked { background: var(--primary); }
.form-switch .form-check-input::before { content: ''; position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 50%; top: 3px; left: 3px; transition: var(--transition); }
.form-switch .form-check-input:checked::before { transform: translateX(20px); }
.required { color: var(--danger); }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200; display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 640px;
    max-height: 85vh; overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalSlideIn { from { transform: translateY(30px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px; border-radius: 50%;
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--danger); }
.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Toast ── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: toastSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 280px; max-width: 400px;
}
@keyframes toastSlide { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }
.toast-message { flex: 1; font-size: 0.85rem; }
.toast-close {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 1rem;
}

/* ── Notification Dropdown ── */
.notification-dropdown {
    position: fixed; top: 56px; right: 80px;
    width: 320px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); z-index: 150;
    display: none; max-height: 400px; overflow-y: auto;
}
.notification-dropdown.open { display: block; }
.notif-header { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.notif-header h4 { font-size: 0.9rem; font-weight: 700; }
.notif-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; border-bottom: 1px solid var(--border);
    font-size: 0.82rem; cursor: pointer;
    transition: var(--transition);
}
.notif-item:hover { background: var(--primary-50); }
.notif-item:last-child { border-bottom: none; }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }

/* ── Charts ── */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px; margin-bottom: 24px;
}
.chart-container { position: relative; height: 280px; }

/* ── Quick Actions ── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 24px;
}
.quick-action {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 16px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    cursor: pointer; transition: var(--transition);
    text-align: center; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
}
.quick-action:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.quick-action i { font-size: 1.3rem; }

/* ── Page Header ── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 1.3rem; font-weight: 800; }
.page-header-actions { display: flex; gap: 10px; align-items: center; }

/* ── Filters ── */
.filters-bar {
    display: flex; gap: 12px; align-items: center;
    flex-wrap: wrap; margin-bottom: 20px;
}
.filter-input {
    padding: 8px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-card);
    color: var(--text); font-size: 0.85rem;
    transition: var(--transition);
}
.filter-input:focus { outline: none; border-color: var(--primary); }

/* ── Empty State ── */
.empty-state {
    text-align: center; padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 0.9rem; }
.empty-row td { text-align: center; padding: 32px; color: var(--text-muted); }

/* ── Loading ── */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.spinner-border {
    display: inline-block; width: 2rem; height: 2rem;
    border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toggle Switch ── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--border); border-radius: 24px;
    transition: var(--transition);
}
.toggle-slider::before {
    content: ''; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
    transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Pagination ── */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; margin-top: 20px;
}
.pagination button, .page-btn {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 600; transition: var(--transition);
}
.pagination button:hover, .pagination button.active,
.page-btn:hover, .page-btn.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
.page-ellipsis { padding: 0 8px; color: var(--text-muted); }
.page-info { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-top: 8px; }

/* ── Section Title ── */
.section-title {
    font-size: 1rem; font-weight: 700; color: var(--text);
    margin: 8px 0 18px;
}
.page-section { margin-bottom: 24px; }

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* Bootstrap-compatible grid */
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.g-3 { gap: 16px; }
.g-4 { gap: 24px; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-md-4 { flex: 0 0 calc(33.333% - 11px); max-width: calc(33.333% - 11px); }
.col-md-6 { flex: 0 0 calc(50% - 8px); max-width: calc(50% - 8px); }
.col-md-8 { flex: 0 0 calc(66.666% - 11px); max-width: calc(66.666% - 11px); }
.col-lg-4 { flex: 0 0 calc(33.333% - 11px); max-width: calc(33.333% - 11px); }
.col-lg-6 { flex: 0 0 calc(50% - 8px); max-width: calc(50% - 8px); }
.col-lg-8 { flex: 0 0 calc(66.666% - 11px); max-width: calc(66.666% - 11px); }

/* ── Settings Grid ── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; }

/* ── Tab Navigation ── */
.tabs, .tab-nav { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
    padding: 10px 20px; background: none; border: none;
    color: var(--text-muted); font-weight: 600; font-size: 0.85rem;
    cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: var(--transition);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Sticky ── */
.sticky-top { position: sticky; top: 0; z-index: 10; }

/* ── Border Utilities ── */
.border-start { border-left: 3px solid var(--border); }
.border-primary { border-left-color: var(--primary); }
.border-success { border-left-color: var(--success); }
.border-info { border-left-color: var(--info); }
.border-warning { border-left-color: var(--warning); }
.border-4 { border-left-width: 4px; }

/* ── Background Utilities ── */
.bg-white { background: var(--bg-card); }
.bg-info { background: var(--info); color: #fff; }

/* ── Dental Chart (Odontogram) ── */
.dental-chart { margin: 20px 0; }
.dental-arch {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 20px; background: var(--bg); border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.dental-arch-row {
    display: flex; gap: 4px; justify-content: center; flex-wrap: wrap;
}
.tooth {
    width: 40px; height: 48px; border-radius: 6px;
    background: var(--bg-card); border: 2px solid var(--border);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition); position: relative;
    font-size: 0.65rem; font-weight: 600; color: var(--text-secondary);
}
.tooth:hover { border-color: var(--primary); transform: scale(1.1); box-shadow: var(--shadow-md); }
.tooth.selected { border-color: var(--primary); background: var(--primary-100); color: var(--primary); }
.tooth.treated { border-color: var(--success); background: rgba(16,185,129,0.1); }
.tooth.treated::after { content: '✓'; position: absolute; top: 2px; right: 4px; font-size: 0.6rem; color: var(--success); }
.tooth.problem { border-color: var(--danger); background: rgba(239,68,68,0.1); }
.tooth.problem::after { content: '!'; position: absolute; top: 2px; right: 4px; font-size: 0.6rem; color: var(--danger); font-weight: 800; }
.tooth-number { font-size: 0.6rem; opacity: 0.7; }
.tooth-label { font-size: 0.55rem; text-align: center; line-height: 1.1; max-width: 36px; overflow: hidden; }
.arch-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin: 8px 0 4px; }

/* ── Command Palette ── */
.cmd-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px); z-index: 400; display: none;
    align-items: flex-start; justify-content: center; padding-top: 15vh;
}
.cmd-overlay.active { display: flex; }
.cmd-palette {
    background: var(--bg-card); border-radius: var(--radius-lg);
    width: 100%; max-width: 560px; box-shadow: var(--shadow-xl);
    overflow: hidden; animation: modalSlideIn 0.2s ease;
}
.cmd-input-wrap {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.cmd-input-wrap i { color: var(--text-muted); font-size: 1.1rem; }
.cmd-input {
    flex: 1; border: none; background: none; outline: none;
    font-size: 1rem; color: var(--text);
}
.cmd-results { max-height: 320px; overflow-y: auto; }
.cmd-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; cursor: pointer; transition: var(--transition);
}
.cmd-item:hover, .cmd-item.active { background: var(--primary-50); }
.cmd-item i { width: 20px; text-align: center; color: var(--text-muted); }
.cmd-item span { font-size: 0.9rem; }
.cmd-hint { padding: 8px 20px; font-size: 0.75rem; color: var(--text-muted); border-top: 1px solid var(--border); }

/* ── Skeleton Loader ── */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm); height: 40px;
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.3s ease; }

/* ── Login Page ── */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--gradient-hero);
}
.login-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 40px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-xl);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo i { font-size: 2.5rem; color: var(--primary); }
.login-logo h1 { font-size: 1.5rem; font-weight: 800; margin-top: 8px; color: var(--text); }
.login-logo p { color: var(--text-muted); font-size: 0.85rem; }

/* ── Utility Classes ── */
.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }
.d-inline-flex { display: inline-flex; }
.d-grid { display: grid; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.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; }
.justify-content-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-start { text-align: left; }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-normal { font-weight: 400; }
.small, .text-small { font-size: 0.8rem; }
.m-0 { margin: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.ms-1 { margin-left: 4px; }
.ms-2 { margin-left: 8px; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-0 { padding: 0; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 16px; padding-right: 16px; }
.px-4 { padding-left: 24px; padding-right: 24px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.shadow-sm { box-shadow: var(--shadow); }
.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.border { border: 1px solid var(--border); }
.border-0 { border: none; }
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.error { color: var(--danger); padding: 16px; text-align: center; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: flex; }
    .main-content { margin-left: 0; }
    .hamburger { display: flex !important; }
    .search-bar { display: none; }
    .top-header { padding: 0 16px; }
    .page-container { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .charts-row { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .col-md-4, .col-md-6, .col-md-8, .col-lg-4, .col-lg-6, .col-lg-8 { flex: 0 0 100%; max-width: 100%; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .quick-actions { grid-template-columns: 1fr 1fr; }
    table, .data-table { min-width: 600px; }
    .stat-value { font-size: 1.3rem; }
    .modal { max-width: 95vw; }
    .settings-grid { grid-template-columns: 1fr; }
    .hero-banner { padding: 24px; }
    .hero-banner h2 { font-size: 1.3rem; }
    input, select, textarea { font-size: 16px !important; }
    .d-md-none { display: none; }
    .flex-md-column { flex-direction: column; }
    .cmd-palette { max-width: 95vw; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: 1fr; }
}
