/* ============================================================
   ASAYE CLINIC MANAGEMENT SYSTEM - Main Stylesheet
   Premium Medical Dashboard Design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Primary Palette - Medical Blue */
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #4a90d9;
    --primary-subtle: #e8f0fe;
    --primary-gradient: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    
    /* Secondary - Teal/Green */
    --secondary: #00897b;
    --secondary-light: #4db6ac;
    --secondary-subtle: #e0f2f1;
    
    /* Accent */
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-subtle: #eef2ff;
    
    /* Status Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Neutrals */
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #1a73e8;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;
    
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
    
    /* Sidebar */
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ============================================================
   LAYOUT - Sidebar + Main
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: var(--header-height);
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(26,115,232,0.4);
}

.sidebar-brand .brand-text h5 {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    margin: 0;
    letter-spacing: -0.3px;
}

.sidebar-brand .brand-text small {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.menu-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 16px 16px 8px;
    font-weight: 600;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--text-sidebar);
    border-radius: var(--border-radius-sm);
    margin-bottom: 2px;
    transition: var(--transition);
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
}

.menu-item:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
    transform: translateX(2px);
}

.menu-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    box-shadow: 0 4px 12px rgba(26,115,232,0.3);
}

.menu-item .menu-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
    opacity: 0.8;
}

.menu-item.active .menu-icon,
.menu-item:hover .menu-icon { opacity: 1; }

