/* ===========================================
   CallAssist — Design System (Kavkom-inspired)
   Palette: bleu marine #1B2A4A, accent #3B82F6
   Police: Inter (Google Fonts)
   =========================================== */

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

/* --- Variables CSS --- */
:root {
    --primary: #1B2A4A;
    --primary-light: #2a3f6a;
    --primary-dark: #111d36;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --accent-light: #DBEAFE;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;

    --bg-body: #E8EDF3;
    --bg-card: #FFFFFF;
    --bg-sidebar: #1B2A4A;
    --bg-topbar: #FFFFFF;
    --bg-table-header: #3B5998;

    --border-color: #D5DCE6;
    --border-light: #E8EDF3;

    --text-primary: #2D3748;
    --text-secondary: #718096;
    --text-muted: #A0AEC0;
    --text-white: #FFFFFF;

    --sidebar-width: 180px;
    --topbar-height: 50px;
    --radius: 4px;
    --radius-lg: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --transition: all 0.15s ease;
}

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

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

/* =====================
   SIDEBAR — Narrow, dark, Kavkom-style
   ===================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow: hidden;
}
.sidebar-logo {
    padding: 14px 16px;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-logo span { color: var(--accent); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.sidebar-section {
    padding: 10px 16px 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.35);
    margin-top: 4px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: rgba(255,255,255,0.65);
    transition: var(--transition);
    font-size: 0.88rem;
    font-weight: 400;
    border-left: 3px solid transparent;
    text-decoration: none;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    text-decoration: none;
}
.sidebar-link.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 500;
}
.sidebar-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}
.sidebar-link.active svg { opacity: 1; }

.sidebar-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-footer-icons {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}
.sidebar-footer-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}
.sidebar-footer-icon:hover { color: #fff; background: rgba(255,255,255,0.1); }

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}
.sidebar-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}

/* =====================
   TOPBAR — Light, with search and user
   ===================== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 90;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.topbar-tenant { font-size: 0.8rem; color: var(--text-secondary); }
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    color: var(--text-primary);
}
.topbar-user:hover { background: var(--border-light); }
.topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 5px 12px;
    min-width: 200px;
}
.topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.85rem;
    color: var(--text-primary);
    width: 100%;
}
.topbar-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

/* =====================
   MAIN CONTENT
   ===================== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 20px;
    width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - var(--topbar-height));
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.page-title svg { width: 20px; height: 20px; color: var(--accent); }

/* =====================
   CARDS — White panels with subtle borders
   ===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    background: #FAFBFC;
}
.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 16px; }

/* =====================
   STATS — Grid of stat cards
   ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 16px;
    text-align: center;
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =====================
   TABLES — Blue header, clean rows
   ===================== */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table thead th {
    background: var(--bg-table-header);
    color: var(--text-white);
    font-weight: 500;
    font-size: 0.82rem;
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
}
.table thead th:first-child { border-radius: var(--radius) 0 0 0; }
.table thead th:last-child { border-radius: 0 var(--radius) 0 0; }
.table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
    color: var(--text-primary);
}
.table tbody tr:hover { background: #F5F8FC; }
.table tbody tr:last-child td { border-bottom: none; }

/* =====================
   BADGES
   ===================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}
.badge-success { background: var(--success-light); color: #065F46; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-danger { background: var(--danger-light); color: #991B1B; }
.badge-info { background: var(--accent-light); color: #1E40AF; }
.badge-secondary { background: #E2E8F0; color: #475569; }

/* =====================
   BUTTONS — Clean, professional
   ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.88rem;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; border-color: #DC2626; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #D97706; color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-body); }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-lg { padding: 10px 20px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}
.btn-icon:hover { background: var(--bg-body); color: var(--text-primary); }

/* =====================
   FORMS — Horizontal label layout (Kavkom-style)
   ===================== */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-size: 0.85rem;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-primary);
    transition: var(--transition);
    font-size: 0.88rem;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.12);
}
.form-input:read-only { background: #F7FAFC; color: var(--text-secondary); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-error { color: var(--danger); font-size: 0.78rem; margin-top: 3px; }
.form-help { color: var(--text-muted); font-size: 0.78rem; margin-top: 3px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-actions { display: flex; gap: 8px; padding-top: 12px; }

/* Horizontal form (label left, input right) */
.form-horizontal .form-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}
.form-horizontal .form-label {
    min-width: 140px;
    text-align: right;
    margin-bottom: 0;
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;
}
.form-horizontal .form-input,
.form-horizontal .form-select {
    flex: 1;
}

.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.form-check label { font-size: 0.88rem; color: var(--text-primary); cursor: pointer; }
.form-select-sm { padding: 5px 10px; font-size: 0.82rem; min-width: 120px; }
.form-input-sm { padding: 5px 10px; font-size: 0.82rem; }

/* =====================
   ALERTS
   ===================== */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-light); color: #065F46; border-color: #A7F3D0; }
