/* CRM Callcenter — feuille unique. Couleurs reprises du logo Excelia Group : violet #5B2BD6 → orange #F59E42. */
:root {
  --violet: #5B2BD6; --violet-d: #4520AE; --violet-l: #EEE8FD; --orange: #F59E42;
  --navy: #0F172A; --navy-2: #1E293B; --navy-txt: #CBD5E1;
  --bg: #F6F7FB; --card: #FFFFFF; --text: #0F172A; --muted: #5B6578; --border: #E4E7EF;
  --ok: #15803D; --ok-l: #E7F6EC; --warn: #B45309; --warn-l: #FEF3E2; --err: #B91C1C; --err-l: #FDECEC;
  --radius: 14px; --side-w: 244px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--violet-d); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.ico { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- connexion */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(90% 90% at 100% 100%, rgba(245,158,66,.35) 0%, transparent 55%),
              radial-gradient(90% 90% at 0% 0%, rgba(91,43,214,.55) 0%, transparent 60%), var(--navy); }
.login-card { background: #fff; padding: 36px 32px; border-radius: 18px; width: 100%; max-width: 390px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.login-card img { display: block; width: 190px; height: auto; margin: 0 auto 6px; }
.login-card h1 { text-align: center; font-size: 18px; margin: 8px 0 2px; }
.login-card .sub { color: var(--muted); text-align: center; margin-bottom: 20px; font-size: 13px; }
.login-card .btn { width: 100%; margin-top: 18px; justify-content: center; padding: 11px; }

/* ---------- structure */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--side-w); flex-shrink: 0; background: var(--navy); color: var(--navy-txt); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; }
.sidebar .logo { padding: 20px 20px 6px; }
.sidebar .logo img { display: block; width: 150px; height: auto; }
.sidebar .tagline { color: #94A3B8; font-size: 11.5px; padding: 0 20px 12px; }
.sidebar nav { padding: 6px 12px; flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; color: var(--navy-txt); border-radius: 10px; margin-bottom: 2px; text-decoration: none; transition: background .15s, color .15s; }
.sidebar nav a:hover { background: var(--navy-2); color: #fff; }
.sidebar nav a.active { background: linear-gradient(90deg, var(--violet), #7A4BE8); color: #fff; font-weight: 600; }
.sidebar nav .badge { margin-left: auto; background: var(--orange); color: #1F1300; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 7px; }
.sidebar .nav-titre { margin: 16px 12px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #64748B; }
.sidebar .user { margin: 10px 12px 14px; padding: 10px; background: var(--navy-2); border-radius: 12px; display: flex; align-items: center; gap: 10px; font-size: 12px; }
.sidebar .avatar { width: 34px; height: 34px; flex-shrink: 0; background: var(--violet); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.sidebar .user-txt { min-width: 0; flex: 1; }
.sidebar .user-nom { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user-sub { color: #94A3B8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user a { color: #C4B5FD; font-size: 11px; }
.icon-btn { background: none; border: 0; color: #94A3B8; cursor: pointer; padding: 6px; border-radius: 8px; display: inline-flex; }
.icon-btn:hover { color: #fff; background: rgba(255,255,255,.06); }
.main { flex: 1; min-width: 0; padding: 26px 30px 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar h1 { font-size: 23px; font-weight: 700; letter-spacing: -.01em; }
.topbar .sous { color: var(--muted); font-size: 13px; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.menu-mobile { display: none; }

/* ---------- boutons, champs */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font-weight: 600; font-size: 13.5px; background: var(--violet); color: #fff; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--violet-d); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sec { background: #fff; color: var(--text); border-color: var(--border); }
.btn.sec:hover { border-color: #C7CCDA; background: #FAFAFD; }
.btn.ok { background: var(--ok); } .btn.ok:hover { background: #116632; }
.btn.danger { background: #fff; color: var(--err); border-color: #F3C2C2; } .btn.danger:hover { background: var(--err-l); }
.btn.petit { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
label { display: block; font-size: 12px; font-weight: 600; color: #334155; margin: 12px 0 5px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 14px; }
input:focus, select:focus, textarea:focus { border-color: var(--violet); outline: none; box-shadow: 0 0 0 3px var(--violet-l); }
textarea { min-height: 80px; resize: vertical; }
.req::after { content: " *"; color: var(--err); }
.grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grille .plein { grid-column: 1 / -1; }
.err { color: var(--err); font-size: 13px; min-height: 18px; margin-top: 8px; }
.aide { color: var(--muted); font-size: 12.5px; }

/* ---------- cartes */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .droite { margin-left: auto; font-weight: 500; font-size: 12.5px; color: var(--muted); }
.pile { display: grid; gap: 18px; }

/* ---------- tableau de bord */
.periodes { display: inline-flex; background: #fff; border: 1px solid var(--border); border-radius: 11px; padding: 3px; }
.periodes button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.periodes button.on { background: var(--navy); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c, var(--violet)); }
.kpi .t { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .t .pastille { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c, var(--violet)) 12%, white); color: var(--c, var(--violet)); }
.kpi .v { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin-top: 8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi.hero { background: linear-gradient(135deg, var(--navy) 0%, #2A1C6B 60%, var(--violet) 100%); color: #fff; border: 0; }
.kpi.hero::before { display: none; }
.kpi.hero .t, .kpi.hero .s { color: #C9C3EA; }
.kpi.hero .t .pastille { background: rgba(255,255,255,.12); color: #fff; }
.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.chart > svg { width: 100%; height: auto; display: block; }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut-wrap svg { width: 150px; height: 150px; flex-shrink: 0; }
.donut-liste { flex: 1; min-width: 140px; display: grid; gap: 5px; font-size: 13px; }
.donut-liste div { display: flex; align-items: center; gap: 8px; }
.donut-liste b { margin-left: auto; font-variant-numeric: tabular-nums; }
.entonnoir { display: grid; gap: 9px; }
.entonnoir .l { display: grid; grid-template-columns: 110px 1fr 54px; align-items: center; gap: 10px; font-size: 13px; }
.entonnoir .barre { height: 12px; border-radius: 6px; background: #EEF0F6; overflow: hidden; }
.entonnoir .barre span { display: block; height: 100%; border-radius: 6px; }
.entonnoir b { text-align: right; font-variant-numeric: tabular-nums; }
.vide { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 13.5px; }
.vide .ico { width: 28px; height: 28px; margin: 0 auto 8px; display: block; color: #A3AAC0; }

/* ---------- listes et tableaux */
.filtres { display: grid; grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.filtres input, .filtres select { padding: 8px 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 11px 14px; background: #FAFBFD; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #F0F2F7; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.clic { cursor: pointer; } tbody tr.clic:hover td { background: #FAF8FF; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.statut { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 13%, white); color: color-mix(in srgb, var(--c) 80%, black); }
.statut::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.sig { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; color: var(--warn); background: var(--warn-l); border-radius: 999px; padding: 2px 8px; margin-left: 6px; white-space: nowrap; }
.pied { display: flex; justify-content: space-between; align-items: center; padding: 10px 2px; color: var(--muted); font-size: 13px; flex-wrap: wrap; gap: 8px; }
.muted { color: var(--muted); }

/* ---------- fiche RDV */
.fiche { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.infos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.infos .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.infos .v { font-size: 14px; margin-top: 2px; word-break: break-word; }
.infos .plein { grid-column: 1 / -1; }
.bandeau { border-radius: 12px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.bandeau.warn { background: var(--warn-l); color: #7A3E06; border: 1px solid #F6D6A8; }
.bandeau.info { background: var(--violet-l); color: #3A1D8F; border: 1px solid #DCD0FB; }
.bandeau .ico { margin-top: 2px; }
.boutons { display: flex; gap: 8px; flex-wrap: wrap; }
.histo { list-style: none; position: relative; }
.histo li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.histo li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--violet); }
.histo li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.histo li:last-child::after { display: none; }
.histo .q { color: var(--muted); font-size: 12px; }
.histo .d { margin-top: 3px; white-space: pre-wrap; word-break: break-word; }

/* ---------- fenêtre, toasts, notifications */
.voile { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modale { background: #fff; border-radius: 16px; width: 100%; max-width: 480px; padding: 22px; box-shadow: 0 30px 70px rgba(0,0,0,.3); max-height: 92vh; overflow-y: auto; }
.modale h3 { font-size: 17px; margin-bottom: 6px; }
.modale .boutons { justify-content: flex-end; margin-top: 18px; }
.secret { font-family: Consolas, "SFMono-Regular", monospace; font-size: 17px; background: #F3F4F8; padding: 10px 12px; border-radius: 10px; user-select: all; word-break: break-all; margin-top: 8px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 360px; }
.toast.err { background: var(--err); }
.notifs { position: absolute; right: 0; top: 44px; width: 340px; max-height: 420px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 20px 50px rgba(15,23,42,.18); z-index: 40; }
.notifs .n { padding: 10px 14px; border-bottom: 1px solid #F0F2F7; font-size: 13px; cursor: pointer; }
.notifs .n:hover { background: #FAF8FF; }
.notifs .n.nonlu { border-left: 3px solid var(--violet); }
.notifs .q { color: var(--muted); font-size: 11.5px; }
.cloche { position: relative; }
.cloche .pt { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; border-radius: 999px; background: var(--orange); color: #1F1300; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ---------- petits écrans */
@media (max-width: 1100px) { .dash, .fiche { grid-template-columns: 1fr; } .filtres { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 45; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.ouvert { transform: none; }
  .main { padding: 16px 16px 40px; }
  .menu-mobile { display: inline-flex; color: var(--text); }
  .grille, .infos { grid-template-columns: 1fr; }
  .filtres { grid-template-columns: 1fr; }
  .kpi .v { font-size: 26px; }
  .notifs { width: min(340px, calc(100vw - 32px)); }
}
