/* ==================== VARIABLES ==================== */
:root {
    --primary-color: #007AFF;
    --primary-hover: #0056CC;
    --secondary-color: #5856D6;
    --success-color: #34C759;
    --warning-color: #FF9500;
    --danger-color: #FF3B30;
    --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;
    --white: #FFFFFF;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.2s ease;
    --sidebar-width: 64px;
    --sidebar-expanded: 220px;
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
    min-height: 100vh;
}

/* ==================== LOGIN PAGE ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 48px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.login-logo p {
    color: var(--gray-500);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--white);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background: #E53E3E;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius);
}

/* ==================== LAYOUT ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== COLLAPSIBLE SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar:hover {
    width: var(--sidebar-expanded);
}

.sidebar-header {
    height: 57px;
    padding: 0 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: var(--sidebar-expanded);
    overflow: hidden;
}

/* Favicon/icon for collapsed state */
.sidebar-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    opacity: 1;
    transition: opacity 0.2s ease, transform 0.2s ease;
    position: absolute;
}

.sidebar:hover .sidebar-icon {
    opacity: 0;
    transform: scale(0.8);
}

/* Logo for expanded state */
.sidebar-logo-img {
    max-height: 36px;
    max-width: 180px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar:hover .sidebar-logo-img {
    opacity: 1;
    transform: scale(1);
}

/* Fallback text if no logo */
.sidebar-logo-fallback {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    opacity: 0;
    display: none;
    transition: opacity 0.2s ease;
}

.sidebar:hover .sidebar-logo-fallback {
    opacity: 1;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    min-width: var(--sidebar-expanded);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 4px;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.nav-item.active {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

.nav-item svg {
    width: 22px;
    height: 22px;
    min-width: 22px;
}

.nav-item span {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar:hover .nav-item span {
    opacity: 1;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid var(--gray-200);
    min-width: var(--sidebar-expanded);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* ==================== HEADER ==================== */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    height: 57px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-500);
}

.breadcrumb a {
    color: var(--gray-500);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb .current {
    color: var(--gray-900);
    font-weight: 500;
}

.breadcrumb .separator {
    color: var(--gray-300);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.user-name {
    font-weight: 500;
    font-size: 13px;
}

.user-role {
    font-size: 11px;
    color: var(--gray-500);
}

/* ==================== PAGE CONTENT ==================== */
.page-content {
    padding: 20px 24px;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: 16px;
}

/* ==================== STATS CARDS ==================== */
.stats-grid {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 10px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 12px;
    color: var(--gray-500);
}

.stat-card.primary {
    background: var(--primary-color);
}

.stat-card.primary .stat-value,
.stat-card.primary .stat-label {
    color: var(--white);
}

/* ==================== TABLE ==================== */
.table-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}

.table tbody tr {
    cursor: pointer;
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Columnas con ancho específico */
.table .col-date { width: 10%; font-size: 11px; color: var(--gray-600); }
.table .col-name { width: 20%; }
.table .col-phone { width: 12%; }
.table .col-search { width: 20%; font-size: 12px; color: var(--gray-600); }
.table .col-budget { width: 15%; font-size: 12px; color: var(--gray-600); }
.table .col-state { width: 12%; }
.table .col-wa { width: 11%; text-align: center; }

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(255, 149, 0, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger-color);
}

/* ==================== MODAL MEJORADO ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Block scroll on body when modal is open */
body.modal-open {
    overflow: hidden;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gray-50);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--gray-500);
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

/* Layout del modal con dos columnas */
.modal-layout {
    display: flex;
    min-height: 400px;
}

.modal-main {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
}

.modal-sidebar {
    width: 280px;
    background: var(--gray-50);
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    max-height: calc(85vh - 60px);
}

/* Sección de estado y comentarios en modal */
.lead-status-section {
    padding: 12px;
    background: var(--white);
    border-radius: var(--radius);
    margin-bottom: 12px;
    border: 1px solid var(--gray-200);
}

.lead-status-label {
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 600;
}

.lead-status-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.lead-status-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--white);
    cursor: pointer;
}

#save-state-btn {
    white-space: nowrap;
    transition: all 0.2s ease;
}

#save-state-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#save-state-btn.has-changes {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(52, 199, 89, 0); }
}

/* Grid de información del lead */
.lead-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.lead-info-item {
    padding: 8px 10px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.lead-info-label {
    font-size: 10px;
    color: var(--gray-500);
    margin-bottom: 2px;
    text-transform: uppercase;
    font-weight: 500;
}

.lead-info-value {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-900);
    word-break: break-word;
}

/* Sección de datos adicionales */
.lead-extra-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

.lead-extra-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 8px;
    text-transform: uppercase;
}

