/* ===========================================
   CallAssist — Design System « Pro & épuré »
   Neutres slate · accent indigo unique · Inter
   Refonte 2026-06-24
   =========================================== */

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

/* --- Design tokens --- */
:root {
    /* Neutres (slate, légèrement froids — jamais de gris pur) */
    --gray-50:  #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E7ECF2;
    --gray-300: #D4DBE4;
    --gray-400: #9AA6B6;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* Accent unique — indigo sobre */
    --accent:       #4F46E5;
    --accent-hover: #4338CA;
    --accent-active:#3730A3;
    --accent-soft:  #EEF0FE;
    --accent-soft-2:#E0E3FB;
    --accent-ring:  rgba(79, 70, 229, 0.30);
    --accent-light: var(--accent-soft);   /* alias compat */

    /* Sémantique (désaturée) */
    --success: #059669; --success-soft: #ECFDF5; --success-text: #065F46; --success-light: var(--success-soft);
    --warning: #D97706; --warning-soft: #FFF8EB; --warning-text: #92400E; --warning-light: var(--warning-soft);
    --danger:  #DC2626; --danger-soft:  #FEF2F2; --danger-text:  #991B1B; --danger-light:  var(--danger-soft);
    --info:    var(--accent); --info-soft: var(--accent-soft); --info-light: var(--accent-soft);

    /* Surfaces */
    --bg-body:     #F4F6F9;
    --bg-card:     #FFFFFF;
    --bg-subtle:   var(--gray-50);
    --bg-sidebar:  #0B1220;
    --bg-topbar:   rgba(255, 255, 255, 0.85);

    --border-color: var(--gray-200);
    --border-light: var(--gray-100);
    --border-strong:var(--gray-300);

    /* Texte */
    --text-primary:   var(--gray-800);
    --text-secondary: var(--gray-500);
    --text-muted:     var(--gray-400);
    --text-white:     #FFFFFF;

    /* Marque (compat anciens noms) */
    --primary:       var(--gray-900);
    --primary-light: var(--gray-800);
    --primary-dark:  #060A14;

    /* Dimensions */
    --sidebar-width: 224px;
    --topbar-height: 60px;

    /* Rayons — système cohérent */
    --radius-sm: 6px;
    --radius:    8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 999px;

    /* Ombres — douces, multi-niveaux, faible opacité */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow:    0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.04), 0 6px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 4px 8px rgba(15, 23, 42, 0.04), 0 16px 40px rgba(15, 23, 42, 0.14);

    /* Transition ciblée (jamais « all ») */
    --transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease, opacity .15s ease;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.55;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5 { line-height: 1.2; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--accent-soft-2); color: var(--accent-active); }

/* Focus visible — anneau net partout */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent-ring);
    border-radius: var(--radius-sm);
}