.menu-item .badge {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.sidebar-user:hover { background: var(--bg-sidebar-hover); }

.sidebar-user .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-user .user-info .user-name {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

.sidebar-user .user-info .user-role {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: capitalize;
}

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: var(--transition);
}

/* HEADER */
.top-header {
    background: var(--bg-secondary);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    display: none;
}

.sidebar-toggle:hover { background: var(--bg-primary); color: var(--text-primary); }

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    background: none;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.header-btn:hover { background: var(--bg-primary); color: var(--text-primary); }

.header-btn .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 9px;
    height: 9px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.theme-toggle { cursor: pointer; }

/* CONTENT AREA */
.content-area {
    padding: 28px 32px;
}

/* ============================================================
   CARDS & STATS
   ============================================================ */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.stat-card.blue::before { background: var(--primary-gradient); }
.stat-card.green::before { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card.purple::before { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.stat-card.orange::before { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card.teal::before { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.stat-card.red::before { background: linear-gradient(135deg, #ef4444, #dc2626); }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-card.blue .stat-icon { background: var(--primary-subtle); color: var(--primary); }
.stat-card.green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.purple .stat-icon { background: var(--accent-subtle); color: var(--accent); }
.stat-card.orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.teal .stat-icon { background: var(--secondary-subtle); color: var(--secondary); }
.stat-card.red .stat-icon { background: var(--danger-light); color: var(--danger); }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-top: 4px;
}

.stat-card .stat-trend {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ============================================================
   DATA CARDS / PANELS
   ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h5 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h5 i { color: var(--primary); }

.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg-primary);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13.5px;
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--primary-subtle);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary-gradient); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; box-shadow: 0 4px 12px rgba(26,115,232,0.4); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }

.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-info { background: var(--info); color: white; }

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

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-lg { padding: 14px 28px; font-size: 15px; }

.btn-icon {
    width: 36px; height: 36px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--border-radius-sm);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { min-height: 100px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-pending { background: var(--warning-light); color: #92400e; }
.badge-confirmed { background: var(--info-light); color: #1d4ed8; }
.badge-in_progress,.badge-in-progress { background: #ede9fe; color: #6d28d9; }
.badge-completed { background: var(--success-light); color: #065f46; }
.badge-cancelled { background: var(--danger-light); color: #991b1b; }
.badge-no_show { background: #f1f5f9; color: #475569; }
.badge-paid { background: var(--success-light); color: #065f46; }
.badge-partial { background: var(--warning-light); color: #92400e; }
.badge-overdue { background: var(--danger-light); color: #991b1b; }
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-dispensed { background: var(--success-light); color: #065f46; }
.badge-ordered { background: var(--info-light); color: #1d4ed8; }
.badge-sample_collected { background: #fce7f3; color: #9d174d; }
.badge-urgent { background: var(--warning-light); color: #92400e; }
.badge-critical { background: var(--danger-light); color: #991b1b; }
.badge-normal { background: var(--success-light); color: #065f46; }

/* Role badges */
.badge-admin { background: linear-gradient(135deg,#6366f1,#8b5cf6); color: white; }
.badge-doctor { background: linear-gradient(135deg,#1a73e8,#4a90d9); color: white; }
.badge-receptionist { background: linear-gradient(135deg,#14b8a6,#0d9488); color: white; }
.badge-pharmacist { background: linear-gradient(135deg,#f59e0b,#d97706); color: white; }
.badge-lab_technician { background: linear-gradient(135deg,#ec4899,#db2777); color: white; }
.badge-patient { background: linear-gradient(135deg,#6b7280,#4b5563); color: white; }

/* ============================================================
   ALERTS / FLASH MESSAGES
   ============================================================ */
.alert {
    padding: 14px 20px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.alert-success { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }
.alert-danger,.alert-error { background: var(--danger-light); color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: var(--info-light); color: #1d4ed8; border-left: 4px solid var(--info); }

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    color: inherit;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding: 16px 0;
}

.pagination a, .pagination span {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.pagination a:hover { background: var(--primary-subtle); color: var(--primary); }
.pagination .active { background: var(--primary); color: white; }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ============================================================
   PROFILE / PATIENT VIEW
   ============================================================ */
.profile-header {
    background: var(--primary-gradient);
    border-radius: var(--border-radius);
    padding: 32px;
    color: white;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.profile-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.profile-header .profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.profile-header h3 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.profile-header p { opacity: 0.85; font-size: 14px; }

.profile-stats {
    display: flex;
    gap: 32px;
    margin-top: 20px;
}

.profile-stats .stat { text-align: center; }
.profile-stats .stat-num { font-size: 24px; font-weight: 800; }
.profile-stats .stat-text { font-size: 12px; opacity: 0.8; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.info-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item .info-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}

.info-item .info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ============================================================
   ACTIVITY / TIMELINE
   ============================================================ */
.activity-list { list-style: none; padding: 0; }

.activity-list li {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-list li:last-child { border-bottom: none; }

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.activity-dot.login { background: var(--primary); }
.activity-dot.create { background: var(--success); }
.activity-dot.update { background: var(--warning); }
.activity-dot.delete { background: var(--danger); }
.activity-dot.payment { background: var(--secondary); }

.activity-text { font-size: 13px; color: var(--text-primary); }
.activity-text .user { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h5 { font-size: 18px; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h5 { color: var(--text-secondary); font-size: 16px; margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-container {
    position: relative;
    height: 300px;
    padding: 16px;
}

/* ============================================================
   INVOICE PRINT
   ============================================================ */
.invoice-page {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 48px;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary);
}

.invoice-status {
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 8px 24px;
    border-radius: var(--border-radius-sm);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Loading spinner */
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 10px 0 40px rgba(0,0,0,0.3); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .content-area { padding: 20px 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .profile-stats { gap: 16px; }
    /* Sidebar overlay */
    .sidebar.open ~ .main-content::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }
}

@media (max-width: 768px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-card .stat-value { font-size: 22px; }
    .stat-card .stat-icon { width: 40px; height: 40px; font-size: 18px; }
    .top-header { padding: 0 16px; height: 60px; }
    .page-title { font-size: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    .card-header { padding: 16px 18px; }
    .card-body { padding: 16px 18px; }
    /* Better table on mobile */
    .table-responsive { margin: 0 -18px; padding: 0 4px; }
    .data-table td, .data-table th { padding: 10px 12px; font-size: 12.5px; }
    /* Touch-friendly buttons */
    .btn { padding: 12px 20px; min-height: 44px; }
    .btn-sm { padding: 8px 16px; min-height: 36px; }
    /* Header buttons */
    .header-btn { width: 40px; height: 40px; }
    .header-right { gap: 4px; }
    /* D-flex wrap on mobile */
    .d-flex { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
    .content-area { padding: 16px 12px; }
    .top-header { padding: 0 12px; }
    .profile-header { padding: 20px; }
    .profile-header h3 { font-size: 20px; }
    .profile-stats { flex-direction: column; gap: 12px; }
}

/* ============================================================
   NOTIFICATION BADGE
   ============================================================ */
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-secondary);
    animation: pulse 2s infinite;
    line-height: 1;
}

/* ============================================================
   PASSWORD TOGGLE
   ============================================================ */
.toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
    z-index: 2;
    transition: color 0.2s;
}
.toggle-password:hover { color: var(--primary); }

/* ============================================================
   EXPORT BAR
   ============================================================ */
.export-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn-export:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-subtle); }
.btn-export i { font-size: 14px; }

/* ============================================================
   CALENDAR ENHANCED
   ============================================================ */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
}
.cal-nav h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.cal-nav-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}
.cal-nav-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ============================================================
   SETTINGS LOGO UPLOAD
   ============================================================ */
.logo-upload-area {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 2px dashed var(--border-color);
    margin-bottom: 20px;
}
.logo-preview {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    object-fit: contain;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}
.logo-upload-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar, .top-header, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .content-area { padding: 0; }
    .card { border: none; box-shadow: none; }
    body { background: white; }
}

/* ============================================================
   GLOBAL SEARCH DROPDOWN
   ============================================================ */
.global-search {
    position: relative;
}

.search-dropdown {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.search-dropdown::-webkit-scrollbar { width: 6px; }
.search-dropdown::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

@media (max-width: 768px) {
    .global-search {
        position: static;
    }
    .global-search .form-control {
        width: 180px !important;
    }
    .search-dropdown {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: 64px !important;
        width: auto !important;
        min-width: auto !important;
    }
}

/* ============================================================
   NOTIFICATION DROPDOWN
   ============================================================ */
.notif-dropdown {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.notif-dropdown::-webkit-scrollbar { width: 6px; }
.notif-dropdown::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

@media (max-width: 768px) {
    .notif-dropdown {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: 64px !important;
        width: auto !important;
    }
}

/* ============================================================
   MENU BADGE (sidebar)
   ============================================================ */
.menu-badge {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    background: var(--danger);
    color: white;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
}

/* ============================================================
   STATS GRID (Lab module)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.stats-grid .stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: var(--transition);
}

.stats-grid .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stats-grid .stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stats-grid .stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

/* ============================================================
   GAP UTILITY (extra)
   ============================================================ */
.gap-4 { gap: 4px; }

/* ============================================================
   NOTIFICATION ITEM (notification list page)
   ============================================================ */
.notification-item {
    transition: background 0.15s ease;
}

.notification-item:hover {
    background: var(--primary-subtle) !important;
}

/* ============================================================
   DETAILS/SUMMARY for inline actions
   ============================================================ */
details summary {
    list-style: none;
}
details summary::-webkit-details-marker {
    display: none;
}
details[open] summary {
    margin-bottom: 12px;
}

/* ============================================================
   KEYBOARD SHORTCUT HINT
   ============================================================ */
.kbd-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
    padding: 2px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    font-family: 'Inter', monospace;
    font-weight: 600;
}

/* ============================================================
   DARK MODE ENHANCEMENTS
   ============================================================ */
[data-theme="dark"] .search-dropdown,
[data-theme="dark"] .notif-dropdown {
    border-color: #334155;
    background: #1e293b;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

[data-theme="dark"] .notification-item:hover {
    background: rgba(26,115,232,0.1) !important;
}

[data-theme="dark"] .primary-subtle,
[data-theme="dark"] .stats-grid .stat-card {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .logo-upload-area {
    background: rgba(255,255,255,0.03);
    border-color: #334155;
}

/* ============================================================
   SIDEBAR COLLAPSED STATE (desktop)
   ============================================================ */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .menu-label,
body.sidebar-collapsed .sidebar .user-info,
body.sidebar-collapsed .sidebar .menu-item span:not(.menu-icon),
body.sidebar-collapsed .sidebar .menu-badge {
    display: none;
}

body.sidebar-collapsed .sidebar .menu-item {
    justify-content: center;
    padding: 12px;
}

body.sidebar-collapsed .sidebar .menu-icon {
    font-size: 18px;
}

body.sidebar-collapsed .sidebar .sidebar-brand {
    justify-content: center;
    padding: 20px 12px;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar .sidebar-user {
    justify-content: center;
}

/* ============================================================
   SCROLLBAR GLOBAL
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   AI ASSISTANT PANEL — v3 modern chatbot
   ============================================================ */
.ai-assistant-shell {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1200;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ----- Floating action button ----- */
.ai-fab {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    color: #fff;
    box-shadow:
        0 14px 40px -8px rgba(99, 102, 241, 0.55),
        0 4px 14px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    font-size: 22px;
}
.ai-fab:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow:
        0 20px 48px -8px rgba(99, 102, 241, 0.65),
        0 6px 20px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.ai-fab:active { transform: translateY(0) scale(0.98); }

.ai-fab-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: inherit;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    opacity: 0.55;
    animation: aiFabPulse 2.4s ease-out infinite;
    pointer-events: none;
}
@keyframes aiFabPulse {
    0%   { transform: scale(0.95); opacity: 0.55; }
    70%  { transform: scale(1.55); opacity: 0; }
    100% { transform: scale(1.55); opacity: 0; }
}

/* ----- Panel ----- */
.ai-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 420px;
    max-width: calc(100vw - 24px);
    height: 620px;
    max-height: calc(100vh - 110px);
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 22px;
    box-shadow:
        0 30px 80px -20px rgba(15, 23, 42, 0.35),
        0 12px 30px rgba(15, 23, 42, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: translateY(8px) scale(0.96);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
}
.ai-panel.open {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
}
.ai-panel.expanded { width: 720px; height: 80vh; }

/* ----- Header ----- */
.ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #ec4899 100%);
    color: #fff;
    flex-shrink: 0;
}
.ai-panel-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ai-panel-avatar {
    width: 40px; height: 40px; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 18px;
}
.ai-panel-titles { min-width: 0; }
.ai-panel-titles h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.ai-online-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3);
    display: inline-block;
}
.ai-panel-titles p {
    margin: 1px 0 0;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.82);
}

.ai-panel-header-actions { display: flex; align-items: center; gap: 6px; }
.ai-icon-btn {
    width: 32px; height: 32px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    font-size: 13px;
}
.ai-icon-btn:hover { background: rgba(255, 255, 255, 0.24); }
.ai-icon-btn:active { transform: scale(0.92); }

/* ----- Body & messages ----- */
.ai-panel-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 200px at 100% 0%, rgba(139, 92, 246, 0.07), transparent 60%),
        radial-gradient(800px 200px at 0% 100%, rgba(236, 72, 153, 0.06), transparent 60%),
        var(--bg-card, #fff);
}
.ai-message-list {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.ai-msg {
    max-width: 90%;
    display: flex;
    gap: 9px;
    align-items: flex-start;
    animation: aiMsgIn 0.22s ease both;
}
@keyframes aiMsgIn {
    from { transform: translateY(6px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

.ai-msg-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
    margin-top: 2px;
}
.ai-msg-bubble {
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-primary, #1e293b);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.ai-msg-bubble code {
    background: rgba(99, 102, 241, 0.1);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: #4338ca;
}
.ai-msg-bubble strong { font-weight: 700; color: var(--text-primary, #0f172a); }

.ai-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg.user .ai-msg-avatar {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: #fff;
}
.ai-msg.user .ai-msg-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-bottom-right-radius: 5px;
}
.ai-msg.user .ai-msg-bubble code {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.ai-msg.assistant { align-self: flex-start; }
.ai-msg.assistant .ai-msg-avatar {
    background: linear-gradient(135deg, #10b981, #06b6d4);
    color: #fff;
}
.ai-msg.assistant .ai-msg-bubble {
    background: var(--bg-hover, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    border-bottom-left-radius: 5px;
}
.ai-msg.error .ai-msg-bubble {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #b91c1c;
}

/* Typing indicator */
.ai-msg.loading .ai-msg-bubble {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}
.ai-thinking-dots { display: inline-flex; gap: 4px; }
.ai-thinking-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    animation: aiDot 1.1s infinite ease-in-out;
}
.ai-thinking-dots span:nth-child(2) { animation-delay: 0.16s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes aiDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ----- Rich result cards ----- */
.ai-card {
    margin-top: 8px;
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12.5px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.ai-card-title {
    display: flex; align-items: center; gap: 6px;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.ai-card-title i { color: #6366f1; }
.ai-card-row {
    display: flex; justify-content: space-between; gap: 8px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border-color, #e2e8f0);
}
.ai-card-row:last-child { border-bottom: 0; }
.ai-card-row .lbl { color: var(--text-muted, #64748b); font-weight: 500; }
.ai-card-row .val { color: var(--text-primary, #0f172a); font-weight: 600; text-align: right; }

.ai-card-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ai-card-table th, .ai-card-table td {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.ai-card-table th {
    color: var(--text-muted, #64748b);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.04);
}
.ai-card-table tr:last-child td { border-bottom: 0; }
.ai-card-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
}
.ai-card-pill.green  { background: rgba(34,197,94,0.15);  color: #15803d; }
.ai-card-pill.amber  { background: rgba(245,158,11,0.15); color: #b45309; }
.ai-card-pill.red    { background: rgba(239,68,68,0.15);  color: #b91c1c; }
.ai-card-pill.blue   { background: rgba(59,130,246,0.15); color: #1d4ed8; }
.ai-card-pill.gray   { background: rgba(100,116,139,0.15); color: #475569; }

/* ----- Suggestion chips ----- */
.ai-suggestion-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-card, #fff);
    max-height: 100px;
    overflow-y: auto;
    flex-shrink: 0;
}
.ai-suggestion-list:empty { display: none; }
.ai-suggestion-chip {
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-card, #fff);
    color: var(--text-primary, #0f172a);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11.5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ai-suggestion-chip:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}
.ai-suggestion-chip i { font-size: 10px; opacity: 0.7; }

/* ----- Footer (input + confirm) ----- */
.ai-panel-footer {
    border-top: 1px solid var(--border-color, #e2e8f0);
    padding: 10px 12px 12px;
    background: var(--bg-card, #fff);
    flex-shrink: 0;
}
.ai-confirm-row {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: #92400e;
    flex-wrap: wrap;
}
.ai-confirm-row[hidden] { display: none !important; }
.ai-confirm-row > i { font-size: 16px; color: #f59e0b; }
.ai-confirm-row > span { flex: 1; min-width: 100px; font-weight: 500; }
.ai-confirm-actions { display: flex; gap: 6px; }
.ai-confirm-yes, .ai-confirm-no {
    border-radius: 9px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}
.ai-confirm-yes {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 10px rgba(16,185,129,0.32);
}
.ai-confirm-yes:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(16,185,129,0.42); }
.ai-confirm-no {
    background: var(--bg-card, #fff);
    color: var(--text-secondary, #475569);
    border: 1px solid var(--border-color, #e2e8f0);
}
.ai-confirm-no:hover { border-color: #ef4444; color: #ef4444; }

.ai-command-form {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
}
.ai-command-form input {
    width: 100%;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 13.5px;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #0f172a);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.ai-command-form input::placeholder { color: var(--text-muted, #94a3b8); }
.ai-command-form input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ai-inline-btn, .ai-send-btn {
    border: 0;
    width: 40px; height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.ai-inline-btn {
    background: var(--bg-hover, #f1f5f9);
    color: var(--text-secondary, #475569);
    border: 1px solid var(--border-color, #e2e8f0);
}
.ai-inline-btn:hover { color: #6366f1; border-color: #6366f1; }
.ai-inline-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border-color: #dc2626;
    animation: aiRecPulse 1.2s infinite;
}
@keyframes aiRecPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.ai-send-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.ai-send-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99, 102, 241, 0.42); }
.ai-send-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ----- Empty state / welcome ----- */
.ai-empty-state {
    text-align: center;
    padding: 30px 16px 14px;
    color: var(--text-muted, #64748b);
}
.ai-empty-state .ico {
    width: 56px; height: 56px;
    margin: 0 auto 12px;
    border-radius: 18px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px;
    box-shadow: 0 10px 24px -8px rgba(99,102,241,0.45);
}
.ai-empty-state h5 { font-size: 14px; font-weight: 700; color: var(--text-primary, #0f172a); margin: 0 0 4px; }
.ai-empty-state p  { font-size: 12px; margin: 0; line-height: 1.5; }

/* ----- Dark mode ----- */
[data-theme="dark"] .ai-panel { border-color: #334155; }
[data-theme="dark"] .ai-panel-body { background: var(--bg-card); }
[data-theme="dark"] .ai-msg.assistant .ai-msg-bubble { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .ai-card { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .ai-card-title { color: #e2e8f0; }
[data-theme="dark"] .ai-card-row .val { color: #e2e8f0; }
[data-theme="dark"] .ai-card-table th { background: rgba(99,102,241,0.12); color: #94a3b8; }
[data-theme="dark"] .ai-card-table th, [data-theme="dark"] .ai-card-table td { border-color: #334155; }
[data-theme="dark"] .ai-suggestion-list, [data-theme="dark"] .ai-panel-footer { background: var(--bg-card); }
[data-theme="dark"] .ai-suggestion-chip { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .ai-command-form input { background: #0f172a; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .ai-inline-btn { background: #1e293b; border-color: #334155; color: #94a3b8; }

/* ----- Mobile ----- */
@media (max-width: 640px) {
    .ai-assistant-shell { right: 14px; bottom: 14px; }
    .ai-fab { width: 54px; height: 54px; font-size: 19px; }
    .ai-panel {
        width: calc(100vw - 28px);
        height: calc(100vh - 100px);
        bottom: 70px;
    }
    .ai-panel.expanded { width: calc(100vw - 28px); height: calc(100vh - 100px); }
}
