/* DS NOVA — tableau de bord administrateur. Fond noir, style futuriste.
   Couleurs produit : rouge DS NOVA IA, cyan NOVA YOLO, violet NOVA BOOST, vert NOVA AUDIO.
   Couleurs de graphique validées (contraste, daltonisme) sur la surface #0b0d12 :
   #E94937 · #0aa2bd · #A855F7 (le cyan d'interface #06B6D4 est trop clair pour des marques de données). */
:root {
  color-scheme: dark;
  --bg: #050608;
  --surface-1: #0b0d12;
  --surface-2: #11151c;
  --border: #1e2530;
  --grid: #1a2029;
  --text-primary: #eef2f6;
  --text-secondary: #94a0b0;
  --text-muted: #5f6b7a;
  --accent: #d6dae0;
  --ds-nova-ia: #E94937;
  --yolo-nova: #06B6D4;
  --nova-boost: #A855F7;
  --nova-audio: #22C55E;
  --series-ds-nova-ia: #E94937;
  --series-yolo-nova: #0aa2bd;
  --series-nova-boost: #A855F7;
  --series-nova-audio: #16a34a; /* même teinte, assombrie : #22C55E échoue la bande de luminosité des graphiques sur fond sombre */
  --series-1: #0aa2bd;
  --good: #22c55e;
  --warning: #f59e0b;
  --critical: #ef4444;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary); font: 14px/1.5 var(--font); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; background: radial-gradient(1000px 420px at 50% -12%, rgba(255,255,255,.04), transparent 70%); }
a { color: var(--text-primary); text-underline-offset: 3px; }
button, input, select, textarea {
  font: inherit; color: var(--text-primary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px;
}
button { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
button:hover { border-color: #4a515c; background: #171b22; }
button.primary { background: #eceef1; color: #0a0b0d; border-color: #eceef1; font-weight: 600; }
button.primary:hover { background: #fff; border-color: #fff; }
button.danger:hover { background: rgba(239,68,68,.12); border-color: #ef4444; }
button.danger { border-color: rgba(239,68,68,.5); color: #fca5a5; }
button:disabled { opacity: .5; cursor: not-allowed; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: grid; gap: 4px; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100vh; }
nav.side { border-right: 1px solid var(--border); padding: 20px 14px; background: rgba(11,13,18,.85); backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .18em; font-size: 14px; margin: 2px 8px 18px; }
.brand small { font-weight: 500; letter-spacing: .04em; color: var(--text-muted); font-size: 11px; }
nav.side .grp { margin: 14px 10px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.brand span { color: var(--text-primary); }
nav.side button { display: block; width: 100%; text-align: left; margin: 1px 0; padding: 6px 10px; background: transparent; border-color: transparent; color: var(--text-secondary); }
nav.side button.active { color: var(--text-primary); border-color: var(--border); background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.side .foot { margin-top: 28px; font-size: 12px; color: var(--text-muted); display: grid; gap: 8px; }
main { padding: 22px 28px 60px; max-width: 1400px; min-width: 0; }
.card { overflow-x: auto; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: .02em; }
h2 { font-size: 13px; margin: 0 0 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.sub { color: var(--text-secondary); margin: 0 0 20px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.card { background: rgba(11,13,18,.92); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .h { color: var(--text-muted); font-size: 11px; }
.charts { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.st { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid color-mix(in srgb, currentColor 40%, transparent); background: color-mix(in srgb, currentColor 10%, transparent); white-space: nowrap; }
.status-active, .status-succeeded, .status-valid, .status-approved, .status-answered, .status-delivered, .status-sent, .status-trialing { color: var(--good); }
.status-open, .status-queued, .status-pending, .status-opened, .status-clicked { color: #93c5fd; }
.status-closed, .status-skipped, .status-incomplete_expired { color: var(--text-muted); }
.status-waiting, .status-unpaid, .status-incomplete, .status-paused, .status-deferred, .status-soft_bounce { color: var(--warning); }
.status-rejected, .status-error, .status-bounced, .status-blocked, .status-spam, .status-hard_bounce { color: var(--critical); }
.status-expired, .status-canceled { color: var(--text-muted); }
.status-suspended, .status-past_due, .status-partially_refunded { color: var(--warning); }
.status-revoked, .status-failed, .status-refunded { color: var(--critical); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-secondary); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
tr.click:hover td { background: var(--surface-2); cursor: pointer; }
.empty { color: var(--text-muted); padding: 18px; text-align: center; }
.mono { font-family: var(--mono); font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: transparent; color: var(--text-secondary); }
.seg button.on { background: var(--surface-2); color: var(--text-primary); }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 420px; padding: 12px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 50; }
.toast.err { border-color: rgba(239,68,68,.6); }
.toast.ok { border-color: rgba(34,197,94,.6); }
dialog { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); border-radius: 12px; padding: 20px; max-width: 560px; width: 92vw; }
dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(3px); }
.keybox { font-family: var(--mono); font-size: 16px; padding: 12px; border: 1px dashed var(--accent); border-radius: 8px; user-select: all; word-break: break-all; }
.login { min-height: 100vh; display: grid; place-items: center; }
.login .card { width: 380px; display: grid; gap: 12px; }
.warn { border-left: 3px solid var(--warning); padding: 8px 12px; background: rgba(245,158,11,.07); border-radius: 6px; }
/* Graphiques */
.chart svg { width: 100%; height: 220px; display: block; overflow: visible; }
.chart .axis text { fill: var(--text-muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.chart { position: relative; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
@media (forced-colors: active) { .chart path, .chart rect { forced-color-adjust: auto; } }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } nav.side { border-right: 0; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px; padding: 12px; } nav.side button { width: auto; } nav.side .grp { display: none; } .side .foot { margin-top: 0; width: 100%; } main { padding: 16px; } .charts { grid-template-columns: 1fr; } }

/* ---- Finalisation globale : textes longs, conversations, temps réel ---- */
h1, h2, h3, td, p, .sub, .card { overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 52ch; }
h2.clamp { max-width: none; -webkit-line-clamp: 3; }
.thread { display: grid; gap: 10px; max-height: min(58vh, 620px); overflow-y: auto; overscroll-behavior: contain; padding: 6px 6px 6px 0; margin: 10px 0; }
.bubble { max-width: min(92%, 820px); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: rgba(255,255,255,.02); }
.bubble.customer { justify-self: end; background: #121a24; border-color: #2c3a4d; }
.bubble.staff { justify-self: start; border-color: #E94937; }
.bubble.ai { justify-self: start; border-style: dashed; border-color: #0e7490; }
.bubble.internal { justify-self: stretch; max-width: none; border-style: dashed; border-color: #b45309; background: rgba(180,83,9,.08); }
.bubble .body { white-space: pre-wrap; margin-top: 6px; overflow-wrap: anywhere; }
.bubble .who::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #60a5fa; }
.bubble.staff .who::before { background: #E94937; } .bubble.ai .who::before { background: #06b6d4; } .bubble.internal .who::before { background: #f59e0b; }
.card.ticket #rf { position: sticky; bottom: 0; background: rgba(11,13,18,.97); padding-top: 8px; }
.side .cnt { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: #E94937; color: #fff; font-size: 11px; text-align: center; margin-left: 6px; }
.live { font-size: 11px; color: #22c55e; } .live.off { color: #f59e0b; }
* { scrollbar-color: #3a404a transparent; scrollbar-width: thin; }
.env-prod { background: #7f1d1d; color: #fff; border-radius: 8px; padding: 6px 10px; font-weight: 700; text-align: center; }
.envbtn { display: block; text-align: center; padding: 10px; border-radius: 8px; background: #eceef1; color: #0a0b0d; font-weight: 600; text-decoration: none; }
.chf input { width: 90px; text-align: right; font-variant-numeric: tabular-nums; }
details.arch { margin-top: 12px; border: 1px dashed var(--border); border-radius: 10px; padding: 8px 12px; }
details.arch summary { cursor: pointer; color: var(--text-muted); }
/* Remboursement : choix des conséquences */
dialog.refund{max-width:620px}
.rf-opt{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border:1px solid var(--line,#2a2f3a);border-radius:10px;margin:8px 0;cursor:pointer}
.rf-opt:has(input:checked){border-color:#f59e0b;background:rgba(245,158,11,.08)}
.rf-opt span{display:grid;gap:3px}.rf-opt small{opacity:.8;font-size:12.5px}
dialog.refund .notice ul{margin:6px 0 0;padding-left:18px}
/* NOVA Assistant : jauges de quotas */
.qbar{display:block;height:5px;margin-top:4px;border-radius:3px;background:rgba(148,163,184,.18);overflow:hidden;min-width:90px}
.qbar i{display:block;height:100%;background:#22c55e}.qbar i.warm{background:#f59e0b}.qbar i.hot{background:#ef4444}