/* Chat de comentarios */
.comments-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.comments-header {
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.comment-item {
    margin-bottom: 12px;
}

.comment-bubble {
    background: var(--white);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.comment-author {
    font-weight: 600;
    font-size: 12px;
    color: var(--primary-color);
}

.comment-date {
    font-size: 10px;
    color: var(--gray-400);
}

.comment-text {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.4;
}

.comments-empty {
    text-align: center;
    padding: 30px 12px;
    color: var(--gray-400);
    font-size: 12px;
}

/* State change history items */
.history-item.state-change {
    margin-bottom: 12px;
}

.state-change-box {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1) 0%, rgba(52, 199, 89, 0.05) 100%);
    border: 1px solid rgba(52, 199, 89, 0.3);
    border-radius: var(--radius);
    padding: 10px 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.state-change-icon {
    font-size: 16px;
}

.state-change-content {
    flex: 1;
}

.state-change-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--success-color);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.state-change-detail {
    font-size: 12px;
    color: var(--gray-700);
}

.state-change-date {
    font-size: 10px;
    color: var(--gray-400);
    margin-top: 4px;
}

.comment-form {
    padding: 12px;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

.comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 12px;
    resize: none;
    min-height: 60px;
    margin-bottom: 8px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.comment-form .btn {
    width: 100%;
}

/* ==================== SEARCH & FILTERS ==================== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    transition: var(--transition);
    background: var(--white);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.search-box svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    width: 16px;
    height: 16px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--white);
    min-width: 150px;
}

/* Date Filter */
.date-filter {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-input {
    padding: 7px 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 12px;
    background: var(--white);
    width: 130px;
}

.date-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    padding: 12px 0;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 12px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-100);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.pagination-info {
    font-size: 13px;
    color: var(--gray-500);
    margin-right: 12px;
}

/* ==================== ALERTS ==================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-error {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(255, 59, 48, 0.2);
}

.alert-success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(52, 199, 89, 0.2);
}

/* ==================== ADMIN PANELS ==================== */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.admin-panel {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.admin-panel-header {
    padding: 14px 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-panel-header svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.admin-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
}

.admin-panel-body {
    padding: 16px;
}

.admin-panel-full {
    grid-column: span 2;
}

/* Config items dentro de paneles */
.config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.config-item:last-child {
    margin-bottom: 0;
}

.config-label {
    font-weight: 500;
    font-size: 13px;
}

.config-description {
    font-size: 12px;
    color: var(--gray-500);
}

/* ==================== WHATSAPP SECTION ==================== */
.wa-connection-box {
    text-align: center;
    padding: 20px;
}

.qr-placeholder {
    width: 180px;
    height: 180px;
    margin: 0 auto 16px;
    background: var(--gray-100);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--gray-300);
}

.qr-placeholder img {
    max-width: 100%;
    border-radius: var(--radius);
}

.wa-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    padding: 8px 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.wa-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.wa-status-dot.connected {
    background: var(--success-color);
}

.wa-status-dot.disconnected {
    background: var(--danger-color);
}

.wa-message-config {
    margin-top: 16px;
}

.wa-message-config textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
    resize: vertical;
    margin-bottom: 8px;
}

/* ==================== STATES LIST ==================== */
.states-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.state-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.state-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.state-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.state-actions {
    display: flex;
    gap: 4px;
}

/* ==================== USERS LIST ==================== */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.user-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.user-item-info {
    flex: 1;
}

.user-item-name {
    font-size: 13px;
    font-weight: 500;
}

.user-item-role {
    font-size: 11px;
    color: var(--gray-500);
}

/* ==================== SYNC LOG ==================== */
.sync-log {
    max-height: 200px;
    overflow-y: auto;
}

.sync-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 12px;
}

.sync-item:last-child {
    border-bottom: none;
}

.sync-status {
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 500;
}

.sync-status.success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
}

.sync-status.error {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger-color);
}

/* ==================== TOGGLE SWITCH ==================== */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: var(--transition);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--white);
    transition: var(--transition);
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: var(--success-color);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ==================== LOADING ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    animation: slideIn 0.3s ease;
    pointer-events: all;
    border-left: 4px solid var(--gray-400);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.info {
    border-left-color: var(--primary-color);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success-color); }
.toast.error .toast-icon { color: var(--danger-color); }
.toast.warning .toast-icon { color: var(--warning-color); }
.toast.info .toast-icon { color: var(--primary-color); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12px;
    color: var(--gray-600);
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--gray-400);
    transition: var(--transition);
}

.toast-close:hover {
    color: var(--gray-600);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-panel-full {
        grid-column: span 1;
    }

    .modal-layout {
        flex-direction: column;
    }

    .modal-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--gray-200);
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        width: var(--sidebar-expanded);
    }

    .main-content {
        margin-left: 0;
    }

    .lead-info-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: none;
    }
}