/* Scrollbars discrètes */
* { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

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

/* =====================
   SIDEBAR
   ===================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-white);
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform .25s ease;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-logo {
    padding: 18px 20px;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-logo span { color: #A5B4FC; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 12px; }
.sidebar-section {
    padding: 16px 12px 6px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.32);
}
.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    margin: 1px 0;
    color: rgba(255, 255, 255, 0.62);
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    text-decoration: none;
}
.sidebar-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar-link.active { background: rgba(99, 102, 241, 0.16); color: #fff; }
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -12px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: #818CF8;
    border-radius: 0 3px 3px 0;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.sidebar-link:hover svg, .sidebar-link.active svg { opacity: 1; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255, 255, 255, 0.07); flex-shrink: 0; }
.sidebar-footer-icons { display: flex; gap: 8px; margin-bottom: 10px; }
.sidebar-footer-icon {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    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: 7px; font-size: 0.76rem; color: rgba(255, 255, 255, 0.5); }
.sidebar-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #34D399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }

/* =====================
   TOPBAR
   ===================== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: fixed; top: 0; left: var(--sidebar-width); right: 0;
    z-index: 90;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 1.02rem; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.topbar-tenant { font-size: 0.82rem; color: var(--text-secondary); }
.topbar-user {
    display: flex; align-items: center; gap: 9px;
    cursor: pointer; padding: 5px 8px 5px 5px;
    border-radius: var(--radius-pill);
    font-size: 0.88rem; font-weight: 500; color: var(--text-primary);
    transition: var(--transition);
}
.topbar-user:hover { background: var(--gray-100); }
.topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6366F1);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.8rem; flex-shrink: 0;
}
.topbar-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--gray-100);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 7px 12px; min-width: 240px;
    transition: var(--transition);
}
.topbar-search:focus-within { background: var(--bg-card); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.topbar-search input { border: none; background: transparent; outline: none; font-size: 0.86rem; 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: 28px 32px;
    width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - var(--topbar-height));
}
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
.page-title svg { width: 22px; height: 22px; color: var(--accent); }

/* =====================
   CARDS
   ===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.card + .card { margin-top: 20px; }
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 0.98rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.card-title svg { width: 18px; height: 18px; color: var(--text-secondary); }
.card-body { padding: 20px; }

/* =====================
   STATS
   ===================== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    padding: 20px 22px;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.76rem; color: var(--text-secondary); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

/* =====================
   TABLES — en-tête clair et épuré
   ===================== */
.table-responsive { overflow-x: auto; border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; }
.table thead th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 18px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}
.table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border-light); font-size: 0.9rem; color: var(--text-primary); vertical-align: middle; }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* =====================
   BADGES — pills
   ===================== */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.74rem; font-weight: 600; line-height: 1.5;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge-success   { background: var(--success-soft); color: var(--success-text); border-color: rgba(5, 150, 105, 0.18); }
.badge-warning   { background: var(--warning-soft); color: var(--warning-text); border-color: rgba(217, 119, 6, 0.18); }
.badge-danger    { background: var(--danger-soft);  color: var(--danger-text);  border-color: rgba(220, 38, 38, 0.18); }
.badge-info      { background: var(--accent-soft);  color: var(--accent-active); border-color: rgba(79, 70, 229, 0.18); }
.badge-secondary { background: var(--gray-100);      color: var(--gray-600);     border-color: var(--gray-200); }

/* =====================
   BUTTONS
   ===================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 600; font-size: 0.88rem; line-height: 1.3;
    cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: var(--transition);
    user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:active { background: var(--accent-active); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #B45309; color: #fff; }
.btn-outline { background: var(--bg-card); border-color: var(--border-strong); color: var(--text-primary); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text-primary); }
.btn-sm { padding: 6px 11px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 22px; font-size: 0.96rem; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-icon {
    width: 34px; height: 34px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid var(--border-color);
    background: var(--bg-card); cursor: pointer; transition: var(--transition);
    color: var(--text-secondary);
}
.btn-icon:hover { background: var(--gray-50); color: var(--accent); border-color: var(--accent-soft-2); }

/* =====================
   FORMS
   ===================== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; font-size: 0.84rem; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-card); color: var(--text-primary);
    transition: var(--transition);
    font-size: 0.9rem;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--gray-400); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-input:read-only { background: var(--gray-50); color: var(--text-secondary); cursor: default; }
.form-input:disabled, .form-select:disabled { background: var(--gray-50); color: var(--text-muted); cursor: not-allowed; }
.form-textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.form-error { color: var(--danger); font-size: 0.78rem; margin-top: 4px; }
.form-help { color: var(--text-muted); font-size: 0.78rem; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-actions { display: flex; gap: 10px; padding-top: 16px; }
fieldset[disabled] { opacity: 0.6; }

.form-horizontal .form-group {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 0; margin-bottom: 0;
    border-bottom: 1px solid var(--border-light);
}
.form-horizontal .form-label { min-width: 150px; text-align: right; margin-bottom: 0; color: var(--text-secondary); flex-shrink: 0; }
.form-horizontal .form-input, .form-horizontal .form-select { flex: 1; }

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

/* =====================
   ALERTS
   ===================== */
