:root {
  --bg: #0b0d12; --panel: #12151d; --panel-2: #171b25; --line: #232837;
  --text: #e8ecf4; --muted: #8b93a7; --accent: #00aad0; --accent-2: #002c5f;
  --ok: #2ecc8f; --warn: #f2a71b; --err: #ef4444;
  --radius: 12px; --shadow: 0 8px 30px rgba(0,0,0,.35);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg); color: var(--text); min-height: 100vh;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
p  { color: var(--muted); }
.hidden { display: none !important; }

/* ── Chrome ─────────────────────────────────────────────────────────── */
header.top {
  display: flex; align-items: center; gap: 16px; padding: 0 22px; height: 58px;
  border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 50;
}
.logo { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.logo span { color: var(--accent); }
.top nav { display: flex; gap: 4px; margin-left: 18px; }
.top nav button {
  background: none; border: none; color: var(--muted); font: inherit; font-size: 13px;
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
}
.top nav button:hover { color: var(--text); background: var(--panel-2); }
.top nav button.active { color: var(--text); background: var(--panel-2); font-weight: 600; }
.spacer { flex: 1; }
main { max-width: 1080px; margin: 0 auto; padding: 26px 22px 80px; }

/* ── Éléments ───────────────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid.c2, .grid.c3 { grid-template-columns: 1fr; } }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 550; }
input, select, textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 12px; border-radius: 9px; font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 78px; font-size: 13px; }
.field + .field { margin-top: 13px; }

button.btn {
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; border: none;
  padding: 9px 17px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .12s, opacity .2s;
}
button.btn:hover:not(:disabled) { transform: translateY(-1px); }
button.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.ghost { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
button.ghost:hover:not(:disabled) { border-color: var(--accent); }
button.danger { background: none; border: 1px solid var(--line); color: var(--err); }
button.tiny { padding: 5px 10px; font-size: 12px; border-radius: 7px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: rgba(46,204,143,.3); }
.pill.warn { color: var(--warn); border-color: rgba(242,167,27,.3); }
.pill.err { color: var(--err); border-color: rgba(239,68,68,.3); }

.note { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.note.warn { color: var(--warn); }
.note.err { color: var(--err); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ── Auth ───────────────────────────────────────────────────────────── */
.auth-wrap { max-width: 380px; margin: 9vh auto; }
.auth-wrap .card { padding: 26px; }
.auth-tabs { display: flex; gap: 3px; margin-bottom: 18px; background: var(--panel-2); padding: 3px; border-radius: 10px; }
.auth-tabs button { flex: 1; background: none; border: none; color: var(--muted); font: inherit; font-size: 13px;
  padding: 7px; border-radius: 8px; cursor: pointer; }
.auth-tabs button.active { background: var(--panel); color: var(--text); font-weight: 600; }

/* ── Projets ────────────────────────────────────────────────────────── */
.project-card { cursor: pointer; transition: border-color .18s; }
.project-card:hover { border-color: var(--accent); }
.project-card .meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ── Étapes ─────────────────────────────────────────────────────────── */
.steps { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.steps button {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 13px;
  padding: 8px 15px; border-radius: 9px; cursor: pointer; display: flex; align-items: center; gap: 7px;
}
.steps button.active { border-color: var(--accent); color: var(--text); background: var(--panel-2); }
.steps .num { width: 19px; height: 19px; border-radius: 50%; background: var(--panel-2); display: grid;
  place-items: center; font-size: 11px; font-weight: 700; }
.steps button.active .num, .steps button.done .num { background: var(--accent); color: #04121a; }
.steps button.done { color: var(--text); }

/* ── Upload ─────────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 32px; text-align: center;
  transition: border-color .2s, background .2s; cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: rgba(0,170,208,.04); }
.dropzone strong { display: block; margin-bottom: 4px; }

.pano-list { display: flex; flex-direction: column; gap: 9px; margin-top: 15px; }
.pano {
  display: flex; align-items: center; gap: 13px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 13px;
}
.pano img { width: 84px; height: 42px; object-fit: cover; border-radius: 6px; background: #000; flex-shrink: 0; }
.pano .info { flex: 1; min-width: 0; }
.pano .info strong { display: block; font-size: 13.5px; }
.pano .info .sub { font-size: 11.5px; color: var(--muted); }
.pano .handle { color: var(--muted); cursor: grab; padding: 0 4px; user-select: none; }
.pano.dragging { opacity: .4; }

/* ── Aperçu 360 ─────────────────────────────────────────────────────── */
.stage-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
#editor-stage { width: 100%; height: 340px; display: block; background: #000; touch-action: none; cursor: grab; }
.stage-bar {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 13px; display: flex; gap: 9px;
  align-items: center; background: linear-gradient(transparent, rgba(0,0,0,.8));
}
.stage-bar .angle { font-size: 11.5px; color: rgba(255,255,255,.65); font-family: ui-monospace, monospace; }

/* ── Tableaux ───────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 10px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

/* ── Statistiques ───────────────────────────────────────────────────── */
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 15px; }
.stat .value { font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.stat .label { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

pre.prompt {
  background: #090b10; border: 1px solid var(--line); border-radius: 10px; padding: 15px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; max-height: 460px; overflow-y: auto; color: #b9c3d6;
}

/* ── Notifications ──────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(14px); z-index: 999;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 11px 18px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { border-color: rgba(46,204,143,.4); }
#toast.err { border-color: rgba(239,68,68,.45); }

.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 34px; color: var(--muted); font-size: 13.5px; }

/* ── Dashboard : conversations, niveaux d'intérêt, visiteurs ─────────────── */
.grid.c4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } }

.stat.hot .value { color: #ff8a4c; }

.conv {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-top: 12px; background: var(--panel-2);
}
.conv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conv-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.conv-title strong { font-size: 14px; }
.conv-summary {
  margin-top: 10px; font-size: 13px; line-height: 1.55; color: var(--muted);
  border-left: 2px solid var(--line); padding-left: 12px;
}
.conv-rooms { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11px; padding: 3px 9px; border-radius: 20px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted);
}

/* Niveau d'intérêt : chaud / tiède / froid */
.level {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 6px; white-space: nowrap;
}
.level.chaud { background: rgba(255,138,76,.16); color: #ff9a63; border: 1px solid rgba(255,138,76,.35); }
.level.tiede { background: rgba(233,196,106,.14); color: #e9c46a; border: 1px solid rgba(233,196,106,.3); }
.level.froid { background: rgba(255,255,255,.06); color: var(--muted); border: 1px solid var(--line); }

.score {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.05);
  border: 1px solid var(--line); white-space: nowrap;
}
.score small { font-size: 10px; opacity: .5; }

.conv-detail { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.conv-audio { display: flex; flex-direction: column; gap: 6px; }
.conv-audio audio { width: 100%; height: 38px; }
.conv-data { margin-top: 14px; }
.kv { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.kv > div {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 8px;
}
.kv .k { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv .v { font-size: 13px; }

.conv-transcript { margin-top: 14px; }
.conv-transcript summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.conv-transcript summary:hover { color: var(--text); }
.turns { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; }
.turn { display: grid; grid-template-columns: 78px 1fr; gap: 10px; font-size: 13px; }
.turn .who { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.turn p { line-height: 1.55; }
.turn.user p { color: var(--text); }
.turn.agent p { color: var(--muted); }

/* ── Abonnement : quotas et formules ─────────────────────────────────────── */
.quota { margin-bottom: 16px; }
.quota:last-child { margin-bottom: 0; }
.bar { height: 7px; background: rgba(255,255,255,.07); border-radius: 4px; margin-top: 7px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s ease; }
.bar .fill.warn { background: var(--warn); }
.bar .fill.err  { background: var(--err); }
.mono.warn { color: var(--warn); }
.mono.err  { color: var(--err); }

.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
@media (max-width: 860px) { .plans { grid-template-columns: 1fr; } }
.plan {
  border: 1px solid var(--line); border-radius: 12px; padding: 18px;
  background: var(--panel-2); display: flex; flex-direction: column; gap: 10px;
}
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-name { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.plan-price { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.plan-price small { font-size: 12px; font-weight: 400; color: var(--muted); }
.plan ul { list-style: none; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.plan ul li { color: var(--muted); }
.plan ul li strong { color: var(--text); }
.plan-feats { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.plan-feats span::before { content: '✓ '; color: var(--ok); }
.plan-margin {
  font-size: 11.5px; line-height: 1.5; padding: 8px 10px; border-radius: 8px; margin-top: 4px;
}
.plan-margin.pos { background: rgba(46,204,143,.1); color: #7fe0b8; }
.plan-margin.neg { background: rgba(239,68,68,.1);  color: #ff9b9b; }
.plan-margin .note { color: inherit; opacity: .65; }
.plan button { margin-top: auto; }
p.note.warn { color: var(--warn); }
.tokens-left {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  padding: 4px 11px; border-radius: 20px; background: rgba(0,170,208,.12);
  color: var(--accent); border: 1px solid rgba(0,170,208,.3);
}
.field .hint { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.45; }

/* ── Leads : coordonnées, enregistrement, résumé au même endroit ─────────── */
.lead-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.lead {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; background: var(--panel-2);
}
.lead-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lead-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lead-id strong { font-size: 14px; }
.lead-meta { margin-top: 8px; font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lead-summary {
  margin-top: 10px; font-size: 13px; line-height: 1.55; color: var(--muted);
  border-left: 2px solid var(--line); padding-left: 12px;
}
.lead-detail { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.tag-audio {
  font-size: 11px; padding: 3px 9px; border-radius: 20px; white-space: nowrap;
  background: rgba(0,170,208,.12); color: var(--accent); border: 1px solid rgba(0,170,208,.3);
}

/* ── Administration : panneau de gestion d'un compte ─────────────────────── */
.acct-panel > td { padding: 0 !important; background: rgba(255,255,255,.02); }
.acct-detail { padding: 16px 14px; border-top: 1px solid var(--line); }
.acct-detail h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 8px; }
.acct-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; }
.acct-detail table.inner { width: 100%; border-collapse: collapse; }
.acct-detail table.inner td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line);
  vertical-align: middle; font-size: 13px; }
.acct-detail table.inner tr:last-child td { border-bottom: 0; }
.acct-detail table.inner select { padding: 4px 8px; font-size: 12px; }
.acct-actions { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.acct-actions .field label { font-size: 11px; }
.btn.danger, .btn.ghost.danger { color: var(--err); border-color: rgba(239,68,68,.3); }
.btn.danger:hover, .btn.ghost.danger:hover { border-color: var(--err); }
@media (max-width: 860px) { .acct-cols { grid-template-columns: 1fr; } }