.alert-error { background: var(--danger-light); color: #991B1B; border-color: #FECACA; }
.alert-warning { background: var(--warning-light); color: #92400E; border-color: #FDE68A; }
.alert-info { background: var(--accent-light); color: #1E40AF; border-color: #BFDBFE; }

/* =====================
   TOAST NOTIFICATIONS
   ===================== */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 6px; }
.toast {
    padding: 10px 16px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    max-width: 360px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.toast-show { animation: toastIn 0.25s ease; }
.toast-hide { animation: toastOut 0.25s ease forwards; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--accent); }
.toast-close { background: none; border: none; color: #fff; cursor: pointer; font-size: 1.1rem; padding: 0 2px; opacity: 0.7; }
.toast-close:hover { opacity: 1; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(10px); } }

/* =====================
   MODAL
   ===================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal.modal-open { display: flex; }
.modal-dialog {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
}
.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 8px; }

/* =====================
   TABS
   ===================== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}
.tab {
    padding: 8px 16px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.88rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    text-decoration: none;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* =====================
   PROGRESS BAR
   ===================== */
.progress {
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.3s ease;
}
.progress-warning .progress-bar { background: var(--warning); }
.progress-danger .progress-bar { background: var(--danger); }

/* =====================
   FILTERS BAR — Like Kavkom top-right filters
   ===================== */
.filters-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #FAFBFC;
    border-bottom: 1px solid var(--border-light);
}
.filters-bar .form-select,
.filters-bar .form-input {
    min-width: 130px;
    padding: 6px 10px;
    font-size: 0.82rem;
}
.filters-bar .btn { padding: 6px 12px; font-size: 0.82rem; }

/* =====================
   PAGINATION
   ===================== */
.pagination { display: flex; gap: 3px; align-items: center; justify-content: center; margin-top: 16px; }
.pagination a, .pagination span {
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
}
.pagination a:hover { background: var(--bg-body); text-decoration: none; }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* =====================
   GRID
   ===================== */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* =====================
   TOGGLE SWITCH
   ===================== */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border-color); border-radius: 22px; transition: var(--transition); }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: var(--transition); }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* =====================
   EMPTY STATE
   ===================== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; color: var(--border-color); }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 6px; font-size: 1rem; }

/* =====================
   IMPERSONATION BANNER
   ===================== */
