/* Console Link Vox — feuille de style unique, sans dependance externe. */

:root {
  color-scheme: dark;

  --bg: #0a0c10;
  --bg-elevated: #10141a;
  --surface: #141922;
  --surface-hover: #1a212c;
  --border: #232b38;
  --border-strong: #303c4d;

  --text: #e8ecf3;
  --text-muted: #8d99ac;
  --text-faint: #5f6b7d;

  --brand-violet: #7c3aed;
  --brand-blue: #3b7bff;
  --brand-cyan: #22c7e8;
  --accent: #2f6bff;
  --accent-soft: rgba(47, 107, 255, 0.16);
  --accent-text: #8db0ff;
  --success: #2dd4a7;
  --success-soft: rgba(45, 212, 167, 0.13);
  --warning: #f0b429;
  --warning-soft: rgba(240, 180, 41, 0.13);
  --danger: #f4626f;
  --danger-soft: rgba(244, 98, 111, 0.13);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.7);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fa;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f2f4f8;
  --border: #e2e6ee;
  --border-strong: #cdd4e0;
  --text: #131822;
  --text-muted: #5d6879;
  --text-faint: #8b94a4;
  --brand-blue: #2563ff;
  --accent-soft: rgba(37, 99, 255, 0.1);
  --accent-text: #1d4ed8;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 12px 28px -16px rgba(16, 24, 40, 0.24);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Halo discret en haut de page. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  background: radial-gradient(ellipse 80% 100% at 50% -20%, var(--accent-soft), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------------ entete */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }

.brand__mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  filter: drop-shadow(0 4px 12px rgba(37, 99, 255, 0.35));
}
.brand__mark img { width: 38px; height: 38px; display: block; }

.brand__name { font-size: 15px; font-weight: 650; letter-spacing: 0.08em; }
.brand__link { color: var(--text); }
.brand__vox { color: var(--brand-blue); }
.brand__sub { font-size: 12px; color: var(--text-faint); margin-top: -2px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}
.status-pill__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}
.status-pill--ok .status-pill__dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-pill--warn .status-pill__dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.status-pill--down .status-pill__dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }

/* -------------------------------------------------------------- navigation */

.tabs {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  padding: 12px 15px 14px;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
  transition: color 0.15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(90deg, var(--accent), var(--success));
}
.tab__count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-faint);
}

/* ---------------------------------------------------------------- squelette */