.alert {
    padding: 13px 16px; border-radius: var(--radius);
    margin-bottom: 18px;
    display: flex; align-items: center; gap: 10px;
    font-size: 0.88rem; font-weight: 500;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: var(--success-text); border-color: rgba(5, 150, 105, 0.22); }
.alert-error   { background: var(--danger-soft);  color: var(--danger-text);  border-color: rgba(220, 38, 38, 0.22); }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); border-color: rgba(217, 119, 6, 0.22); }
.alert-info    { background: var(--accent-soft);  color: var(--accent-active); border-color: rgba(79, 70, 229, 0.22); }

/* =====================
   TOAST
   ===================== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
    padding: 13px 16px; border-radius: var(--radius);
    color: #fff; font-size: 0.86rem; font-weight: 500;
    box-shadow: var(--shadow-lg); max-width: 380px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.toast-show { animation: toastIn 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
.toast-hide { animation: toastOut 0.22s 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.75; }
.toast-close:hover { opacity: 1; }
@keyframes toastIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(8px); } }

/* =====================
   MODAL
   ===================== */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(2px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.modal-open { display: flex; animation: fadeIn 0.18s ease; }
.modal-dialog {
    background: var(--bg-card); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
    max-height: 85vh; overflow-y: auto;
    animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
.modal-close { background: none; border: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: var(--radius-sm); transition: var(--transition); }
.modal-close:hover { color: var(--text-primary); background: var(--gray-100); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* =====================
   TABS
   ===================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-color); margin-bottom: 24px; }
.tab {
    padding: 10px 16px; color: var(--text-secondary);
    font-weight: 600; font-size: 0.88rem; cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: var(--transition); text-decoration: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab:hover { color: var(--text-primary); background: var(--gray-50); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* =====================
   PROGRESS
   ===================== */
.progress { height: 8px; background: var(--gray-200); border-radius: var(--radius-pill); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--radius-pill); background: var(--accent); transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.progress-warning .progress-bar { background: var(--warning); }
.progress-danger .progress-bar { background: var(--danger); }

/* =====================
   FILTERS BAR
   ===================== */
.filters-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 20px; background: var(--bg-subtle); border-bottom: 1px solid var(--border-light); }
.filters-bar .form-select, .filters-bar .form-input { min-width: 140px; padding: 7px 11px; font-size: 0.84rem; }
.filters-bar .btn { padding: 7px 13px; font-size: 0.84rem; }

/* =====================
   PAGINATION
   ===================== */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span {
    min-width: 34px; padding: 7px 11px; text-align: center;
    border-radius: var(--radius-sm); font-size: 0.84rem; font-weight: 500;
    border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-primary);
    transition: var(--transition);
}
.pagination a:hover { background: var(--gray-50); border-color: var(--gray-400); text-decoration: none; }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* =====================
   GRID
   ===================== */
.grid { display: grid; gap: 20px; }
.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: 42px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: var(--radius-pill); transition: var(--transition); }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 3px; left: 3px; box-shadow: var(--shadow); transition: transform .2s ease; }
.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: 56px 24px; color: var(--text-muted); }
.empty-state svg { width: 52px; height: 52px; margin-bottom: 14px; color: var(--gray-300); }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 6px; font-size: 1.02rem; }

/* =====================
   IMPERSONATION BANNER
   ===================== */
.impersonation-banner {
    background: var(--warning); color: #fff; text-align: center;
    padding: 8px; font-size: 0.82rem; font-weight: 600;
    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: 33px; }
.has-impersonation .main-content { margin-top: calc(var(--topbar-height) + 33px); }

/* =====================
   AGENT WORKSPACE
   ===================== */
.agent-workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.contact-panel, .call-panel {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); overflow: hidden;
}
.contact-panel-header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border-light); font-weight: 600; font-size: 0.98rem; color: var(--text-primary); }
.contact-panel-body { padding: 6px 0; }
.contact-panel-body .form-horizontal .form-group { padding: 9px 20px; margin-bottom: 0; }