.impersonation-banner {
    background: var(--warning);
    color: #fff;
    text-align: center;
    padding: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 95;
}
.impersonation-banner a { color: #fff; text-decoration: underline; margin-left: 8px; }
.has-impersonation .topbar { top: 30px; }
.has-impersonation .main-content { margin-top: calc(var(--topbar-height) + 30px); }

/* =====================
   AGENT INTERFACE — Kavkom-style two-column
   ===================== */

/* Agent workspace layout */
.agent-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

/* Contact info panel (left side) */
.contact-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.contact-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.contact-panel-body { padding: 4px 0; }
.contact-panel-body .form-horizontal .form-group {
    padding: 6px 16px;
    margin-bottom: 0;
}

/* Call controls panel (right side) */
.call-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* Connection status bar */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #F7FAFC;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.status-dot.green { background: var(--success); }
.status-dot.red { background: var(--danger); }
.status-dot.orange { background: var(--warning); }
.status-dot.gray { background: var(--text-muted); }

/* Top action buttons row */
.call-actions-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}
.call-phone-display {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

/* Call control buttons row — circular icons */
.call-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}
.call-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 1.1rem;
}
.call-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}
.call-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.call-btn.call-green {
    border-color: var(--success);
    color: var(--success);
    background: var(--success-light);
}
.call-btn.call-green:hover { background: var(--success); color: #fff; }
.call-btn.call-red {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-light);
}
.call-btn.call-red:hover { background: var(--danger); color: #fff; }
.call-btn.call-orange {
    border-color: var(--warning);
    color: var(--warning);
    background: var(--warning-light);
}
.call-btn.call-orange:hover { background: var(--warning); color: #fff; }
.call-btn svg { width: 18px; height: 18px; }
.call-btn-separator {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    margin: 0 4px;
}

/* Call timer */
.call-timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    text-align: center;
}

/* Qualification bar */
.qualification-bar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}
.qualification-bar h4 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.qualification-options {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.qualification-options .form-check { margin-right: 8px; }
.qualification-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.btn-qualification {
    padding: 6px 14px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: #fff;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.btn-qualification:hover { background: var(--accent); color: #fff; }

/* Contact history section */
.contact-history {
    padding: 12px 16px;
}
.contact-history h4 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Note section */
.note-section {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}
.note-section h4 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* =====================
   AGENT STATUS BAR
   ===================== */
.agent-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.agent-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

/* =====================
   DASHBOARD — Campaign cards + Rappels (Kavkom-style)
   ===================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.campaign-card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}
.campaign-card-item:hover { background: #F5F8FC; }
.campaign-card-item:last-child { border-bottom: none; }
.campaign-card-name {
    color: var(--accent);
    font-weight: 500;
    font-size: 0.9rem;
}
.campaign-card-name:hover { text-decoration: underline; }
.campaign-card-stats {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Sort bar for campaigns */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.sort-bar a { font-weight: 500; }

/* =====================
   SUPERVISION — Agent grid
   ===================== */
.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.agent-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}
.agent-card:hover { box-shadow: var(--shadow-md); }
.agent-card .agent-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
}
.agent-card .agent-name { font-weight: 600; color: var(--text-primary); font-size: 0.88rem; }
.agent-card .agent-status-text { font-size: 0.78rem; margin-top: 3px; }
.agent-card.disponible { border-top: 3px solid var(--success); }
.agent-card.en_appel { border-top: 3px solid var(--danger); }
.agent-card.pause { border-top: 3px solid var(--warning); }
.agent-card.inactif { border-top: 3px solid var(--border-color); opacity: 0.5; }

/* =====================
   SCRIPT EDITOR
   ===================== */
.script-editor { display: flex; gap: 16px; min-height: 450px; }
.script-toolbox { width: 180px; flex-shrink: 0; }
.script-canvas {
    flex: 1;
    background: #F7FAFC;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    min-height: 450px;
}
.script-node {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
    cursor: move;
    box-shadow: var(--shadow);
}
.script-node.text { border-left: 3px solid var(--accent); }
.script-node.question { border-left: 3px solid var(--warning); }
.script-node.disposition { border-left: 3px solid var(--success); }
.script-node-title { font-weight: 600; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 6px; letter-spacing: 0.5px; }
.script-node-content { color: var(--text-primary); font-size: 0.88rem; }

/* =====================
   WebRTC INDICATOR
   ===================== */
.webrtc-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
}
.webrtc-indicator .webrtc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.webrtc-ready .webrtc-dot { background: var(--success); }
.webrtc-connecting .webrtc-dot { background: var(--warning); animation: pulse 1.5s infinite; }
.webrtc-error .webrtc-dot { background: var(--danger); }
.webrtc-label { color: var(--text-secondary); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* =====================
   PHONE DIALER (Manual dial modal)
   ===================== */
.dialer-keys {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-width: 220px;
    margin: 12px auto;
}
.dialer-key {
    width: 60px;
    height: 48px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: #fff;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.dialer-key:hover { background: var(--bg-body); }
.dialer-key.call { background: var(--success); color: #fff; border-color: var(--success); }
.dialer-key.hangup { background: var(--danger); color: #fff; border-color: var(--danger); }

/* =====================
   LOGIN PAGE
   ===================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}
.login-box {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 1.8rem; color: var(--primary); }
.login-logo h1 span { color: var(--accent); }
.login-logo p { color: var(--text-secondary); margin-top: 4px; font-size: 0.88rem; }

/* =====================
   FOOTER
   ===================== */
.page-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 40px;
}

/* =====================
   UTILITY CLASSES
   ===================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.82rem; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .topbar { left: 0; }
    .main-content { margin-left: 0; width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .agent-workspace { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .sidebar-toggle { display: block; }
}

@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .call-controls { flex-wrap: wrap; }
    .btn-group { flex-wrap: wrap; }
    .form-horizontal .form-group { flex-direction: column; }
    .form-horizontal .form-label { text-align: left; min-width: auto; }
}

/* --- Sidebar Toggle Button --- */
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--text-secondary); }
@media (max-width: 1024px) { .sidebar-toggle { display: block; } }
