:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --primary-bg: #EEF2FF;
    --accent: #06B6D4;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --sidebar-width: 280px;
    --topbar-height: 60px;
    --radius: 12px;
    --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 -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);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== AUTH PAGES ===== */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 50%, #C7D2FE 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79,70,229,0.08) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    animation: floatBg 15s ease-in-out infinite;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6,182,212,0.06) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    animation: floatBg 12s ease-in-out infinite reverse;
}

@keyframes floatBg {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.auth-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 14px rgba(79,70,229,0.3);
}

.auth-logo .logo-icon i {
    font-size: 28px;
    color: white;
}

.auth-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.auth-logo h1 span {
    color: var(--primary);
}

.auth-logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 4px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 20px;
}

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

.input-wrapper {
    position: relative;
}

.input-wrapper i.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 16px;
    transition: var(--transition);
}

.input-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: var(--transition);
    outline: none;
    font-family: inherit;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}

.input-wrapper input:focus + i.input-icon,
.input-wrapper input:focus ~ i.input-icon {
    color: var(--primary);
}

.input-wrapper .toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: var(--transition);
}

.input-wrapper .toggle-password:hover {
    color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(79,70,229,0.4);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-primary .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto;
}

.btn-primary.loading .btn-text { display: none; }
.btn-primary.loading .spinner { display: inline-block; }

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

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--gray-500);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.auth-footer a:hover {
    color: var(--primary-dark);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 20px;
    display: none;
    animation: shakeIn 0.4s ease;
}

.alert-danger {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

.alert-success {
    background: #F0FDF4;
    color: #16A34A;
    border: 1px solid #BBF7D0;
}

@keyframes shakeIn {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ===== DASHBOARD LAYOUT ===== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.sidebar-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-header .brand-icon i {
    font-size: 20px;
    color: white;
}

.sidebar-header .brand-text h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

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

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.nav-item.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-100);
}

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

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

.user-details {
    flex: 1;
    min-width: 0;
}

.user-details .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details .phone {
    font-size: 11px;
    color: var(--gray-400);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
    font-size: 16px;
}

.btn-logout:hover {
    background: #FEF2F2;
    color: var(--danger);
}

/* Main Content */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--gray-600);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
}

.topbar-toggle:hover {
    background: var(--gray-100);
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Sidebar overlay for mobile */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ===== CHAT INTERFACE ===== */

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-height));
    background: var(--gray-50);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: messageIn 0.3s ease;
}

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

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-message.assistant .avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.chat-message.user .avatar {
    background: var(--gray-200);
    color: var(--gray-600);
}

.chat-message .bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.chat-message.assistant .bubble {
    background: white;
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 4px;
}

.chat-message.user .bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 16px 24px 24px;
    background: white;
    border-top: 1px solid var(--gray-200);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    max-width: 800px;
    margin: 0 auto;
}

.chat-input-wrapper textarea {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    min-height: 44px;
    transition: var(--transition);
    background: var(--gray-50);
    color: var(--gray-800);
}

.chat-input-wrapper textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}

/* ===== WIZARD TOPBAR ===== */

.wizard-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.wizard-select-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.wizard-select-wrap:focus-within {
    border-color: var(--primary);
    background: white;
}

.wizard-select-icon {
    padding: 0 12px;
    color: var(--primary);
    font-size: 16px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    background: transparent;
}

.wizard-select {
    flex: 1;
    border: none;
    background: transparent;
    padding: 9px 10px 9px 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-800);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.wizard-topbar-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.wizard-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1.5px solid var(--gray-200);
    background: var(--gray-50);
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s;
}

.wizard-action-btn:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.chat-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    color: var(--gray-500);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-attach-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(79,70,229,0.4);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-indicator.show { display: flex; }

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ===== CARDS & COMPONENTS ===== */

.card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 24px;
    transition: var(--transition);
}

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

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

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
}

.employee-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.employee-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: var(--transition);
}

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

.employee-card:hover::before {
    opacity: 1;
}

.employee-card .emp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.employee-card .emp-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-bg), var(--primary-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary);
}

.employee-card .emp-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
}

.employee-card .emp-role {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.employee-card .emp-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--gray-300); }
.status-dot.connected { background: var(--success); animation: pulse 2s infinite; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
    text-decoration: none;
}

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

.btn-indigo {
    background: var(--primary);
    color: white;
}
.btn-indigo:hover { background: var(--primary-dark); }

