/* CRM des agents : thème sombre pour de longues journées, couleur de la marque en accent. */
:root {
  --bg: #0b0f14; --panel: #121821; --panel2: #18202b; --line: #243040; --text: #e6edf3; --muted: #8b98a8;
  --brand: #19E3D2; --brand-ink: #04211f; --ok: #3fb950; --warn: #d29922; --bad: #f85149; --info: #58a6ff;
  --radius: 10px; --gap: 16px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Boutons et champs */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel2); padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a4a5e; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.btn.danger { background: transparent; color: var(--bad); border-color: #5a2a2a; }
.btn.ok { background: var(--ok); color: #04150a; border-color: var(--ok); font-weight: 600; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.icon { padding: 7px; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 50%, transparent); border-color: var(--brand); }
textarea { resize: vertical; min-height: 90px; width: 100%; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
label.f > input, label.f > select, label.f > textarea { color: var(--text); font-size: 14px; }
.form { display: grid; gap: 12px; }
.form.cols { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Connexion */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch button { background: transparent; border: 0; padding: 5px 10px; cursor: pointer; color: var(--muted); }
.lang-switch button.on { background: var(--panel2); color: var(--text); }

/* Structure */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 700; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); }
.nav a:hover { background: var(--panel2); color: var(--text); }
.nav a.on { background: var(--panel2); color: var(--text); box-shadow: inset 3px 0 0 var(--brand); }
.nav .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
.nav .badge { margin-left: auto; }
.side .me { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 0; display: grid; gap: 8px; }
.main { padding: 20px 24px 120px; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.top h2 { margin: 0; font-size: 20px; }

/* Cartes et tableaux */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.stack { display: grid; gap: var(--gap); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.kpi b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi span { font-size: 12px; color: var(--muted); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 500; background: var(--panel2); position: sticky; top: 0; }
tbody tr:hover { background: var(--panel2); }
tbody tr.click { cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; min-width: 240px; }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }

/* Pastilles */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); background: var(--panel2); }
.pill.ok { color: var(--ok); border-color: #1f4a2a; }
.pill.warn { color: var(--warn); border-color: #4d3a12; }
.pill.bad { color: var(--bad); border-color: #5a2a2a; }
.pill.info { color: var(--info); border-color: #1d3a5f; }
.pill.brand { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.dot-s { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot-s.call { background: var(--info); } .dot-s.active { background: var(--ok); } .dot-s.idle { background: var(--warn); } .dot-s.offline { background: #3a4552; }
.flag { width: 20px; height: 15px; border-radius: 2px; vertical-align: -2px; object-fit: cover; }

/* Fiche client */
.head-contact { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.head-contact h2 { margin: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; }
.facts div span { display: block; font-size: 12px; color: var(--muted); }
.timeline { display: grid; gap: 2px; max-height: 520px; overflow-y: auto; }
.tl { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); align-items: start; }
.tl .svg { margin-top: 1px; color: var(--muted); }
.tl.deposit .svg { color: var(--ok); } .tl.note .svg { color: var(--brand); } .tl.call .svg { color: var(--info); } .tl.withdrawal .svg { color: var(--warn); }
.tl .body { white-space: pre-wrap; word-break: break-word; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-color: var(--brand); }
.outcomes { display: flex; flex-wrap: wrap; gap: 6px; }
.outcomes button { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 5px 11px; cursor: pointer; font-size: 13px; }
.outcomes button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Téléphone (en bas à droite) */
.phone { position: fixed; right: 16px; bottom: 16px; width: 300px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px #0008; z-index: 30; }
.phone .ph-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.phone .ph-body { padding: 12px; display: grid; gap: 10px; }
.phone.min .ph-body { display: none; }
.phone .who { font-size: 16px; font-weight: 600; }
.phone .timer { font-variant-numeric: tabular-nums; font-size: 22px; }
.ring { animation: ring 1s infinite; }
@keyframes ring { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .ring { animation: none; } }

/* Bandeaux, messages, fenêtres */
.banner { background: color-mix(in srgb, var(--warn) 12%, var(--panel)); border: 1px solid #4d3a12; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 60; box-shadow: 0 8px 20px #0008; max-width: calc(100% - 32px); }
.toast.bad { border-color: var(--bad); color: #ffb4ae; }
.toast.ok { border-color: var(--ok); }
.modal-bg { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--panel2); font-weight: 700; font-size: 12px; }
.rank.r1 { background: #b8860b; color: #1a1300; } .rank.r2 { background: #8a96a3; color: #0b0f14; } .rank.r3 { background: #8c5a2b; color: #fff; }

@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .side .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav .sep { display: none; }
  .side .me { margin: 0; border: 0; padding: 0 8px; }
  .main { padding: 14px 16px 140px; }
  .phone { left: 16px; right: 16px; width: auto; }
}

/* Classes utilitaires (pas de style en ligne : la politique de sécurité les bloque) */
.err-line { color: var(--bad); min-height: 18px; }
.search-in { min-width: 240px; }
.mb12 { margin-bottom: 12px; }
.upper { text-transform: uppercase; }
.gap16 { height: 16px; }
.report-body { white-space: pre-wrap; margin: 10px 0 0; }
.danger-card { border-color: #5a2a2a; }
