/* ═══════════════════════════════════════════════════
   FATEC 360 — Styles
   ═══════════════════════════════════════════════════ */

:root {
    --primary: #1a3a5c;
    --secondary: #2980b9;
    --accent: #e67e22;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --light: #f4f6f8;
    --dark: #2c3e50;
    --border: #dfe6e9;
    --white: #fff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, sans-serif; background: #eef1f5; color: #333; font-size: 14px; overflow: hidden; height: 100vh; }

/* ─── TOP BAR ─── */
.topbar { background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 48px; font-size: 13px; flex-shrink: 0; }
.topbar-left { display: flex; align-items: center; gap: 18px; }
.topbar-logo { font-weight: 700; font-size: 15px; }
.topbar-logo span { color: var(--accent); }
.topbar-nav { display: flex; gap: 2px; }
.topbar-nav a { color: rgba(255,255,255,.65); text-decoration: none; padding: 5px 12px; border-radius: 5px; transition: .15s; }
.topbar-nav a:hover, .topbar-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--secondary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; }

/* ─── SEARCH ─── */
.topbar-center { flex: 1; display: flex; justify-content: center; padding: 0 20px; max-width: 600px; }
.search-container { position: relative; width: 100%; }
.search-container .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; pointer-events: none; opacity: .6; }
.search-input { width: 100%; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 6px; color: #fff; padding: 6px 80px 6px 32px; font-size: 13px; outline: none; transition: .2s; }
.search-input::placeholder { color: rgba(255,255,255,.45); }
.search-input:focus { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.4); }
.search-scope { position: absolute; right: 28px; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: rgba(255,255,255,.7); font-size: 11px; cursor: pointer; outline: none; }
.search-scope option { color: #333; background: #fff; }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer; font-size: 14px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.search-clear:hover { background: rgba(255,255,255,.15); color: #fff; }

.search-results-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--white); border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,.25);
    max-height: 500px; overflow-y: auto; z-index: 9999; border: 1px solid var(--border);
}
.sr-section-title { padding: 8px 14px 4px; font-size: 11px; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: .5px; border-top: 1px solid var(--border); }
.sr-section-title:first-child { border-top: none; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; transition: .1s; color: #333; }
.sr-item:hover, .sr-item.highlighted { background: #f0f5ff; }
.sr-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.sr-info { flex: 1; min-width: 0; }
.sr-main { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { font-size: 11px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-badge { font-size: 11px; color: var(--secondary); font-weight: 600; white-space: nowrap; }
.sr-empty { padding: 20px; text-align: center; color: #999; font-size: 13px; }
.sr-footer { padding: 8px 14px; text-align: center; font-size: 11px; color: #999; border-top: 1px solid var(--border); }

/* ─── PHONE BAR (Xivo CTI) ─── */
.phone-bar { background: #1e272e; color: #fff; display: flex; align-items: center; padding: 0 20px; height: 44px; gap: 16px; font-size: 12px; flex-shrink: 0; }
.phone-bar .pb-section { display: flex; align-items: center; gap: 8px; }
.phone-bar .pb-divider { width: 1px; height: 24px; background: #444; }
.phone-status-dot { width: 10px; height: 10px; border-radius: 50%; }
.phone-status-dot.disponible { background: var(--success); box-shadow: 0 0 6px rgba(39,174,96,.5); }
.phone-status-dot.en_appel { background: var(--danger); box-shadow: 0 0 6px rgba(231,76,60,.5); animation: pulse 1.5s infinite; }
.phone-status-dot.sonne { background: var(--accent); box-shadow: 0 0 6px rgba(230,126,34,.5); animation: pulse .6s infinite; }
.phone-status-dot.pause { background: var(--warning); }
.phone-status-dot.post_appel { background: #9b59b6; }
.phone-status-dot.hors_ligne { background: #666; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.phone-status-label { font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.phone-status-select { background: #333; border: 1px solid #555; color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; }
.phone-btn { padding: 4px 12px; border-radius: 5px; border: 1px solid #555; background: transparent; color: #fff; cursor: pointer; font-size: 11px; transition: .15s; display: flex; align-items: center; gap: 4px; }
.phone-btn:hover { background: rgba(255,255,255,.1); }
.phone-btn.answer { border-color: var(--success); color: var(--success); }
.phone-btn.answer:hover { background: var(--success); color: #fff; }
.phone-btn.hangup { border-color: var(--danger); color: var(--danger); }
.phone-btn.hangup:hover { background: var(--danger); color: #fff; }
.phone-btn.hold { border-color: var(--warning); color: var(--warning); }

.call-info { display: flex; align-items: center; gap: 10px; }
.call-info .caller-name { font-weight: 700; font-size: 13px; }
.call-info .caller-number { color: #aaa; }
.call-info .call-meta { font-size: 11px; color: #888; }
.call-timer { font-family: 'Consolas', monospace; font-size: 16px; color: var(--accent); font-weight: 700; min-width: 50px; }
.call-svi-badge { background: #5e35b1; color: #fff; padding: 2px 8px; border-radius: 8px; font-size: 10px; }
.call-queue-badge { background: #00695c; color: #fff; padding: 2px 8px; border-radius: 8px; font-size: 10px; }
.call-client-badge { background: var(--secondary); color: #fff; padding: 2px 8px; border-radius: 8px; font-size: 10px; cursor: pointer; }

.queue-indicators { display: flex; gap: 10px; margin-left: auto; }
.queue-item { text-align: center; padding: 2px 10px; border-radius: 6px; background: rgba(255,255,255,.05); }
.queue-item .q-count { font-size: 14px; font-weight: 700; }
.queue-item .q-label { font-size: 9px; color: #888; }

/* Incoming call overlay */
.incoming-call-overlay { position: fixed; top: 92px; right: 20px; z-index: 10001; background: #1e272e; border: 2px solid var(--accent); border-radius: 14px; padding: 20px; color: #fff; min-width: 320px; box-shadow: 0 8px 32px rgba(0,0,0,.4); animation: slideIn .3s ease; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.incoming-call-overlay .ico-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.incoming-call-overlay .ico-ring { font-size: 28px; animation: ring .5s infinite alternate; }
@keyframes ring { from { transform: rotate(-15deg); } to { transform: rotate(15deg); } }
.incoming-call-overlay .ico-title { font-weight: 700; font-size: 14px; }
.incoming-call-overlay .ico-subtitle { font-size: 11px; color: #aaa; }
.incoming-call-overlay .ico-caller { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.incoming-call-overlay .ico-number { font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.incoming-call-overlay .ico-badges { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.incoming-call-overlay .ico-actions { display: flex; gap: 8px; }
.incoming-call-overlay .ico-actions button { flex: 1; padding: 8px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; }
.incoming-call-overlay .ico-actions .btn-accept { background: var(--success); color: #fff; }
.incoming-call-overlay .ico-actions .btn-reject { background: var(--danger); color: #fff; }

/* Ticket association in incoming call */
.ico-ticket-assoc { margin-bottom: 12px; }
.ico-ticket-label { display: block; font-size: 11px; color: #aaa; margin-bottom: 4px; }
.ico-ticket-select { width: 100%; background: #2d3436; border: 1px solid #555; color: #fff; padding: 6px 8px; border-radius: 6px; font-size: 12px; }

/* ─── DIRECTORY OVERLAY ─── */
.directory-overlay { position: fixed; top: 92px; right: 20px; z-index: 999; animation: slideIn .3s ease; }
.directory-panel { background: #1e272e; border: 2px solid var(--secondary); border-radius: 14px; padding: 16px; color: #fff; width: 360px; max-height: 500px; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,.4); }
.directory-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.directory-header h3 { font-size: 15px; font-weight: 700; }
.directory-close { background: none; border: none; color: #aaa; font-size: 18px; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.directory-close:hover { color: #fff; background: rgba(255,255,255,.1); }
.directory-search { width: 100%; background: #2d3436; border: 1px solid #555; color: #fff; padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; outline: none; }
.directory-search:focus { border-color: var(--secondary); }
.directory-search::placeholder { color: #777; }
.directory-list { overflow-y: auto; flex: 1; }
.directory-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; cursor: default; transition: .15s; }
.directory-item:hover { background: rgba(255,255,255,.06); }
.directory-item .di-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--secondary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.directory-item .di-info { flex: 1; min-width: 0; }
.directory-item .di-name { font-weight: 600; font-size: 13px; }
.directory-item .di-detail { font-size: 11px; color: #aaa; margin-top: 2px; }
.directory-item .di-ext { font-size: 11px; color: var(--accent); font-weight: 600; }
.directory-item .di-call-btn { background: var(--success); color: #fff; border: none; padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.directory-item .di-call-btn:hover { filter: brightness(1.15); }
.directory-item .di-call-btn:disabled { background: #555; cursor: not-allowed; }
.directory-loading { text-align: center; color: #aaa; padding: 20px; font-size: 12px; }
.directory-empty { text-align: center; color: #777; padding: 20px; font-size: 12px; }
.ico-ticket-select option { background: #2d3436; color: #fff; }

/* ─── POST-CALL MODAL ─── */
.modal-postcall { max-width: 640px; }
.postcall-summary { background: #f0f4f8; border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.postcall-caller { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.postcall-icon { font-size: 24px; }
.postcall-meta { font-size: 12px; color: #666; margin-top: 2px; }
.postcall-recording { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.recording-label { font-size: 11px; font-weight: 600; color: #555; margin-bottom: 6px; }
.recording-player { display: flex; align-items: center; gap: 8px; }
.rec-play-btn { background: var(--secondary); color: #fff; border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rec-waveform { display: flex; align-items: flex-end; gap: 2px; flex: 1; height: 24px; }
.rec-bar { width: 3px; background: var(--secondary); border-radius: 2px; transition: height .2s; opacity: .5; }
.rec-bar.animating { animation: waveAnim .6s ease-in-out infinite alternate; opacity: 1; }
.rec-duration { font-size: 12px; color: #666; font-variant-numeric: tabular-nums; }

/* Recording in exchange bubble */
.ex-recording { margin-top: 8px; background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 8px; padding: 8px 10px; }
.rec-label { font-size: 11px; font-weight: 600; color: #555; margin-bottom: 4px; }
.rec-player-inline { display: flex; align-items: center; gap: 6px; }
.rec-play-btn-sm { background: var(--secondary); color: #fff; border: none; border-radius: 50%; width: 26px; height: 26px; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rec-waveform-sm { display: flex; align-items: flex-end; gap: 1.5px; flex: 1; height: 18px; }
.rec-dur-sm { font-size: 11px; color: #888; }

@keyframes waveAnim {
    0% { transform: scaleY(0.4); }
    100% { transform: scaleY(1.2); }
}

/* AI Synthesis in post-call modal */
.postcall-ai { background: linear-gradient(135deg, #f0f5ff, #e8f0fe); border: 1px solid #c5d5ea; border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.ai-synthesis-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--primary); }
.ai-gen-btn { background: var(--secondary); color: #fff; border: none; padding: 5px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.ai-gen-btn:disabled { opacity: .6; cursor: wait; }
.ai-synthesis-content { font-size: 13px; line-height: 1.6; color: #333; }
.ai-synthesis-placeholder, .ai-synthesis-loading { color: #888; font-style: italic; font-size: 12px; }
.ai-synthesis-error { color: var(--danger); }
.ai-synthesis-text { white-space: pre-wrap; }
.ai-synthesis-actions { margin-top: 10px; font-size: 12px; color: #555; }
.ai-synthesis-actions label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ─── CLIENT BANNER ─── */
.client-banner { background: #fff; border-bottom: 1px solid var(--border); padding: 12px 20px; display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.client-avatar { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, var(--secondary), var(--primary)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 17px; font-weight: 700; flex-shrink: 0; }
.client-id-block { flex: 1; }
.client-name { font-size: 16px; font-weight: 700; color: var(--dark); }
.client-company { font-size: 12px; color: #888; }
.client-meta { display: flex; gap: 18px; margin-top: 4px; font-size: 11px; color: #666; flex-wrap: wrap; }
.client-meta span { display: flex; align-items: center; gap: 3px; }
.client-meta .clickable { cursor: pointer; color: var(--secondary); text-decoration: underline; }
.client-kpis { display: flex; gap: 12px; flex-shrink: 0; }
.kpi-mini { text-align: center; padding: 6px 14px; border-radius: 8px; background: var(--light); min-width: 80px; }
.kpi-mini .kpi-val { font-size: 18px; font-weight: 700; }
.kpi-mini .kpi-label { font-size: 9px; color: #888; text-transform: uppercase; letter-spacing: .4px; }
.kpi-mini.warn .kpi-val { color: var(--warning); }
.kpi-mini.good .kpi-val { color: var(--success); }
.kpi-mini.info .kpi-val { color: var(--secondary); }
.kpi-mini.alert .kpi-val { color: var(--danger); }

/* ─── MAIN LAYOUT ─── */
.main-layout { display: grid; grid-template-columns: 300px 1fr 320px; flex: 1; overflow: hidden; }
.app-container { display: flex; flex-direction: column; height: 100vh; }

/* ─── LEFT PANEL ─── */
.left-panel { background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.panel-header { padding: 12px 14px; font-weight: 700; font-size: 12px; color: var(--primary); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.panel-header .count { background: var(--secondary); color: #fff; font-size: 10px; padding: 1px 7px; border-radius: 9px; }
.ticket-filters { display: flex; gap: 3px; padding: 6px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.filter-btn { font-size: 10px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; color: #666; transition: .15s; }
.filter-btn.active, .filter-btn:hover { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.ticket-list { flex: 1; overflow-y: auto; }
.ticket-item { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: .1s; }
.ticket-item:hover { background: #f8fafc; }
.ticket-item.active { background: #e8f4fd; border-left: 3px solid var(--secondary); }
.ticket-item .t-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.ticket-item .t-ref { font-weight: 700; font-size: 11px; color: var(--primary); }
.ticket-item .t-date { font-size: 10px; color: #aaa; }
.ticket-item .t-subject { font-size: 12px; color: #444; margin-bottom: 5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket-item .t-footer { display: flex; align-items: center; gap: 6px; }
.status-pill { font-size: 9px; padding: 2px 7px; border-radius: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.status-nouveau { background: #e3f2fd; color: #1565c0; }
.status-en_cours { background: #fff3e0; color: #e65100; }
.status-en_attente { background: #f3e5f5; color: #7b1fa2; }
.status-escalade { background: #fce4ec; color: #c62828; }
.status-cloture { background: #eceff1; color: #607d8b; }
.channel-tag { font-size: 10px; color: #999; }
.sla-tag { font-size: 10px; margin-left: auto; font-weight: 600; }
.sla-ok { color: var(--success); }
.sla-warning { color: var(--warning); }
.sla-breach { color: var(--danger); }

/* ─── CENTER PANEL ─── */
.center-panel { display: flex; flex-direction: column; overflow: hidden; background: var(--light); }
.exchange-header { background: #fff; padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.exchange-header .eh-left h3 { font-size: 13px; color: var(--primary); }
.exchange-header .eh-left .eh-sub { font-size: 11px; color: #888; margin-top: 2px; }
.exchange-actions { display: flex; gap: 4px; }
.action-btn { font-size: 11px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 5px; background: #fff; cursor: pointer; color: #555; transition: .15s; }
.action-btn:hover { border-color: var(--secondary); color: var(--secondary); }
.action-btn.primary-action { background: var(--secondary); color: #fff; border-color: var(--secondary); }

.exchange-timeline { flex: 1; overflow-y: auto; padding: 16px; }
.timeline-date { text-align: center; font-size: 10px; color: #aaa; margin: 14px 0 10px; position: relative; }
.timeline-date::before, .timeline-date::after { content: ''; position: absolute; top: 50%; height: 1px; background: #ddd; width: calc(50% - 50px); }
.timeline-date::before { left: 0; }
.timeline-date::after { right: 0; }
.exchange-item { display: flex; gap: 10px; margin-bottom: 14px; }
.exchange-item.outgoing { flex-direction: row-reverse; }
.ex-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.ex-avatar.client { background: #dfe6e9; color: var(--dark); }
.ex-avatar.agent { background: var(--secondary); color: #fff; }
.ex-avatar.system { background: #ffeaa7; color: #6c5ce7; font-size: 14px; }
.ex-avatar.external { background: #b2dfdb; color: #00695c; }
.ex-bubble { max-width: 70%; border-radius: 10px; padding: 10px 14px; }
.exchange-item:not(.outgoing):not(.system-event) .ex-bubble { background: #fff; border: 1px solid #e0e0e0; }
.exchange-item.outgoing .ex-bubble { background: #e8f4fd; border: 1px solid #bee5f7; }
.exchange-item.system-event .ex-bubble { background: #fef9e7; border: 1px solid #f9e79f; max-width: 90%; font-size: 11px; color: #7d6608; text-align: center; }
.exchange-item.internal .ex-bubble { background: #fdf2e9; border: 1px solid #f5cba7; }
.ex-bubble .ex-sender { font-weight: 700; font-size: 11px; margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.ex-bubble .ex-sender .via { font-weight: 400; font-size: 9px; color: #aaa; background: #f0f0f0; padding: 1px 5px; border-radius: 6px; }
.ex-bubble .ex-text { font-size: 12px; line-height: 1.5; color: #444; white-space: pre-wrap; }
.ex-bubble .ex-time { font-size: 9px; color: #bbb; margin-top: 4px; text-align: right; }
.ex-bubble .ex-attachment { margin-top: 6px; padding: 4px 8px; background: #f8f9fa; border-radius: 5px; font-size: 10px; color: var(--secondary); }
.ex-bubble .ex-call-info { margin-top: 4px; font-size: 10px; color: #888; display: flex; gap: 8px; }

/* Compose */
.compose-bar { background: #fff; border-top: 1px solid var(--border); padding: 10px 18px; flex-shrink: 0; }
.ai-suggestion { padding: 8px 12px; background: linear-gradient(135deg, #ede7f6, #e8eaf6); border-radius: 8px; border: 1px solid #d1c4e9; margin-bottom: 8px; }
.ai-suggestion .ai-head { font-size: 10px; font-weight: 700; color: #5e35b1; margin-bottom: 4px; }
.ai-suggestion .ai-text { font-size: 11px; color: #555; line-height: 1.4; }
.ai-suggestion .ai-actions { margin-top: 6px; display: flex; gap: 4px; }
.ai-suggestion .ai-actions button { font-size: 10px; padding: 3px 8px; border-radius: 5px; border: 1px solid #b39ddb; background: #fff; color: #5e35b1; cursor: pointer; }
.compose-inner { display: flex; gap: 8px; align-items: flex-end; }
.compose-input { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 12px; font-family: inherit; resize: none; min-height: 38px; max-height: 80px; outline: none; }
.compose-input:focus { border-color: var(--secondary); }
.compose-tools { display: flex; gap: 3px; }
.compose-tools button { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; font-size: 14px; color: #888; }
.compose-send { width: 38px; height: 38px; border: none; border-radius: 8px; background: var(--secondary); color: #fff; font-size: 16px; cursor: pointer; }

/* ─── RIGHT PANEL ─── */
.right-panel { background: #fff; border-left: 1px solid var(--border); overflow-y: auto; }
.ctx-section { border-bottom: 1px solid var(--border); }
.ctx-header { padding: 10px 14px; font-weight: 700; font-size: 11px; color: var(--primary); text-transform: uppercase; letter-spacing: .5px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: #fafbfc; }
.ctx-header .toggle { font-size: 9px; color: #aaa; transition: .2s; }
.ctx-header.collapsed .toggle { transform: rotate(-90deg); }
.ctx-body { padding: 8px 14px 12px; }
.ctx-body.hidden { display: none; }

.tag-list { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 8px; }
.tag { font-size: 9px; padding: 2px 7px; border-radius: 8px; background: #eef2ff; color: #4a5fc1; font-weight: 600; }
.tag.vip { background: #fef3c7; color: #92400e; }
.tag.contract { background: #e0f2f1; color: #00695c; }

.client-field { display: flex; justify-content: space-between; padding: 4px 0; font-size: 11px; border-bottom: 1px solid #f5f5f5; }
.client-field:last-child { border: none; }
.client-field .cf-label { color: #999; }
.client-field .cf-value { font-weight: 600; color: #444; text-align: right; max-width: 58%; }

.indic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.indic-card { padding: 8px; border-radius: 6px; background: var(--light); text-align: center; }
.indic-card .indic-val { font-size: 16px; font-weight: 700; }
.indic-card .indic-lbl { font-size: 9px; color: #888; }
.indic-card.green .indic-val { color: var(--success); }
.indic-card.orange .indic-val { color: var(--warning); }
.indic-card.red .indic-val { color: var(--danger); }
.indic-card.blue .indic-val { color: var(--secondary); }

.sla-bar-container { margin-top: 6px; }
.sla-bar-label { display: flex; justify-content: space-between; font-size: 10px; margin-bottom: 3px; }
.sla-bar-label .sla-time { font-weight: 700; }
.sla-bar-track { height: 5px; border-radius: 3px; background: #eee; overflow: hidden; }
.sla-bar-fill { height: 100%; border-radius: 3px; }

.vehicle-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f5f5f5; font-size: 11px; }
.vehicle-item:last-child { border: none; }
.vehicle-icon { font-size: 18px; }
.vehicle-info { flex: 1; }
.vehicle-info .v-model { font-weight: 600; color: #333; }
.vehicle-info .v-plate { font-size: 10px; color: #999; }
.vehicle-status { font-size: 9px; padding: 2px 5px; border-radius: 6px; font-weight: 600; }
.v-actif { background: #e8f5e9; color: #2e7d32; }
.v-commande { background: #fff3e0; color: #e65100; }
.v-restitue { background: #eceff1; color: #607d8b; }

.note-item { padding: 6px 8px; background: #fffde7; border-radius: 6px; font-size: 11px; margin-bottom: 5px; border-left: 3px solid var(--warning); }
.note-item .note-date { font-size: 9px; color: #bbb; margin-top: 3px; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ─── No ticket selected ─── */
.no-selection { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #aaa; gap: 10px; }
.no-selection .ns-icon { font-size: 48px; }

/* ─── Inline select (header) ─── */
.inline-select { background: transparent; border: 1px solid transparent; border-radius: 4px; font-size: 11px; font-family: inherit; color: inherit; padding: 1px 4px; cursor: pointer; transition: .2s; }
.inline-select:hover { border-color: var(--border); background: var(--light); }
.inline-select:focus { outline: none; border-color: var(--secondary); }
.inline-select.priority-haute { color: var(--danger); font-weight: 600; }
.inline-select.priority-moyenne { color: var(--warning); font-weight: 600; }
.inline-select.priority-basse { color: var(--success); }
.edit-subject-btn { background: none; border: none; cursor: pointer; font-size: 12px; opacity: .4; transition: .15s; padding: 0 2px; }
.edit-subject-btn:hover { opacity: 1; }

/* ─── Compose options ─── */
.compose-options { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; font-size: 11px; }
.compose-option-label { display: flex; align-items: center; gap: 4px; color: #888; cursor: pointer; }
.compose-option-label input[type="checkbox"] { accent-color: var(--secondary); }
.compose-channel-select { border: 1px solid var(--border); border-radius: 4px; font-size: 11px; padding: 2px 6px; background: #fff; }

/* ─── Action buttons variants ─── */
.action-btn:disabled { opacity: .4; cursor: not-allowed; }
.danger-btn { color: var(--danger) !important; border-color: #f5c6cb !important; }
.danger-btn:hover { background: #fce4ec !important; }

/* ─── Create ticket button ─── */
.create-ticket-btn { background: var(--success); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .15s; line-height: 1; }
.create-ticket-btn:hover { background: #219a52; transform: scale(1.1); }

/* ─── Add note button ─── */
.add-note-btn { width: 100%; padding: 6px; border: 1px dashed var(--border); border-radius: 6px; background: transparent; color: #888; font-size: 11px; cursor: pointer; transition: .15s; margin-top: 4px; }
.add-note-btn:hover { border-color: var(--secondary); color: var(--secondary); background: #f0f8ff; }
.note-delete { background: none; border: none; color: #ccc; cursor: pointer; font-size: 10px; margin-left: 6px; }
.note-delete:hover { color: var(--danger); }

/* ─── Modal ─── */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 2000; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box { background: #fff; border-radius: 14px; width: 560px; max-width: 90vw; max-height: 90vh; overflow: hidden; box-shadow: 0 16px 48px rgba(0,0,0,.2); animation: modalPop .2s ease; display: flex; flex-direction: column; }
@keyframes modalPop { from { transform: scale(.95) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 15px; color: var(--primary); }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #aaa; padding: 4px; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-btn { padding: 8px 18px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); transition: .15s; }
.modal-btn.cancel { background: #fff; color: #666; }
.modal-btn.cancel:hover { background: var(--light); }
.modal-btn.confirm { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.modal-btn.confirm:hover { background: #2471a3; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; }
.form-group input[type="text"],
.form-group textarea,
.form-group select { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit; transition: border .15s; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--secondary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ═══════ ROLE SWITCHER ═══════ */
.role-switcher { display: flex; gap: 6px; align-items: center; margin-right: 12px; }
.role-switch-select, .group-switch-select {
    padding: 4px 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; font-size: 11px;
    background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
}
.role-switch-select:focus, .group-switch-select:focus { outline: none; border-color: var(--secondary); }
.role-switch-select option, .group-switch-select option { color: #333; background: #fff; }

/* ═══════ ADMIN PANEL ═══════ */
.admin-panel {
    display: flex; flex-direction: column; flex: 1; overflow: hidden;
    background: var(--bg-main); padding: 0;
}
.admin-tabs {
    display: flex; gap: 0; border-bottom: 2px solid var(--border); background: #fff;
    padding: 0 24px;
}
.admin-tab {
    padding: 12px 24px; border: none; background: none; font-size: 14px; font-weight: 600;
    color: #666; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all .15s;
}
.admin-tab:hover { color: var(--primary); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-content { flex: 1; overflow-y: auto; padding: 24px; }

.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.admin-toolbar h2 { font-size: 20px; font-weight: 700; color: #333; }
.admin-toolbar h2 .count { font-size: 14px; font-weight: 400; color: #888; margin-left: 8px; }
.admin-add-btn {
    padding: 8px 18px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
    background: var(--primary); color: #fff; cursor: pointer; transition: background .15s;
}
.admin-add-btn:hover { background: #0050a0; }

/* Admin Table */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.admin-table thead th {
    padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
    color: #888; background: #f7f8fa; border-bottom: 1px solid var(--border);
}
.admin-table tbody td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.admin-table tbody tr:hover { background: #f5f8ff; }
.admin-table .inactive-row { opacity: .5; }
.mini-avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
}
.admin-actions { display: flex; gap: 4px; }
.admin-actions button { border: none; background: none; cursor: pointer; font-size: 16px; padding: 4px; border-radius: 4px; transition: background .15s; }
.admin-actions button:hover { background: #eee; }
.admin-actions .danger-btn:hover { background: #fdd; }
.stat-cell { text-align: center; font-weight: 600; }

/* Role badges */
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; color: #fff; }
.role-admin { background: #e74c3c; }
.role-superviseur { background: #f39c12; }
.role-agent { background: #3498db; }
.role-lecteur { background: #95a5a6; }

/* Channel badge */
.channel-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: #ecf0f1; color: #555; margin: 1px; }

/* Priority badge */
.priority-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; color: #fff; }
.priority-1 { background: #e74c3c; }
.priority-2 { background: #f39c12; }
.priority-3 { background: #95a5a6; }

/* Admin Cards (Groups) */
.admin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.admin-card {
    background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.08);
    border: 1px solid var(--border); transition: box-shadow .15s;
}
.admin-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.card-header h3 { font-size: 16px; font-weight: 700; color: var(--primary); margin: 0; }
.card-actions { display: flex; gap: 4px; }
.card-actions button { border: none; background: none; cursor: pointer; font-size: 16px; padding: 4px; border-radius: 4px; }
.card-actions button:hover { background: #eee; }
.card-actions .danger-btn:hover { background: #fdd; }
.card-desc { font-size: 13px; color: #666; margin: 0 0 10px; }
.card-meta { display: flex; gap: 16px; font-size: 12px; color: #888; margin-bottom: 10px; }
.card-roles { margin-bottom: 10px; }
.card-members { display: flex; flex-wrap: wrap; gap: 4px; }
.member-pill {
    display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 500;
    background: #eef2ff; color: var(--primary); border: 1px solid #d0d9f4;
}

/* Admin Forms */
.admin-form-area { margin-bottom: 16px; }
.admin-form {
    background: #fff; border-radius: 12px; padding: 20px; border: 2px solid var(--secondary);
    box-shadow: 0 2px 12px rgba(0,100,200,.1);
}
.admin-form h3 { font-size: 16px; font-weight: 700; margin: 0 0 16px; color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-form .form-group input[type="text"],
.admin-form .form-group input[type="email"],
.admin-form .form-group input[type="number"],
.admin-form .form-group select {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; font-family: inherit;
}
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-group label { display: flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.checkbox-group.scrollable { max-height: 120px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.btn-primary {
    padding: 8px 20px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600;
    background: var(--primary); color: #fff; cursor: pointer;
}
.btn-primary:hover { background: #0050a0; }
.btn-secondary {
    padding: 8px 20px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
    background: #fff; color: #666; cursor: pointer;
}
.btn-secondary:hover { background: #f5f5f5; }

/* ═══════ LOGIN SCREEN ═══════ */
.login-screen {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; background: linear-gradient(135deg, #1a3a5c 0%, #2980b9 50%, #1a3a5c 100%);
}
.login-box {
    background: #fff; border-radius: 16px; padding: 40px 36px; width: 440px; max-height: 80vh;
    box-shadow: 0 20px 60px rgba(0,0,0,.25); text-align: center; overflow-y: auto;
}
.login-logo { font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.login-logo span { color: var(--accent); }
.login-subtitle { font-size: 13px; color: #888; margin-bottom: 24px; }
.login-title { font-size: 18px; font-weight: 700; color: #333; margin-bottom: 6px; }
.login-hint { font-size: 13px; color: #999; margin-bottom: 20px; }
.login-users { display: flex; flex-direction: column; gap: 8px; }
.login-loading { color: #888; font-size: 13px; padding: 20px; }
.login-user-card {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px;
    border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
    transition: all .2s; text-align: left;
}
.login-user-card:hover {
    border-color: var(--secondary); background: #f0f7ff; box-shadow: 0 2px 8px rgba(41,128,185,.15);
    transform: translateY(-1px);
}
.login-user-avatar {
    width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.login-user-info { flex: 1; }
.login-user-name { font-size: 15px; font-weight: 600; color: #333; margin-bottom: 4px; }
.login-user-roles { display: flex; gap: 4px; flex-wrap: wrap; }
.login-arrow { font-size: 18px; color: #bbb; transition: color .15s; }
.login-user-card:hover .login-arrow { color: var(--secondary); }

/* Logout button */
.logout-btn {
    border: none; background: rgba(255,255,255,.1); color: rgba(255,255,255,.7);
    width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.logout-btn:hover { background: rgba(231,76,60,.8); color: #fff; }

/* ═══════ SUPERVISOR PANEL ═══════ */
.supervisor-panel {
    display: flex; flex-direction: column; flex: 1; overflow: hidden;
    background: var(--bg-main, #eef1f5); padding: 0;
}
.supervisor-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px 0; flex-shrink: 0;
}
.supervisor-header h2 { font-size: 22px; font-weight: 700; color: #333; }
.supervisor-meta { font-size: 13px; color: #666; }
.supervisor-meta strong { color: var(--primary); }

/* KPI cards row */
.supervisor-kpis {
    display: flex; gap: 14px; padding: 16px 24px; flex-shrink: 0; overflow-x: auto;
}
.kpi-card {
    background: #fff; border-radius: 12px; padding: 16px 24px; min-width: 140px;
    text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.08);
    border-left: 4px solid var(--primary);
}
.kpi-card.kpi-green { border-left-color: var(--success); }
.kpi-card.kpi-orange { border-left-color: var(--warning); }
.kpi-card.kpi-blue { border-left-color: var(--secondary); }
.kpi-card.kpi-red { border-left-color: var(--danger); }
.kpi-value { font-size: 28px; font-weight: 800; color: #333; }
.kpi-label { font-size: 12px; color: #888; margin-top: 2px; text-transform: uppercase; font-weight: 600; }

/* Agent cards grid */
.supervisor-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 14px; padding: 0 24px 24px; overflow-y: auto; flex: 1;
}
.agent-card {
    background: #fff; border-radius: 12px; padding: 18px; 
    box-shadow: 0 1px 4px rgba(0,0,0,.08); border: 1px solid var(--border);
    transition: box-shadow .15s;
}
.agent-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.agent-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.agent-card-avatar {
    width: 46px; height: 46px; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
    flex-shrink: 0;
}
.agent-card-identity { flex: 1; }
.agent-card-name { font-size: 15px; font-weight: 700; color: #333; }
.agent-card-role { display: flex; gap: 4px; margin-top: 3px; }
.agent-phone-status {
    display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
    padding: 4px 12px; border-radius: 20px; white-space: nowrap;
}
.status-dot-live { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-available { background: #e8f8f0; color: #27ae60; }
.status-available .status-dot-live { background: #27ae60; animation: pulse-dot 1.5s infinite; }
.status-oncall { background: #fff3e0; color: #e67e22; }
.status-oncall .status-dot-live { background: #e67e22; animation: pulse-dot 1s infinite; }
.status-pause { background: #fde8e8; color: #e74c3c; }
.status-pause .status-dot-live { background: #e74c3c; }
.status-postcall { background: #e8eaf6; color: #5c6bc0; }
.status-postcall .status-dot-live { background: #5c6bc0; }
.status-offline { background: #eceff1; color: #90a4ae; }
.status-offline .status-dot-live { background: #90a4ae; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(1.3); }
}

.agent-card-stats {
    display: flex; gap: 0; border: 1px solid #f0f0f0; border-radius: 10px; overflow: hidden;
    margin-bottom: 12px;
}
.agent-stat {
    flex: 1; text-align: center; padding: 10px 6px; border-right: 1px solid #f0f0f0;
}
.agent-stat:last-child { border-right: none; }
.agent-stat-value { font-size: 18px; font-weight: 700; color: #333; }
.agent-stat-label { font-size: 10px; color: #999; text-transform: uppercase; margin-top: 2px; }
.sla-ok { color: var(--success); }
.sla-warn { color: var(--danger); }

.agent-card-groups { display: flex; flex-wrap: wrap; gap: 4px; }
.group-pill {
    display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px;
    background: #f0f4ff; color: var(--primary); border: 1px solid #d5dff5; font-weight: 500;
}

/* ═══════ QUEUE DISPATCH PANEL ═══════ */
.queue-panel {
    display: none; flex-direction: column; gap: 20px; padding: 24px;
    max-width: 1400px; margin: 0 auto; width: 100%;
}
.queue-header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 12px; border-bottom: 2px solid var(--primary);
}
.queue-header h2 { margin: 0; font-size: 22px; color: var(--primary); }
.queue-actions { display: flex; gap: 8px; }
.btn-dispatch {
    background: var(--primary); color: #fff; border: none; padding: 10px 20px;
    border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 14px;
    transition: all .2s;
}
.btn-dispatch:hover { background: #1a3fa0; transform: translateY(-1px); }
.btn-dispatch:disabled { opacity: .5; cursor: wait; }
.btn-refresh-q {
    background: #fff; border: 1px solid var(--border); padding: 10px 16px;
    border-radius: 8px; cursor: pointer; font-size: 14px;
}
.btn-refresh-q:hover { background: var(--bg-light); }

/* KPIs */
.queue-kpis {
    display: flex; gap: 16px; flex-wrap: wrap;
}
.q-kpi {
    flex: 1; min-width: 140px; text-align: center; background: #fff;
    border: 1px solid var(--border); border-radius: 12px; padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.q-kpi-val { font-size: 28px; font-weight: 700; color: var(--primary); }
.q-kpi-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.q-kpi-overflow .q-kpi-val { color: var(--danger); }

/* Columns */
.queue-columns {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px;
}
.queue-col h3 { font-size: 15px; margin: 0 0 12px; color: #333; }
.queue-col h3 .badge {
    display: inline-block; background: var(--primary); color: #fff;
    padding: 2px 8px; border-radius: 10px; font-size: 11px; margin-left: 6px;
}

/* Queue cards */
.queue-list, .dispatched-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.q-card {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 12px; border-left: 4px solid var(--primary);
    transition: box-shadow .2s;
}
.q-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.q-card-haute { border-left-color: #e74c3c; }
.q-card-moyenne { border-left-color: #f39c12; }
.q-card-basse { border-left-color: #27ae60; }
.q-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.q-ticket-id { font-weight: 600; font-size: 13px; color: var(--primary); }
.q-score { margin-left: auto; font-size: 11px; color: var(--muted); background: #f5f7fa; padding: 2px 8px; border-radius: 8px; }
.q-prio { font-size: 11px; padding: 2px 8px; border-radius: 8px; font-weight: 500; }
.q-prio-haute { background: #fdeaea; color: #c0392b; }
.q-prio-moyenne { background: #fef5e7; color: #e67e22; }
.q-prio-basse { background: #eafaf1; color: #27ae60; }
.q-card-subject { font-size: 13px; color: #333; margin-bottom: 6px; }
.q-card-meta { display: flex; gap: 12px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.q-card-prev { font-size: 11px; color: #7f8c8d; margin-top: 4px; font-style: italic; }
.q-card-actions { margin-top: 8px; }
.q-card-actions button {
    font-size: 11px; padding: 4px 12px; border: 1px solid var(--border);
    border-radius: 6px; background: #fff; cursor: pointer;
}
.q-card-actions button:hover { background: var(--bg-light); }

/* Dispatched cards */
.q-dispatched-card {
    background: #f0faf0; border: 1px solid #d4edda; border-radius: 8px;
    padding: 10px;
}
.q-dispatched-header { display: flex; justify-content: space-between; font-size: 13px; }
.q-agent { font-weight: 600; color: var(--primary); }
.q-dispatched-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.q-reason {
    display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 6px;
    background: #e8f4fd; color: #2980b9; font-weight: 500;
}

/* Dispatch log */
.dispatch-log { display: flex; flex-direction: column; gap: 4px; max-height: 400px; overflow-y: auto; font-size: 12px; }
.q-log-entry {
    display: flex; gap: 8px; padding: 6px 10px; background: #fafbfc;
    border-radius: 6px; border-left: 3px solid #ddd; align-items: center; flex-wrap: wrap;
}
.q-log-enqueue { border-left-color: #3498db; }
.q-log-dispatch { border-left-color: #27ae60; }
.q-log-overflow { border-left-color: #e74c3c; }
.q-log-manual_assign { border-left-color: #f39c12; }
.q-log-lock { border-left-color: #9b59b6; }
.q-log-release { border-left-color: #1abc9c; }
.q-log-time { color: var(--muted); font-family: monospace; }
.q-log-action { font-weight: 600; text-transform: uppercase; font-size: 10px; min-width: 70px; }
.q-log-ticket { color: var(--primary); font-weight: 500; }
.q-log-agent { color: #27ae60; }
.q-log-reason { color: var(--muted); font-style: italic; }
.q-empty { text-align: center; padding: 24px; color: var(--muted); font-size: 14px; }

/* Agent skills grid */
.queue-agents-section { margin-top: 8px; }
.queue-agents-section h3 { font-size: 15px; color: #333; margin: 0 0 12px; }
.agent-skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.q-agent-card {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 14px; text-align: center;
}
.q-agent-ok { border-top: 3px solid #27ae60; }
.q-agent-busy { border-top: 3px solid #f39c12; }
.q-agent-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.q-agent-status { font-size: 12px; margin-bottom: 8px; }
.q-agent-bar-wrap {
    position: relative; background: #ecf0f1; border-radius: 6px;
    height: 20px; overflow: hidden; margin-bottom: 8px;
}
.q-agent-bar {
    position: absolute; top: 0; left: 0; height: 100%;
    background: linear-gradient(90deg, #27ae60, #f39c12); border-radius: 6px;
    transition: width .3s;
}
.q-agent-bar-wrap span {
    position: relative; z-index: 1; font-size: 11px; font-weight: 600;
    line-height: 20px; color: #333;
}
.q-agent-cats { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.q-agent-channels { font-size: 16px; }

/* ── Drag & Drop ── */
.q-card[draggable="true"] { cursor: grab; }
.q-card[draggable="true"]:active { cursor: grabbing; }
.q-card-dragging {
    opacity: .45; transform: scale(.96); box-shadow: 0 8px 24px rgba(0,0,0,.15);
    border: 2px dashed var(--primary);
}
.q-drop-hint {
    font-size: 10px; color: var(--muted); text-align: center;
    margin-top: 8px; opacity: 0; transition: opacity .2s;
}
.q-agent-drop-ready {
    border: 2px dashed var(--primary); animation: pulse-border .8s infinite alternate;
}
.q-agent-drop-ready .q-drop-hint { opacity: 1; }
.q-agent-drop-hover {
    background: #e8f4fd !important; border-color: var(--primary) !important;
    transform: scale(1.04); box-shadow: 0 8px 24px rgba(37,99,235,.2);
    transition: all .15s ease;
}
@keyframes pulse-border {
    0% { border-color: rgba(37,99,235,.3); }
    100% { border-color: rgba(37,99,235,.8); }
}

/* ── Assign Modal ── */
.assign-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000; backdrop-filter: blur(3px);
    animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.assign-modal {
    background: #fff; border-radius: 16px; width: 480px; max-width: 92vw;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,.2);
    animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.assign-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px 12px; border-bottom: 1px solid var(--border);
}
.assign-modal-header h3 { margin: 0; font-size: 18px; color: #1e293b; }
.assign-modal-close {
    background: none; border: none; font-size: 24px; cursor: pointer;
    color: var(--muted); width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.assign-modal-close:hover { background: #f1f5f9; color: #333; }
.assign-modal-ticket {
    padding: 8px 24px; font-size: 14px;
}
.assign-modal-subtitle {
    padding: 4px 24px 12px; font-size: 13px; color: var(--muted);
}
.assign-modal-agents { padding: 0 16px 16px; }
.assign-agent-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-radius: 10px; margin-bottom: 6px;
    border: 1px solid var(--border); transition: all .15s;
}
.assign-agent-ok { cursor: pointer; }
.assign-agent-ok:hover {
    background: #f0f7ff; border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(37,99,235,.1);
    transform: translateX(4px);
}
.assign-agent-full {
    opacity: .45; cursor: not-allowed; background: #fafafa;
}
.assign-agent-info { display: flex; flex-direction: column; gap: 2px; }
.assign-agent-name { font-weight: 600; font-size: 14px; }
.assign-agent-cats { font-size: 11px; color: var(--muted); }
.assign-agent-load { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 130px; }
.assign-agent-bar-wrap {
    width: 100px; height: 8px; background: #ecf0f1; border-radius: 4px; overflow: hidden;
}
.assign-agent-bar {
    height: 100%; background: #27ae60; border-radius: 4px; transition: width .3s;
}
.assign-agent-bar.bar-warn { background: #f39c12; }
.assign-agent-bar.bar-danger { background: #e74c3c; }
.assign-agent-count { font-size: 11px; color: var(--muted); }
.assign-no-agent {
    text-align: center; padding: 16px; color: var(--danger);
    font-weight: 500; font-size: 14px;
}

/* ═══════════ SIMULATION PANEL ═══════════ */
.sim-panel {
    padding: 24px 32px; max-width: 1200px; margin: 0 auto;
}
.sim-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.sim-header h2 { margin: 0; font-size: 22px; color: #1e293b; }
.sim-header-actions { display: flex; gap: 10px; }
.sim-btn-start, .sim-btn-stop, .sim-btn-reset {
    padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px;
    font-weight: 600; cursor: pointer; transition: all .2s;
}
.sim-btn-start { background: #22c55e; color: #fff; }
.sim-btn-start:hover { background: #16a34a; }
.sim-btn-stop { background: #ef4444; color: #fff; }
.sim-btn-stop:hover { background: #dc2626; }
.sim-btn-reset { background: #64748b; color: #fff; }
.sim-btn-reset:hover { background: #475569; }

.sim-stats {
    display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.sim-stat {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 14px 20px; flex: 1; min-width: 120px; text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sim-stat-val { display: block; font-size: 22px; font-weight: 700; color: #1e293b; }
.sim-stat-lbl { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.sim-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px;
}
.sim-section {
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sim-section h3 { margin: 0 0 14px; font-size: 15px; color: #334155; }

.sim-control { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.sim-control label { font-size: 13px; color: #475569; min-width: 130px; }
.sim-control input[type="range"] { flex: 1; accent-color: var(--primary); }
.sim-control span { font-size: 14px; font-weight: 600; color: #1e293b; min-width: 50px; text-align: right; }

.sim-ch, .sim-cat, .sim-prio {
    display: flex; align-items: center; gap: 8px; padding: 6px 0;
    font-size: 13px; color: #475569; border-bottom: 1px solid #f1f5f9;
}
.sim-ch:last-child, .sim-cat:last-child, .sim-prio:last-child { border-bottom: none; }
.sim-weight {
    width: 52px; border: 1px solid #e2e8f0; border-radius: 6px;
    padding: 4px 6px; font-size: 12px; text-align: center; margin-left: auto;
}

.sim-log-section { margin-top: 0; }
.sim-log {
    max-height: 320px; overflow-y: auto; font-family: 'JetBrains Mono', monospace;
    font-size: 12px; background: #0f172a; color: #e2e8f0; border-radius: 8px;
    padding: 14px; line-height: 1.8;
}
.sim-log-entry { border-bottom: 1px solid rgba(255,255,255,.06); padding: 2px 0; }
.sim-log-time { color: #94a3b8; margin-right: 8px; }
.sim-log-ch {
    background: rgba(99,102,241,.2); color: #818cf8; padding: 1px 6px;
    border-radius: 4px; font-size: 11px; margin-left: 6px;
}
.sim-log-empty { color: #64748b; text-align: center; padding: 30px; font-style: italic; }