.connection-status { display: flex; align-items: center; gap: 9px; padding: 12px 20px; background: var(--bg-subtle); border-bottom: 1px solid var(--border-light); font-size: 0.82rem; color: var(--text-secondary); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-dot.green { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.red { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.status-dot.orange { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.status-dot.gray { background: var(--text-muted); box-shadow: 0 0 0 3px var(--gray-100); }

.call-actions-top { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border-light); flex-wrap: wrap; }
.call-phone-display { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin-left: auto; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

.call-controls { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--border-light); }
.call-btn {
    width: 46px; height: 46px; border-radius: 50%;
    border: 1.5px solid var(--border-strong); background: var(--bg-card);
    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-soft); }
.call-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.call-btn.call-green { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.call-btn.call-green:hover { background: var(--success); color: #fff; }
.call-btn.call-red { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.call-btn.call-red:hover { background: var(--danger); color: #fff; }
.call-btn.call-orange { border-color: var(--warning); color: var(--warning); background: var(--warning-soft); }
.call-btn.call-orange:hover { background: var(--warning); color: #fff; }
.call-btn svg { width: 19px; height: 19px; }
.call-btn-separator { width: 1px; height: 28px; background: var(--border-color); margin: 0 4px; }

.call-timer { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; text-align: center; letter-spacing: 0.02em; }

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

.contact-history { padding: 16px 20px; }
.contact-history h4, .note-section h4 { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); margin-bottom: 10px; }
.note-section { padding: 16px 20px; border-top: 1px solid var(--border-light); }

.agent-status-bar { display: flex; align-items: center; gap: 14px; padding: 14px 20px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); margin-bottom: 20px; }
.agent-status-indicator { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 0.9rem; }

/* =====================
   DASHBOARD
   ===================== */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.campaign-card-item { display: flex; align-items: center; justify-content: space-between; padding: 13px 20px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: var(--transition); }
.campaign-card-item:hover { background: var(--gray-50); }
.campaign-card-item:last-child { border-bottom: none; }
.campaign-card-name { color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.campaign-card-name:hover { color: var(--accent-hover); }
.campaign-card-stats { display: flex; gap: 8px; align-items: center; }
.sort-bar { display: flex; align-items: center; gap: 12px; font-size: 0.82rem; color: var(--text-secondary); }
.sort-bar a { font-weight: 600; }

/* =====================
   SUPERVISION — agent grid
   ===================== */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.agent-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 18px; text-align: center; transition: var(--transition); position: relative; overflow: hidden; }
.agent-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--border-color); }
.agent-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.agent-card .agent-avatar { width: 48px; height: 48px; border-radius: 50%; margin: 4px auto 10px; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #fff; font-size: 0.95rem; }
.agent-card .agent-name { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; }
.agent-card .agent-status-text { font-size: 0.78rem; margin-top: 4px; color: var(--text-secondary); }
.agent-card.disponible::before { background: var(--success); }
.agent-card.en_appel::before { background: var(--danger); }
.agent-card.pause::before { background: var(--warning); }
.agent-card.inactif { opacity: 0.55; }
.agent-card.inactif::before { background: var(--gray-300); }

/* =====================
   SCRIPT EDITOR
   ===================== */
.script-editor { display: flex; gap: 20px; min-height: 450px; }
.script-toolbox { width: 190px; flex-shrink: 0; }
.script-canvas { flex: 1; background: var(--bg-subtle); border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 20px; min-height: 450px; }
.script-node { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; cursor: move; box-shadow: var(--shadow-xs); transition: var(--transition); }
.script-node:hover { box-shadow: var(--shadow-md); }
.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: 700; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 6px; letter-spacing: 0.06em; }
.script-node-content { color: var(--text-primary); font-size: 0.9rem; }

/* =====================
   WebRTC INDICATOR
   ===================== */
.webrtc-indicator { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; }
.webrtc-indicator .webrtc-dot { width: 8px; height: 8px; border-radius: 50%; }
.webrtc-ready .webrtc-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.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.35; } }

/* =====================
   PHONE DIALER
   ===================== */
.dialer-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 240px; margin: 16px auto; }
.dialer-key { height: 52px; border-radius: var(--radius); border: 1px solid var(--border-color); background: var(--bg-card); font-size: 1.15rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.dialer-key:hover { background: var(--gray-50); border-color: var(--accent); color: var(--accent); }
.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
   ===================== */
.login-container {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background:
        radial-gradient(1200px 600px at 100% 0%, rgba(99, 102, 241, 0.18), transparent 60%),
        radial-gradient(900px 500px at 0% 100%, rgba(79, 70, 229, 0.14), transparent 55%),
        linear-gradient(160deg, #0B1220 0%, #111A2E 55%, #0B1220 100%);
}
.login-box {
    background: var(--bg-card); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 44px 40px; width: 100%; max-width: 420px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; color: var(--gray-900); }
.login-logo h1 span { color: var(--accent); }
.login-logo p { color: var(--text-secondary); margin-top: 6px; font-size: 0.9rem; }

/* =====================
   LOGIN — Split 60/40 animé
   ===================== */
.auth-split { display: grid; grid-template-columns: 60% 40%; min-height: 100vh; }

/* --- Panneau marque (gauche) --- */
.auth-aside {
    position: relative; overflow: hidden; color: #fff;
    background: linear-gradient(160deg, #0B1220 0%, #141E36 55%, #0B1220 100%);
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 56px 64px;
}
.auth-aside-top, .auth-aside-mid, .auth-aside-bottom { position: relative; z-index: 2; }
.auth-aside-top    { animation: fadeUp .7s ease both; }
.auth-aside-mid    { max-width: 540px; }
.auth-aside-bottom { font-size: 0.8rem; color: rgba(255,255,255,0.4); animation: fadeUp .7s ease both .5s; }

.auth-orb { position: absolute; border-radius: 50%; filter: blur(64px); opacity: 0.5; pointer-events: none; z-index: 1; }
.auth-orb-1 { width: 440px; height: 440px; background: radial-gradient(circle, #4F46E5, transparent 70%); top: -130px; right: -90px; animation: floatOrb 15s ease-in-out infinite; }
.auth-orb-2 { width: 380px; height: 380px; background: radial-gradient(circle, #6366F1, transparent 70%); bottom: -110px; left: -70px; animation: floatOrb 19s ease-in-out infinite reverse; }
.auth-grid-overlay {
    position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 25%, transparent 72%);
    mask-image: radial-gradient(ellipse at center, #000 25%, transparent 72%);
}

.auth-brand { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-brand span { color: #A5B4FC; }

/* Visuel animé : téléphone + anneaux d'appel + équaliseur */
.auth-visual { position: relative; height: 150px; margin-bottom: 38px; animation: fadeUp .7s ease both .05s; }
.auth-phone {
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 76px; height: 76px; border-radius: 20px;
    background: linear-gradient(135deg, #4F46E5, #6366F1);
    display: flex; align-items: center; justify-content: center; color: #fff;
    box-shadow: 0 14px 40px rgba(79,70,229,0.5); z-index: 2;
}
.auth-phone svg { width: 34px; height: 34px; }
.ring {
    position: absolute; left: 38px; top: 50%; width: 76px; height: 76px;
    border-radius: 50%; border: 1.5px solid rgba(129,140,248,0.45);
    transform: translate(-50%, -50%); z-index: 1;
    animation: pulseRing 3.2s ease-out infinite;
}
.ring-2 { animation-delay: 1.06s; }
.ring-3 { animation-delay: 2.13s; }
.auth-wave { position: absolute; left: 124px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; height: 58px; }
.auth-wave span { width: 5px; height: 100%; border-radius: 999px; background: linear-gradient(180deg, #A5B4FC, #4F46E5); transform-origin: center; animation: waveBar 1.3s ease-in-out infinite; }
.auth-wave span:nth-child(1) { animation-delay: 0s; }
.auth-wave span:nth-child(2) { animation-delay: .15s; }
.auth-wave span:nth-child(3) { animation-delay: .3s; }
.auth-wave span:nth-child(4) { animation-delay: .45s; }
.auth-wave span:nth-child(5) { animation-delay: .3s; }
.auth-wave span:nth-child(6) { animation-delay: .15s; }
.auth-wave span:nth-child(7) { animation-delay: 0s; }

.auth-headline { font-size: 2.4rem; font-weight: 800; line-height: 1.12; letter-spacing: -0.03em; margin-bottom: 16px; animation: fadeUp .7s ease both .15s; }
.auth-headline em { font-style: normal; background: linear-gradient(90deg, #A5B4FC, #818CF8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { font-size: 1rem; line-height: 1.6; color: rgba(255,255,255,0.7); max-width: 48ch; margin-bottom: 28px; animation: fadeUp .7s ease both .25s; }
.auth-features { list-style: none; display: flex; flex-direction: column; gap: 12px; animation: fadeUp .7s ease both .35s; }
.auth-features li { display: flex; align-items: center; gap: 11px; font-size: 0.95rem; color: rgba(255,255,255,0.85); }
.auth-features svg { width: 22px; height: 22px; padding: 4px; border-radius: 50%; background: rgba(99,102,241,0.18); color: #A5B4FC; flex-shrink: 0; }

/* --- Formulaire (droite) --- */
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg-card); }
.auth-form-wrap { width: 100%; max-width: 380px; animation: fadeUp .6s ease both .15s; }
.auth-form-brand { display: none; font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 24px; color: var(--gray-900); }
.auth-form-brand span { color: var(--accent); }
.auth-form-title { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.auth-form-lead { color: var(--text-secondary); margin-bottom: 28px; font-size: 0.92rem; }
.auth-main form .form-group { animation: fadeUp .5s ease both; }
.auth-main form .form-group:nth-child(2) { animation-delay: .22s; }
.auth-main form .form-group:nth-child(3) { animation-delay: .32s; }
.auth-main form .form-group:nth-child(4) { animation-delay: .42s; }
.auth-main form .text-center { animation: fadeUp .5s ease both .52s; }

@keyframes floatOrb { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(24px, -32px) scale(1.1); } }
@keyframes pulseRing { 0% { transform: translate(-50%, -50%) scale(0.55); opacity: 0.7; } 100% { transform: translate(-50%, -50%) scale(3); opacity: 0; } }
@keyframes waveBar { 0%, 100% { transform: scaleY(0.35); opacity: 0.65; } 50% { transform: scaleY(1); opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-form-brand { display: block; }
}

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

/* =====================
   UTILITIES
   ===================== */
.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; }
.tabular { font-variant-numeric: tabular-nums; }
.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%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .topbar { left: 0; }
    .impersonation-banner { left: 0; }
    .main-content { margin-left: 0; width: 100%; padding: 22px 20px; }
    .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: inline-flex; }
}
@media (max-width: 640px) {
    .main-content { padding: 18px 16px; }
    .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: 12px; }
    .page-title { font-size: 1.3rem; }
    .call-controls { flex-wrap: wrap; }
    .btn-group { flex-wrap: wrap; }
    .form-horizontal .form-group { flex-direction: column; align-items: stretch; }
    .form-horizontal .form-label { text-align: left; min-width: auto; }
    .topbar-search { min-width: 0; }
}

/* --- Sidebar toggle (mobile) --- */
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; color: var(--text-secondary); border-radius: var(--radius-sm); transition: var(--transition); }
.sidebar-toggle:hover { background: var(--gray-100); color: var(--text-primary); }
@media (max-width: 1024px) { .sidebar-toggle { display: inline-flex; } }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