main {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.panel { display: none; animation: rise 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
.panel.is-active { display: block; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.panel__head { margin-bottom: 22px; }
.panel__head h2 { font-size: 21px; }
.panel__head p { color: var(--text-muted); font-size: 14px; margin-top: 4px; max-width: 66ch; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.voice-layout { grid-template-columns: minmax(330px, 0.9fr) minmax(0, 1.6fr); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card__title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* -------------------------------------------------------------- formulaires */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

label.field__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field__value { font-family: var(--mono); font-size: 12px; color: var(--accent-text); }

input[type="text"], input[type="search"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

input[type="range"] {
  width: 100%;
  height: 4px;
  appearance: none;
  background: var(--border);
  border-radius: 999px;
  outline: none;
  padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }

.check {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color 0.15s;
}
.check:hover { border-color: var(--border-strong); }
.check input { margin: 2px 0 0; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.check__text { font-size: 13px; line-height: 1.5; }
.check__text b { display: block; font-weight: 550; }
.check__text span { color: var(--text-muted); }
.check--consent { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); background: var(--warning-soft); }

.file-drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg-elevated);
}
.file-drop:hover, .file-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.file-drop input { display: none; }
.file-drop__icon { color: var(--text-faint); }
.file-drop__main { font-size: 14px; font-weight: 500; margin-top: 6px; }
.file-drop__hint { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }

/* ------------------------------------------------------------------ boutons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #8b78ff);
  color: #fff;
  box-shadow: 0 4px 14px -6px var(--accent);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); }

.btn--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 22%, transparent); }

.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--block { width: 100%; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- resultats */

.result { margin-top: 18px; }

.audio-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: linear-gradient(180deg, var(--bg-elevated), var(--surface));
}
.audio-card audio { width: 100%; margin-top: 12px; }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.meta { min-width: 0; }
.meta__k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.meta__v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.chip--mono { font-family: var(--mono); font-size: 11.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
}
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--run { background: var(--accent-soft); color: var(--accent-text); }
.badge--warn { background: var(--warning-soft); color: var(--warning); }
.badge--err { background: var(--danger-soft); color: var(--danger); }
.badge--idle { background: var(--surface-hover); color: var(--text-muted); }

.notice {
  display: flex; gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 12px;
}
.notice--warn { background: var(--warning-soft); color: var(--warning); }
.notice--info { background: var(--accent-soft); color: var(--accent-text); }
.notice svg { flex: none; margin-top: 2px; width: 15px; height: 15px; }

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------------------------------------------------------------------- listes */

.list { display: flex; flex-direction: column; gap: 10px; }

.voice-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}
.voice-filters label { display: grid; gap: 6px; }
.voice-filters label > span {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.voice-library { gap: 12px; }
.item.voice-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
}
.voice-card .item__actions {
  grid-column: 2;
  flex-wrap: wrap;
  margin-top: 10px;
}
.voice-card__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.voice-card__tags .chip { font-size: 10.5px; }
.chip--trained {
  border-color: color-mix(in srgb, var(--success) 55%, var(--border));
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}
.chip--v2-candidate { color: var(--accent); }
.chip--zero-shot { color: var(--text-muted); }
.voice-engine-hint {
  margin: 7px 0 0;
  color: var(--text-faint);
  font-size: 11.5px;
}
.voice-engine-hint.is-trained { color: var(--success); }
.voice-card__preview {
  margin-top: -5px;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-top: none;
  background: var(--bg-elevated);
}
.voice-card__preview audio { display: block; width: 100%; height: 36px; }
@media (max-width: 900px) {
  .voice-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .voice-filters .btn { align-self: stretch; }
}
@media (max-width: 520px) {
  .voice-filters { grid-template-columns: 1fr; }
  .item.voice-card { grid-template-columns: 1fr; }
  .voice-card .avatar { display: none; }
  .voice-card .item__actions { grid-column: 1; }
}

.item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color 0.15s, background 0.15s;
}
.item:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.item__body { min-width: 0; flex: 1; }
.item__title { font-weight: 550; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item__meta { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.item__actions { display: flex; gap: 6px; flex: none; }

.avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 650;
  font-size: 15px;
}

.item__edit {
  margin-top: -4px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--text-faint);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty__title { font-weight: 550; color: var(--text-muted); margin-top: 10px; }
.empty p { font-size: 13.5px; margin-top: 4px; }

/* ---------------------------------------------------------------- segments */

.segments { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.segment {
  display: flex; gap: 12px; align-items: baseline;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  text-align: left;
  background: none;
  width: 100%;
}
.segment:hover { background: var(--surface-hover); border-color: var(--border); }
.segment.is-playing { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.segment__time { font-family: var(--mono); font-size: 12px; color: var(--accent-text); flex: none; }
.segment__text { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.segment.is-playing .segment__text { color: var(--text); }

/* ------------------------------------------------------------------- modale */

.overlay {
  position: fixed; inset: 0;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
  z-index: 50;
}
.overlay[hidden] { display: none; }

.modal {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  animation: rise 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal h3 { font-size: 17px; }
.modal p { color: var(--text-muted); font-size: 13.5px; margin: 6px 0 18px; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ------------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: slide 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast--err { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.toast--ok { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }
.toast__icon { flex: none; margin-top: 1px; }
.toast--err .toast__icon { color: var(--danger); }
.toast--ok .toast__icon { color: var(--success); }
.toast b { display: block; font-weight: 600; }
.toast span { color: var(--text-muted); }

@keyframes slide {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.prepared-preview,
.prosody-summary {
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.prepared-preview b { color: var(--text); font-size: 12px; }
.prepared-preview p { margin: 5px 0 0; white-space: pre-wrap; }
.realism-toggle { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.override {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  color: var(--text-faint);
  font-size: 11.5px;
  cursor: pointer;
}
.realism-setting input:disabled { opacity: 0.48; cursor: not-allowed; }
.generation-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.generation-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 11.5px;
}
.generation-step span {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-elevated);
  font-family: var(--mono);
}
.generation-step b { font-weight: inherit; }
.generation-step.is-active { color: var(--accent-text); border-color: var(--accent); }
.generation-step.is-active span { background: var(--accent-soft); }
.generation-step.is-done { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.generation-step.is-done span { background: color-mix(in srgb, var(--success) 16%, transparent); }
.generation-step.is-error { color: var(--danger); border-color: var(--danger); }
@media (max-width: 620px) {
  .generation-progress { grid-template-columns: 1fr; }
}

/* Tableau compact des compteurs d'exploitation. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.stat {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
.stat__k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.stat__v { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat__hint { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.stat--good .stat__v { color: var(--success); }
.stat--warn .stat__v { color: var(--warning); }

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
