/* =========================================
   Rattinan CRM - Main Stylesheet
   ========================================= */

:root {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #EEF2FF;
    --secondary: #8B5CF6;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --teal: #14B8A6;
    --pink: #EC4899;
    --orange: #F97316;

    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface2: #F1F5F9;
    --border: #E2E8F0;
    --border-light: #F1F5F9;

    --text: #0F172A;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition: all 0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Sarabun', sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* =========================================
   Layout
   ========================================= */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, #1E1B4B 0%, #312E81 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0;
    z-index: 100;
    transition: width 0.3s ease;
    overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-info,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-details { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-item i { margin: 0; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-logo {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px;
    flex-shrink: 0;
}
.brand-name { color: white; font-size: 16px; font-weight: 700; line-height: 1.2; }
.brand-mode { color: rgba(255,255,255,0.5); font-size: 11px; }

.sidebar-nav {
    flex: 1;
    padding: 16px 8px;
    overflow-y: auto;
}
.nav-section { margin-bottom: 24px; }
.nav-section-title {
    color: rgba(255,255,255,0.4);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 8px;
    margin-bottom: 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(99,102,241,0.4); }
.nav-item i { width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 13px; font-weight: 600;
    flex-shrink: 0;
}
.user-name { color: white; font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-role { color: rgba(255,255,255,0.5); font-size: 11px; }
.btn-logout {
    margin-left: auto;
    color: rgba(255,255,255,0.5);
    transition: var(--transition);
    padding: 6px;
    border-radius: 6px;
}
.btn-logout:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}
.main-content.expanded { margin-left: var(--sidebar-collapsed); }

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow);
}
.btn-menu-toggle {
    background: none; border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}
.btn-menu-toggle:hover { background: var(--surface2); }
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-date { color: var(--text-secondary); font-size: 13px; display: flex; align-items: center; gap: 6px; }

.mode-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex; align-items: center; gap: 6px;
}
.mode-badge.procedure { background: #EEF2FF; color: var(--primary); }
.mode-badge.meeting { background: #F0FDF4; color: var(--success); }

.page-content { padding: 24px; flex: 1; }

/* =========================================
   Cards
   ========================================= */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.card-header h2, .card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}
.card-body { padding: 20px; }

/* =========================================
   Stats Cards
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}
.stat-icon.purple { background: #EEF2FF; color: var(--primary); }
.stat-icon.blue { background: #EFF6FF; color: var(--info); }
.stat-icon.green { background: #ECFDF5; color: var(--success); }
.stat-icon.yellow { background: #FFFBEB; color: var(--warning); }
.stat-icon.pink { background: #FDF2F8; color: var(--pink); }
.stat-icon.teal { background: #F0FDFA; color: var(--teal); }
.stat-number { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* =========================================
   Resource Status Panel
   ========================================= */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.resource-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.resource-card-header {
    padding: 14px 16px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 13px;
}
.resource-card-body { padding: 12px 16px; }
.resource-list { list-style: none; }
.resource-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.resource-item:last-child { border-bottom: none; }
.resource-item-left { display: flex; align-items: center; gap: 8px; }

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot.available { background: var(--success); }
.status-dot.busy { background: var(--danger); animation: pulse 1.5s infinite; }
.status-dot.inactive { background: var(--text-muted); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.progress-bar-wrap {
    background: var(--surface2);
    border-radius: 10px;
    height: 6px;
    margin: 8px 0;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: var(--success);
    transition: width 0.5s ease;
}
.progress-bar-fill.busy { background: var(--danger); }

/* =========================================
   Table
   ========================================= */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    padding: 10px 14px;
    background: var(--surface2);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FAFBFF; }

/* =========================================
   Badges
   ========================================= */
.badge-role {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.bg-purple-100 { background: #EDE9FE; }
.text-purple-700 { color: #6D28D9; }
.bg-blue-100 { background: #DBEAFE; }
.text-blue-700 { color: #1D4ED8; }
.bg-yellow-100 { background: #FEF3C7; }
.text-yellow-700 { color: #B45309; }
.bg-pink-100 { background: #FCE7F3; }
.text-pink-700 { color: #BE185D; }
.bg-teal-100 { background: #CCFBF1; }
.text-teal-700 { color: #0F766E; }
.bg-gray-100 { background: #F3F4F6; }
.text-gray-700 { color: #374151; }

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.status-pending { background: #FEF3C7; color: #92400E; }
.status-confirmed { background: #DBEAFE; color: #1E40AF; }
.status-inprogress { background: #D1FAE5; color: #065F46; }
.status-completed { background: #F3F4F6; color: #374151; }
.status-cancelled { background: #FEE2E2; color: #991B1B; }

/* =========================================
   Buttons
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: 'Sarabun', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; min-width: 32px; justify-content: center; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { background: var(--surface2); }
.btn-outline-primary { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-light); }

/* =========================================
   Forms
   ========================================= */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Sarabun', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: white;
    transition: var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-control:disabled { background: var(--surface2); color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px; height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* =========================================
   Search & Filter Bar
   ========================================= */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.search-input-wrap i {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-input-wrap .form-control { padding-left: 34px; }

/* =========================================
   Modal
   ========================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-box {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}
.modal-box.modal-lg { max-width: 800px; }
.modal-box.modal-xl { max-width: 1000px; }
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.modal-header h2, .modal-header h3 { font-size: 16px; font-weight: 700; flex: 1; }
.modal-close {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-modal { max-width: 400px; text-align: center; }
.confirm-icon { font-size: 40px; color: var(--warning); margin: 20px 0 10px; }
.confirm-modal h3 { font-size: 18px; margin-bottom: 8px; }
.confirm-modal p { color: var(--text-secondary); margin-bottom: 20px; }
.confirm-modal .modal-footer { justify-content: center; }

/* =========================================
   Toast
   ========================================= */
.toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: white;
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    animation: toastIn 0.3s ease;
    font-size: 14px;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast i { font-size: 16px; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.warning i { color: var(--warning); }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* =========================================
   Page Headers
   ========================================= */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.page-header-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =========================================
   Calendar
   ========================================= */
#calendar .fc-toolbar { gap: 8px; flex-wrap: wrap; }
#calendar .fc-button {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    font-family: 'Sarabun', sans-serif !important;
    font-size: 13px !important;
}
#calendar .fc-button:hover { background: var(--primary-dark) !important; }
#calendar .fc-event {
    border-radius: 6px !important;
    border: none !important;
    font-size: 12px !important;
    cursor: pointer;
}
#calendar .fc-daygrid-event { padding: 2px 4px; }

.fc-event-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

/* =========================================
   Booking Form
   ========================================= */
.booking-steps {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.booking-step {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    background: var(--surface2);
    color: var(--text-muted);
    border-right: 1px solid var(--border);
    position: relative;
}
.booking-step:last-child { border-right: none; }
.booking-step.active { background: var(--primary); color: white; }
.booking-step.completed { background: var(--success); color: white; }
.booking-step-num {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.timeline-summary {
    background: var(--surface2);
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
}
.timeline-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    min-width: 70px;
    text-align: center;
}
.timeline-consult { background: #EDE9FE; color: #6D28D9; }
.timeline-prep { background: #FEF3C7; color: #92400E; }
.timeline-treatment { background: #DCFCE7; color: #166534; }

/* =========================================
   Color picker
   ========================================= */
.color-picker-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.color-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}
.color-dot.selected, .color-dot:hover { border-color: var(--text); transform: scale(1.15); }

/* =========================================
   Availability badge (resource)
   ========================================= */
.avail-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.avail-badge.available { background: #D1FAE5; color: #065F46; }
.avail-badge.busy { background: #FEE2E2; color: #991B1B; }
.avail-badge.inactive { background: #F3F4F6; color: #6B7280; }

/* =========================================
   Tabs
   ========================================= */
.tab-list {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    font-family: 'Sarabun', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn:hover { color: var(--primary); background: var(--primary-light); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =========================================
   Schedule / Timeline
   ========================================= */
.schedule-timeline {
    display: flex;
    gap: 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.schedule-doctor-col {
    min-width: 140px;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
}
.schedule-header-cell {
    padding: 10px 12px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

/* =========================================
   Login page
   ========================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #6366F1 100%);
    padding: 24px;
}
.login-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo-icon {
    width: 64px; height: 64px;
    background: var(--primary);
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p { color: var(--text-secondary); font-size: 13px; }
.login-error {
    background: #FEE2E2;
    color: #991B1B;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================
   Misc
   ========================================= */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.ms-auto { margin-left: auto; }
.text-center { text-align: center; }
.w-100 { width: 100%; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 15px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--surface2);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* Additional utilities */
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-col { flex-direction: column; }
.items-start { align-items: flex-start; }
.mt-1 { margin-top: 4px; }
.mt-4 { margin-top: 16px; }
.mr-2 { margin-right: 8px; }
.p-0 { padding: 0; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.rounded { border-radius: var(--radius-sm); }
.rounded-full { border-radius: 9999px; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.cursor-pointer { cursor: pointer; }

/* Alert / info boxes */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-danger { background: #FEE2E2; color: #991B1B; border-left: 4px solid var(--danger); }
.alert-success { background: #D1FAE5; color: #065F46; border-left: 4px solid var(--success); }
.alert-warning { background: #FEF3C7; color: #92400E; border-left: 4px solid var(--warning); }
.alert-info { background: #DBEAFE; color: #1E40AF; border-left: 4px solid var(--info); }

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
    .sidebar { width: var(--sidebar-collapsed); }
    .sidebar .brand-info, .sidebar .nav-item span,
    .sidebar .nav-section-title, .sidebar .user-details { display: none; }
    .sidebar .nav-item { justify-content: center; padding: 10px; }
    .sidebar .nav-item i { margin: 0; }
    .main-content { margin-left: var(--sidebar-collapsed); }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .page-content { padding: 16px; }
}