:root {
  --blue-900: #0f2557;
  --blue-800: #1a3a7a;
  --blue-700: #1e4fa3;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
a { color: var(--blue-600); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; color: #fff; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--blue-900) 0%, var(--blue-800) 55%, var(--blue-700) 100%);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.14);
  display: grid; place-items: center; font-weight: 800; letter-spacing: .5px; font-size: 13px;
}
.brand-title { font-weight: 700; font-size: 16px; line-height: 1.15; }
.brand-sub { font-size: 12px; opacity: .7; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,.82); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: rgba(255,255,255,.16); color: #fff; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .5; padding: 16px 12px 6px; }
.side-foot { margin-top: auto; font-size: 12px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.side-foot .who { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side-foot a { color: rgba(255,255,255,.85); }
.role-badge { font-size: 10px; padding: 2px 7px; border-radius: 99px; background: rgba(255,255,255,.18); text-transform: uppercase; letter-spacing: .05em; }
.version { opacity: .55; margin-top: 8px; }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.topbar-mobile { display: none; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; color: #fff;
  background: linear-gradient(120deg, var(--blue-700), var(--blue-500));
}
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card-head .sub { font-size: 12px; opacity: .85; }
.card-head { flex-wrap: wrap; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-head .seg { background: rgba(255,255,255,.18); }
.card-head .seg button { color: rgba(255,255,255,.9); }
.card-head .seg button.on { color: var(--blue-700); }
.step-num {
  width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.22);
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.card-body { padding: 18px; }
.card.green .card-head { background: linear-gradient(120deg, #15803d, #22c55e); }
.card.dim { opacity: .6; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  border-radius: var(--radius); padding: 16px 18px; color: #fff; box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
}
.stat:nth-child(2) { background: linear-gradient(135deg, #0e7490, #06b6d4); }
.stat:nth-child(3) { background: linear-gradient(135deg, #6d28d9, #a78bfa); }
.stat:nth-child(4) { background: linear-gradient(135deg, #15803d, #4ade80); }
.stat .label { font-size: 12px; opacity: .85; }
.stat .value { font-size: 24px; font-weight: 700; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=email], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }
textarea { resize: vertical; min-height: 130px; }
.field { margin-bottom: 14px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.row-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue-600); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 15px; border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  font-weight: 600; text-decoration: none; background: var(--blue-600); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--blue-700); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--blue-50); }
.btn.ghost { background: rgba(255,255,255,.18); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.28); }
.btn.danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.success { background: var(--green); }
.btn.success:hover { background: #15803d; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.big { padding: 12px 20px; font-size: 15px; }
.btn svg { width: 16px; height: 16px; }

/* Slider with numeric box */
.slider { display: grid; grid-template-columns: 1fr 74px; gap: 10px; align-items: center; }
.slider input[type=range] { width: 100%; accent-color: var(--blue-600); }
.slider input[type=number] { padding: 6px 8px; text-align: right; }
.unit { color: var(--muted); font-size: 12px; font-weight: 400; }

.seg { display: inline-flex; background: var(--blue-50); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--blue-700); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.counter { text-align: right; font-size: 12px; color: var(--muted); margin-top: 3px; }
.sent-text { background: var(--blue-50); border: 1px dashed var(--blue-500); border-radius: 9px; padding: 10px 12px; font-size: 13px; white-space: pre-wrap; }

details.adv { border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; margin-top: 10px; }
details.adv summary { cursor: pointer; padding: 11px 0; font-weight: 600; }
details.adv[open] { padding-bottom: 12px; }

/* ---------- Voice picker ---------- */
.voice-list { max-height: 270px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.voice-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.voice-item:last-child { border-bottom: 0; }
.voice-item:hover { background: var(--blue-50); }
.voice-item.on { background: var(--blue-100); }
.voice-item .name { font-weight: 600; }
.voice-item .meta { font-size: 12px; color: var(--muted); }
.voice-item .play { margin-left: auto; }
.voice-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px 4px; background: #f8fafc; position: sticky; top: 0; }

.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: #fff; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.icon-btn:hover { background: var(--blue-50); }
.icon-btn svg { width: 14px; height: 14px; }

/* ---------- Drop zone ---------- */
.drop {
  border: 2px dashed #cbd5e1; border-radius: 12px; padding: 18px; text-align: center; color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.drop:hover, .drop.over { border-color: var(--blue-500); background: var(--blue-50); color: var(--blue-700); }

/* ---------- Music choice ---------- */
.music-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.music-opt { border: 1.5px solid var(--border); border-radius: 11px; padding: 10px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.music-opt:hover { border-color: var(--blue-500); }
.music-opt.on { border-color: var(--blue-600); background: var(--blue-50); }
.music-opt .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-opt .m { font-size: 12px; color: var(--muted); }
.music-opt > div { min-width: 0; }

/* ---------- Preview ---------- */
.timeline { position: relative; height: 34px; border-radius: 8px; overflow: hidden; background: #f1f5f9; margin: 4px 0 12px; }
.timeline .seg-music { position: absolute; top: 0; bottom: 0; background: #c7d2fe; }
.timeline .seg-voice { position: absolute; top: 6px; bottom: 6px; background: var(--blue-600); border-radius: 5px; color: #fff; font-size: 11px; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; }
.timeline .seg-beep { position: absolute; top: 4px; bottom: 4px; width: 6px; background: var(--orange); border-radius: 3px; }
.tl-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.tl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.wave { width: 100%; height: 80px; display: block; cursor: pointer; border-radius: 8px; background: #f8fafc; }
.player { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.play-big { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--blue-600); color: #fff; display: grid; place-items: center; cursor: pointer; }
.play-big:hover { background: var(--blue-700); }
.play-big svg { width: 20px; height: 20px; }
.clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.metrics { display: flex; gap: 8px; flex-wrap: wrap; }
.metric { background: var(--blue-50); color: var(--blue-800); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.metric.warn { background: #fff7ed; color: var(--orange); }

.notice { border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: 13px; }
.notice.info { background: var(--blue-50); color: var(--blue-800); }
.notice.warn { background: #fff7ed; color: #9a3412; }
.notice.error { background: #fef2f2; color: #991b1b; }
.notice.ok { background: #f0fdf4; color: #166534; }

.loading { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.loading.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--blue-600); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Filtres par catégorie */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 99px; padding: 6px 14px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.chip:hover { border-color: var(--blue-500); color: var(--blue-700); }
.chip.on { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: #f8fafc; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--blue-50); color: var(--blue-700); }
.tag.admin { background: #ede9fe; color: #6d28d9; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px; }
audio { height: 34px; max-width: 260px; }

/* History cards */
.msg-list { display: grid; gap: 12px; }
.msg { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.msg h3 { margin: 0; font-size: 15px; }
.msg .meta { font-size: 12px; color: var(--muted); }
.msg .text { grid-column: 1 / -1; font-size: 13px; color: #334155; background: #f8fafc; border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; max-height: 4.8em; overflow: hidden; cursor: pointer; }
.msg .text.open { max-height: none; }
.msg .bar { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msg .bar audio { flex: 1; max-width: 420px; min-width: 200px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 620px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal .card-head { position: sticky; top: 0; }
.tpl { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.tpl:hover { border-color: var(--blue-500); background: var(--blue-50); }
.tpl .n { font-weight: 600; }
.tpl .b { font-size: 12px; color: var(--muted); }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 60; opacity: 0; transform: translateY(10px); transition: all .2s; pointer-events: none; max-width: calc(100vw - 40px); }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--red); }

/* Auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(160deg, var(--blue-900), var(--blue-700) 60%, var(--blue-500)); }
.auth .box { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth h1 { margin: 10px 0 2px; font-size: 22px; }
.auth .brand-logo { background: linear-gradient(135deg, var(--blue-700), var(--blue-500)); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .topbar-mobile { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: #fff; background: var(--blue-800); position: sticky; top: 0; z-index: 30; }
  .topbar-mobile button { background: transparent; border: 0; color: #fff; padding: 4px; cursor: pointer; }
  .main { padding: 18px 16px 50px; }
  .row-2 { grid-template-columns: 1fr; }
  .msg { grid-template-columns: 1fr; }
  .card-head .right { margin-left: 0; width: 100%; }
  .card-head .seg { width: 100%; }
  .card-head .seg button { flex: 1; }
}

/* ---------- Types de message (v1.2) ---------- */
.types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.type { border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer; background: #fff; text-align: left; transition: border-color .15s, background .15s; }
.type:hover { border-color: var(--blue-500); }
.type.on { border-color: var(--blue-600); background: var(--blue-50); box-shadow: 0 0 0 3px var(--blue-100); }
.type .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; margin-bottom: 10px; }
.type .ic svg { width: 20px; height: 20px; }
.type .n { font-weight: 700; font-size: 15px; }
.type .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.req { color: var(--red); }
.big-input { font-size: 16px; padding: 12px 14px !important; }
.tag.t-Accueil { background: #dbeafe; color: #1e4fa3; }
.tag.t-Attente { background: #cffafe; color: #0e7490; }
.tag.t-Répondeur { background: #ede9fe; color: #6d28d9; }
.tag.t-Occupation { background: #ffedd5; color: #c2410c; }
.field-error { border-color: var(--red) !important; box-shadow: 0 0 0 3px #fee2e2 !important; }
@media (max-width: 900px) { .types { grid-template-columns: 1fr 1fr; } }

/* ======================= v2.0 — Assistant 5 étapes ======================= */
.wizard-steps { display: flex; gap: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; margin-bottom: 18px; overflow-x: auto; }
.wstep { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; text-align: left; position: relative; color: var(--muted); }
.wstep:disabled { cursor: not-allowed; opacity: .55; }
.wstep:not(:last-child)::after { content: ""; position: absolute; right: -2px; top: 50%; width: 4px; height: 4px; border-top: 2px solid #cbd5e1; border-right: 2px solid #cbd5e1; transform: translateY(-50%) rotate(45deg); }
.wstep .num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #e2e8f0; color: var(--muted); flex-shrink: 0; font-size: 13px; }
.wstep .lbl { font-weight: 600; font-size: 13px; line-height: 1.2; }
.wstep .lbl small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wstep.current { background: var(--blue-50); color: var(--blue-800); }
.wstep.current .num { background: linear-gradient(135deg, var(--blue-700), var(--blue-500)); color: #fff; box-shadow: 0 0 0 4px var(--blue-100); }
.wstep.done { color: var(--text); }
.wstep.done .num { background: var(--green); color: #fff; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.panel-title { margin: 0 0 2px; font-size: 22px; }
.panel-sub { margin: 0 0 16px; color: var(--muted); }
.wpanel[hidden] { display: none !important; }
.wcard { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

/* Contrôles façon maquette */
.seg-big { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #f1f5f9; border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.seg-big button { border: 0; background: transparent; text-align: left; padding: 10px 14px; border-radius: 9px; cursor: pointer; }
.seg-big button b { display: block; font-size: 14px; color: var(--text); }
.seg-big button span { font-size: 12px; color: var(--muted); }
.seg-big button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg-gender { display: inline-grid; grid-template-columns: repeat(3, auto); gap: 4px; background: #f1f5f9; border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.seg-gender button { border: 0; background: transparent; padding: 9px 18px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.seg-gender button.on { background: #fff; color: var(--blue-700); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg-gender svg { width: 16px; height: 16px; }
.ctl-label { font-weight: 700; font-size: 14px; margin: 0; }
.ctl-sub { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; background: #fff; height: 38px; }
.stepper button { width: 36px; height: 100%; border: 0; background: transparent; cursor: pointer; font-size: 18px; color: var(--muted); }
.stepper button:hover { color: var(--blue-700); }
.stepper input { width: 52px; border: 0 !important; box-shadow: none !important; text-align: center; padding: 0 !important; font-size: 15px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper .u { font-size: 12px; color: var(--muted); padding-right: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 6px 0; font-weight: 500; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .tr { width: 36px; height: 20px; border-radius: 99px; background: #cbd5e1; position: relative; transition: background .15s; flex-shrink: 0; }
.switch .tr::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .tr { background: var(--blue-600); }
.switch input:checked + .tr::after { transform: translateX(16px); }
.switch input:focus-visible + .tr { box-shadow: 0 0 0 3px var(--blue-100); }
.switch.on-dark { color: #e2e8f0; }
.switch.on-dark .tr { background: #334155; }
.lvl { display: grid; grid-template-columns: 170px 1fr 64px; gap: 12px; align-items: center; margin: 8px 0; }
.lvl input[type=range] { width: 100%; accent-color: var(--blue-600); }
.lvl .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.split-btn { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: visible; position: relative; }
.split-btn > button { border: 0; background: #fff; padding: 8px 12px; cursor: pointer; font-weight: 500; border-radius: 9px 0 0 9px; }
.split-btn > button.caret { border-left: 1px solid var(--border); border-radius: 0 9px 9px 0; padding: 8px 10px; }
.split-btn > button:hover { background: var(--blue-50); }
.split-btn > button:disabled { color: #94a3b8; cursor: not-allowed; background: #fff; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); z-index: 20; min-width: 220px; padding: 4px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.menu button:hover, .menu button.on { background: var(--blue-50); }
.voice-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 10px; }
@media (max-width: 700px) { .voice-row, .grid-2 { grid-template-columns: 1fr; } .lvl { grid-template-columns: 1fr 1fr 54px; } }
.voice-ready { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; margin-top: 14px; flex-wrap: wrap; }
.voice-ready audio { margin-left: auto; }
.linkbtn { border: 0; background: transparent; color: var(--blue-600); font-weight: 600; cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.music-opt.playing .icon-btn { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.recap { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 14px; }
.recap dt { color: var(--muted); }
.recap dd { margin: 0; font-weight: 600; }

/* Panneau sombre « Aperçu final » */
.dark-panel { background: #172036; color: #e2e8f0; border-radius: 18px; padding: 20px; box-shadow: 0 10px 30px rgba(15,23,42,.25); position: sticky; top: 16px; }
.dark-panel h3 { margin: 0 0 14px; font-size: 15px; color: #cbd5e1; }
.dp-canvas { position: relative; background: #223050; border-radius: 12px; height: 180px; overflow: hidden; cursor: pointer; }
.dp-canvas canvas { width: 100%; height: 100%; display: block; }
.dp-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: #94a3b8; font-size: 14px; }
.dp-legend { display: flex; gap: 14px; font-size: 12px; color: #94a3b8; margin: 10px 0 12px; flex-wrap: wrap; }
.dp-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.dp-player { display: flex; align-items: center; gap: 14px; }
.dp-play { width: 50px; height: 50px; border-radius: 50%; border: 0; background: #2563eb; color: #fff; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.dp-play:disabled { background: #1e3a8a; color: #64748b; cursor: not-allowed; }
.dp-play svg { width: 18px; height: 18px; }
.dp-clock { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; letter-spacing: .02em; }
.dp-clock small { font-size: 15px; color: #94a3b8; font-weight: 500; }
.dp-metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px 0; border-top: 1px solid #2d3b5c; border-bottom: 1px solid #2d3b5c; }
.dp-metrics div { padding: 10px 12px; border-right: 1px solid #2d3b5c; }
.dp-metrics div:last-child { border-right: 0; }
.dp-metrics span { display: block; font-size: 12px; color: #94a3b8; }
.dp-metrics b { font-size: 17px; color: #fff; font-variant-numeric: tabular-nums; }
.dp-metrics b.warn { color: #fdba74; }
.dark-panel select { background: #223050; color: #fff; border-color: #2d3b5c; }
.dark-panel .btn-dl { width: 100%; margin-top: 10px; padding: 13px; font-size: 15px; }
.dark-panel .btn-dl:disabled { background: #1e3a8a; color: #64748b; opacity: 1; }
.dark-panel .linkbtn { color: #94a3b8; font-weight: 500; margin-top: 12px; }
.dark-panel .dl-zone[hidden] { display: none; }
.dp-warn { background: rgba(251,146,60,.12); color: #fdba74; border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-top: 10px; }
[hidden] { display: none !important; }
.dp-metrics b { white-space: nowrap; font-size: 16px; }
.dp-metrics b small { font-size: 11px; color: #94a3b8; font-weight: 500; margin-left: 2px; }

/* v2.1 — palette de balises */
.tag-palette { display: flex; flex-direction: column; gap: 8px; }
.tag-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-group-name { width: 62px; font-size: 12px; color: var(--muted); font-weight: 600; }
.tag-chip { border: 1px solid #c7d2fe; background: #eef2ff; color: #3730a3; border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.tag-chip:hover { background: #e0e7ff; border-color: #818cf8; }
.tag-chip:disabled { background: #f1f5f9; border-color: var(--border); color: #94a3b8; cursor: not-allowed; }

/* ======================= v3.0 — accès par token ======================= */
.token-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px !important; letter-spacing: .12em; text-align: center; text-transform: uppercase; padding: 14px !important; }
.login-steps { display: grid; gap: 8px; margin: 16px 0 16px; padding: 0; list-style: none; }
.login-steps li { display: flex; gap: 10px; align-items: center; font-size: 13px; color: #475569; }
.login-steps b { width: 22px; height: 22px; border-radius: 50%; background: var(--blue-50); color: var(--blue-700); display: grid; place-items: center; font-size: 12px; flex-shrink: 0; }
.login-alt { font-size: 12px; text-align: center; margin: 14px 0 0; border-top: 1px solid var(--border); padding-top: 12px; color: var(--muted); }
.tok { white-space: nowrap; font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .06em; background: #f1f5f9; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.tok:hover { background: var(--blue-100); }
.qbar { height: 6px; border-radius: 99px; background: #e2e8f0; width: 80px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.qbar i { display: block; height: 100%; background: var(--blue-600); }
.qbar.full i { background: var(--green); }
.st { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.st.active { background: #dcfce7; color: #166534; }
.st.done { background: #e2e8f0; color: #475569; }
.st.expired { background: #ffedd5; color: #c2410c; }
.st.revoked { background: #fee2e2; color: #991b1b; }
.quota-pill { background: var(--blue-50); color: var(--blue-800); border-radius: 99px; padding: 6px 14px; font-weight: 600; font-size: 13px; }
input[type=date] { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.wstep .lbl { min-width: 0; overflow: hidden; }
.wstep .lbl small { max-width: 100%; }

/* ======================= v3.3 ======================= */
.gen-pill { background: #f1f5f9; color: #334155; }
.gen-pill.warn { background: #fff7ed; color: #c2410c; }
#charWrap.over { color: var(--red); font-weight: 700; }
.mix-default { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; }
.mix-default > div:nth-child(2) { flex: 1; min-width: 0; }
.mix-default-ic { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--blue-700), var(--blue-500)); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.mix-default-ic svg { width: 20px; height: 20px; }
.tag-group-name { width: 96px; }
.tag-chip small { font-weight: 400; opacity: .6; margin-left: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 10px; }
.kind-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #f1f5f9; border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.kind-seg button { border: 0; background: transparent; text-align: left; padding: 8px 12px; border-radius: 9px; cursor: pointer; }
.kind-seg button b { display: block; font-size: 14px; color: var(--text); }
.kind-seg button span { font-size: 12px; color: var(--muted); }
.kind-seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.st.kind-offert { background: #dbeafe; color: #1e4fa3; }
.st.kind-facture { background: #ede9fe; color: #6d28d9; }