.btn-outline {
    background: white;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

.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-ghost {
    background: transparent;
    color: var(--gray-600);
    padding: 8px;
    border-radius: 8px;
}
.btn-ghost:hover { background: var(--gray-100); }

/* QR Code Section */

.qr-container {
    text-align: center;
    padding: 24px;
}

.qr-image {
    width: 280px;
    height: 280px;
    margin: 16px auto;
    background: white;
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.qr-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-timer {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.qr-timer .countdown {
    font-weight: 700;
    color: var(--primary);
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.qr-instructions {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 16px;
    line-height: 1.6;
}

.qr-instructions ol {
    text-align: left;
    display: inline-block;
    padding-left: 20px;
}

/* Knowledge Base */

.kb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.kb-item:hover {
    background: var(--gray-100);
}

.kb-item .kb-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.kb-item .kb-info {
    flex: 1;
    min-width: 0;
}

.kb-item .kb-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

.kb-item .kb-date {
    font-size: 12px;
    color: var(--gray-400);
}

/* Empty States */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto 20px;
}

/* Modal */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-xl);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-body {
    padding: 24px;
}

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

/* Tabs */

.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
    gap: 4px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    font-family: inherit;
    border-radius: 8px 8px 0 0;
}

.tab-btn:hover {
    color: var(--gray-700);
    background: var(--gray-50);
}

.tab-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.tab-content {
    display: none;
}

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

/* Settings form */

.settings-form .form-group {
    margin-bottom: 24px;
}

.settings-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.settings-form input,
.settings-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    background: var(--gray-50);
}

.settings-form input:focus,
.settings-form textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}

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

.settings-form .help-text {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* Toast */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 3s forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--primary); color: white; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

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

/* WhatsApp connected badge */

.wa-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.wa-badge.connected {
    background: #ECFDF5;
    color: #059669;
}

.wa-badge.disconnected {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* Conversation list */

.conv-list {
    max-height: 400px;
    overflow-y: auto;
}

.conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.conv-item:hover, .conv-item.active {
    background: var(--gray-100);
}

.conv-item .conv-avatar {
    width: 40px;
    height: 40px;
    background: var(--gray-200);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-size: 16px;
    flex-shrink: 0;
}

.conv-item .conv-info {
    flex: 1;
    min-width: 0;
}

.conv-item .conv-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
}

.conv-item .conv-preview {
    font-size: 12px;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Stats cards */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.stat-icon.purple { background: #EEF2FF; color: var(--primary); }
.stat-icon.green { background: #ECFDF5; color: var(--success); }
.stat-icon.blue { background: #EFF6FF; color: var(--accent); }
.stat-icon.orange { background: #FFF7ED; color: var(--warning); }

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
}

/* Scrollbar */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ===== RESPONSIVE ===== */

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .topbar-toggle {
        display: flex;
    }
}

@media (max-width: 767px) {
    .auth-card {
        padding: 32px 24px;
    }

    .auth-card .input-wrapper input,
    .auth-card .input-wrapper select {
        font-size: 16px;
    }

    .content-area {
        padding: 16px;
    }

    .chat-messages {
        padding: 12px;
    }

    .chat-message {
        max-width: 92%;
    }

    .employees-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 0;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 12px;
        white-space: nowrap;
    }

    .modal-footer {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
        min-width: 100px;
        text-align: center;
    }

    .modal-content {
        margin: 10px;
        max-width: calc(100vw - 20px);
        border-radius: 14px;
    }

    .modal-body {
        padding: 16px;
    }

    .qr-image {
        width: 100%;
        max-width: 260px;
        height: auto;
        aspect-ratio: 1;
    }

    .wizard-topbar {
        padding: 8px 10px;
        gap: 6px;
    }

    .wizard-select {
        font-size: 12px;
        padding: 7px 8px 7px 0;
    }

    .wizard-select-icon {
        padding: 0 8px;
        font-size: 14px;
    }

    .wizard-action-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .chat-input-wrapper {
        gap: 6px;
    }

    .chat-input-wrapper textarea {
        padding: 10px 12px;
        font-size: 14px;
    }

    .chat-attach-btn {
        width: 34px;
        height: 34px;
    }

    .chat-send-btn {
        width: 34px;
        height: 34px;
    }

    .toast-container {
        top: auto;
        bottom: 16px;
        right: 12px;
        left: 12px;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }
}

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

    .topbar {
        padding: 0 12px;
    }

    .topbar-title {
        font-size: 15px;
    }

    .content-area {
        padding: 12px;
    }
}

/* Page transitions */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}
