:root {
  --bg: #0a0a0d;
  --bg-soft: #101017;
  --panel: #14141c;
  --panel-2: #191924;
  --line: #262632;
  --line-soft: #1e1e29;
  --text: #ededf2;
  --muted: #9a9aab;
  --dim: #6d6d80;
  --accent: #ff6b2c;
  --accent-2: #ffb03a;
  --accent-soft: rgba(255, 107, 44, 0.12);
  --ok: #3ddc97;
  --danger: #ff5470;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-synthesis-weight: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(1100px 620px at 12% -12%, rgba(255, 107, 44, 0.13), transparent 62%),
    radial-gradient(900px 560px at 92% 0%, rgba(120, 90, 255, 0.1), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Inter, Helvetica, Arial,
    "Apple Color Emoji", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---------------- topbar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 34px);
  background: rgba(10, 10, 13, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  position: relative;
  flex: none;
  box-shadow: 0 6px 18px rgba(255, 107, 44, 0.35);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-left: 9px solid #0a0a0d;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  transform: translateX(2px);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand-text small {
  color: var(--dim);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.status-pill[data-state="ok"] {
  border-color: rgba(61, 220, 151, 0.35);
  color: var(--ok);
  background: rgba(61, 220, 151, 0.08);
}

.status-pill[data-state="warn"] {
  border-color: rgba(255, 176, 58, 0.35);
  color: var(--accent-2);
  background: rgba(255, 176, 58, 0.08);
}

/* ---------------- layout ---------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  padding: 22px clamp(14px, 3vw, 34px) 70px;
  max-width: 1560px;
  margin: 0 auto;
}

@media (min-width: 1020px) {
  .layout {
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    align-items: start;
    gap: 30px;
  }
  .form-panel {
    position: sticky;
    top: 78px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

/* ---------------- formulaire ---------------- */

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.field {
  display: block;
  margin-bottom: 14px;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.label em {
  text-transform: none;
  letter-spacing: 0;
  font-style: normal;
  color: var(--dim);
  font-weight: 400;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d0d13;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(255, 107, 44, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.14);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) calc(1em + 3px), calc(100% - 12px) calc(1em + 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

option {
  background: #12121a;
}

.hint,
.micro {
  display: block;
  font-size: 11.8px;
  color: var(--dim);
  margin-top: 5px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 420px) {
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* ---------------- boutons ---------------- */

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: #20202c;
  border-color: #34344a;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #1a0b02;
  box-shadow: 0 10px 26px rgba(255, 107, 44, 0.26);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff7b42, #ffbe58);
  border-color: transparent;
}

.btn-primary[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-small {
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 8px;
}

/* ---------------- état vide ---------------- */

.results {
  min-width: 0;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 52px);
  text-align: center;
  background: linear-gradient(180deg, rgba(20, 20, 28, 0.65), rgba(10, 10, 13, 0.2));
}

.empty h2 {
  font-size: 22px;
  margin: 18px 0 8px;
  letter-spacing: -0.01em;
}

.empty p {
  color: var(--muted);
  max-width: 56ch;
  margin: 0 auto 20px;
  font-size: 14px;
}

.empty-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 560px;
  text-align: left;
  display: grid;
  gap: 8px;
}

.empty-list li {
  font-size: 13.5px;
  color: var(--muted);
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.015);
}

.empty-list b {
  color: var(--text);
  font-weight: 600;
}

.empty-visual {
  display: flex;
  gap: 7px;
  justify-content: center;
}

.empty-visual span {
  width: 46px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 107, 44, 0.24), rgba(255, 255, 255, 0.03));
}

.empty-visual span:nth-child(2) {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
}

.empty-visual span:nth-child(3) {
  background: linear-gradient(160deg, rgba(120, 90, 255, 0.22), rgba(255, 255, 255, 0.02));
}

/* ---------------- chargement ---------------- */

.loading {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  background: var(--panel);
}

.loading p {
  margin: 16px 0 18px;
  color: var(--muted);
  font-size: 13.5px;
}

.loading-bar {
  height: 3px;
  border-radius: 99px;
  background: #1c1c26;
  overflow: hidden;
}

.loading-bar span {
  display: block;
  height: 100%;
  width: 38%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: slide 1.35s ease-in-out infinite;
}

@keyframes slide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(300%);
  }
}

.skeleton {
  display: grid;
  gap: 10px;
}

.skeleton span {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #1a1a24, #23232f, #1a1a24);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

.skeleton span:nth-child(1) {
  width: 68%;
}
.skeleton span:nth-child(2) {
  width: 92%;
}
.skeleton span:nth-child(3) {
  width: 44%;
}

@keyframes shimmer {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ---------------- erreur ---------------- */

.error-box {
  border: 1px solid rgba(255, 84, 112, 0.4);
  background: rgba(255, 84, 112, 0.08);
  color: #ffd7de;
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 13.5px;
}

.error-box strong {
  display: block;
  margin-bottom: 4px;
  color: #fff;
}

.error-box .detail {
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: #ffb3c0;
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-box .btn {
  margin-top: 12px;
}

/* ---------------- résultats ---------------- */

.hero-card {
  background: linear-gradient(150deg, rgba(255, 107, 44, 0.14), rgba(20, 20, 28, 0.9) 46%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 6px;
  font-weight: 600;
}

.hero-card h1 {
  font-size: clamp(21px, 2.6vw, 30px);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.logline {
  color: var(--muted);
  margin: 0 0 14px;
  font-size: 14.5px;
  max-width: 72ch;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
}

.chip {
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip b {
  color: var(--text);
  font-weight: 600;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 600;
}

.kv {
  display: grid;
  gap: 10px;
}

.kv-row {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line-soft);
}

.kv-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.kv-key {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.kv-val {
  font-size: 13.5px;
  color: #ddddea;
  white-space: pre-wrap;
  word-break: break-word;
}

.cast-item {
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 8px;
}

.cast-item:last-child {
  margin-bottom: 0;
}

.cast-name {
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 3px;
}

.cast-desc {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.8px;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}

/* ---------------- plans ---------------- */

.plans {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.plan {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.plan-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  background: linear-gradient(90deg, rgba(255, 107, 44, 0.1), transparent 70%);
  border-bottom: 1px solid var(--line-soft);
}

.plan-num {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1a0b02;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 7px;
  padding: 3px 8px;
  flex: none;
}

.plan-title {
  font-weight: 600;
  font-size: 14.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-dur {
  font-size: 12px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.plan-body {
  padding: 16px 18px;
  display: grid;
  gap: 14px;
}

.plan-action {
  font-size: 14px;
  color: #e6e6f0;
  margin: 0;
  white-space: pre-wrap;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.meta-item {
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 8px 11px;
}

.meta-key {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 2px;
}

.meta-val {
  font-size: 12.8px;
  color: #d8d8e4;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0c0c12;
  overflow: hidden;
}

.prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px 7px 12px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--line-soft);
}

.prompt-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.prompt-block[data-kind="image"] .prompt-label {
  color: #7fd7ff;
}

.prompt-block[data-kind="video"] .prompt-label {
  color: var(--accent-2);
}

.prompt-text {
  padding: 11px 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, "DejaVu Sans Mono", monospace;
  font-size: 12.4px;
  line-height: 1.62;
  color: #d5d5e2;
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-btn {
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #17171f;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.copy-btn:hover {
  color: var(--text);
  border-color: #3a3a50;
}

.copy-btn.done {
  color: var(--ok);
  border-color: rgba(61, 220, 151, 0.4);
  background: rgba(61, 220, 151, 0.1);
}

.bullets,
.checklist {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  font-size: 13.5px;
  color: #d8d8e4;
}

.bullets li::marker {
  color: var(--accent);
}

.checklist {
  list-style: none;
  padding-left: 0;
}

.checklist li {
  position: relative;
  padding-left: 24px;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

/* ---------------- dialog ---------------- */

.dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100vw - 28px));
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
}

.dialog::backdrop {
  background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(4px);
}

.dialog form {
  padding: 22px;
}

.dialog h2 {
  margin: 0 0 8px;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.provider {
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #101017;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.provider b {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.provider small {
  font-size: 11px;
  color: var(--dim);
}

.provider[aria-pressed="true"] {
  border-color: rgba(255, 107, 44, 0.65);
  background: var(--accent-soft);
  color: var(--text);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.dialog-actions .btn-primary {
  flex: 0 0 auto;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------------- toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(10px);
  background: #1d1d28;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------- onglets de connexion ---------------- */

.tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 18px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.tab {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.tab[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(255, 107, 44, 0.5);
  background: var(--accent-soft);
}

.dialog {
  max-height: min(88vh, 780px);
  overflow: hidden;
}

.dialog form {
  max-height: min(88vh, 780px);
  overflow-y: auto;
}

.cfg-panel .micro {
  margin-top: 10px;
}

.cf-accounts {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.cf-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  align-items: center;
}

.cf-row input {
  font-size: 12.5px;
  padding: 8px 10px;
}

.cf-remove {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.cf-remove:hover {
  color: var(--danger);
  border-color: rgba(255, 84, 112, 0.45);
}

.field.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
}

.field.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.drive-help {
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 11px 13px;
  margin: 4px 0 12px;
  line-height: 1.6;
}

.drive-help b {
  color: var(--text);
}

/* ---------------- production ---------------- */

.production .prod-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.production .prod-head h3 {
  margin: 0;
}

.prod-badges {
  font-size: 11.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.prod-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}

.prod-actions .btn-primary {
  flex: 0 1 auto;
}

.prod-progress {
  margin-top: 12px;
}

.prod-bar {
  height: 4px;
  border-radius: 99px;
  background: #1c1c26;
  overflow: hidden;
}

.prod-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

.prod-progress p {
  margin: 7px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.asset {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #0d0d13;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.asset-thumb {
  aspect-ratio: 9 / 16;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.025) 0 10px,
    transparent 10px 20px
  );
  overflow: hidden;
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-empty {
  font-size: 12px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.asset-caption {
  padding: 7px 9px;
  border-top: 1px solid var(--line-soft);
}

.asset-name {
  font-size: 11px;
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.asset audio {
  width: 100%;
  height: 32px;
  display: block;
}

.drive-result {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(61, 220, 151, 0.3);
  background: rgba(61, 220, 151, 0.07);
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.drive-result a {
  text-decoration: none;
}

/* ---------------- pipeline ---------------- */

.chain {
  margin-top: 18px;
}

.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.stage-chip {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  color: var(--dim);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.stage-chip[data-state="done"] {
  color: var(--ok);
  border-color: rgba(61, 220, 151, 0.3);
  background: rgba(61, 220, 151, 0.08);
}

.stage-chip[data-state="current"] {
  color: #1a0b02;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
}

/* ---------------- coffre de clés ---------------- */

.providers {
  display: grid;
  gap: 10px;
}

.provider-block {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 12px;
}

.pb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pb-enable {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pb-enable input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.pb-arrows {
  display: flex;
  gap: 4px;
}

.pb-arrows button {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #101017;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.pb-arrows button:disabled {
  opacity: 0.35;
  cursor: default;
}

.provider-block textarea {
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.pb-model {
  margin: 0;
}

.pb-model .label {
  font-size: 10.5px;
}

.pb-model input {
  font-size: 12.5px;
  padding: 7px 10px;
}

/* ---------------- scènes et médias ---------------- */

.scene-thumb {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  display: block;
}

.voice-player {
  width: 100%;
  margin-top: 12px;
}

.json-view {
  max-height: 340px;
  overflow: auto;
  margin: 0;
}

.kv-row .copy-btn {
  margin-top: 6px;
}

.prompt-editor {
  width: 100%;
  min-height: 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

.prompt-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 6px;
}

.prompt-tools .micro {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
}

/* ---- v4 : pages, tableau d'avancement, journal, catalogue de modèles ---- */
.pagenav { display: flex; gap: 6px; margin-left: 18px; }
.page-tab {
  border: 1px solid var(--line, #2a2a33);
  background: transparent;
  color: inherit;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}
.page-tab[aria-pressed="true"] { background: #ff6b2c; border-color: #ff6b2c; color: #0b0b0f; font-weight: 600; }
[data-page-panel][hidden] { display: none !important; }

.board { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.board-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line, #2a2a33);
  border-radius: 8px;
  font-size: 12px;
}
.board-row[data-state="done"] { border-color: #2f7d4f; }
.board-row[data-state="partiel"] { border-color: #a86f1f; }
.board-name { font-weight: 600; }
.board-count { font-variant-numeric: tabular-nums; opacity: 0.85; }
.board-api { opacity: 0.65; font-size: 11px; }

.log-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.log { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; }
.log-row {
  display: grid;
  grid-template-columns: 62px 118px 150px 1fr;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  line-height: 1.35;
}
.log-row[data-status="erreur"] { background: rgba(190, 60, 60, 0.14); }
.log-time, .log-step, .log-api { opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-msg { word-break: break-word; }

.model-picker { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.model-picker input[type="search"] { width: 100%; }
.model-list { display: flex; flex-wrap: wrap; gap: 5px; max-height: 150px; overflow: auto; }
.model-item {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line, #2a2a33);
  background: transparent;
  color: inherit;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-item:hover { border-color: #ff6b2c; color: #ff6b2c; }

.asset-actions { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.asset-del {
  border: 1px solid var(--line, #2a2a33);
  background: transparent;
  color: inherit;
  border-radius: 6px;
  font-size: 11px;
  padding: 3px 7px;
  cursor: pointer;
}
.asset-del:hover { border-color: #be3c3c; color: #e06a6a; }

/* ---- v4.1 : barre du haut et journal lisibles sur écran étroit ---- */
.topbar { flex-wrap: wrap; row-gap: 10px; }
.pagenav { margin-left: 0; flex-wrap: wrap; }
.log-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  min-height: 0;
}
.log-time { flex: 0 0 auto; }
.log-step { flex: 0 0 auto; min-width: 70px; }
.log-api { flex: 0 1 auto; max-width: 46%; }
.log-msg { flex: 1 1 100%; }
.log { max-height: 340px; }

/* ---- v4.2 : journal en blocs, une erreur par ligne, hauteur naturelle ---- */
.log { display: block; max-height: 340px; overflow: auto; }
.log-row {
  display: block;
  padding: 7px 9px;
  margin-bottom: 5px;
  line-height: 1.5;
}
.log-row > span {
  display: inline-block;
  margin-right: 10px;
  vertical-align: top;
  max-width: none;
}
.log-row .log-msg {
  display: block;
  margin: 3px 0 0;
  white-space: normal;
  max-width: 100%;
}

/* ---- v4.3 : médias retrouvés au chargement ---- */
.asset-link {
  font-size: 11px;
  color: #ff8a55;
  text-decoration: none;
  border: 1px solid rgba(255, 138, 85, 0.45);
  border-radius: 6px;
  padding: 3px 7px;
}
.asset-link:hover { background: rgba(255, 138, 85, 0.12); }

/* ---- v4.4 : test d'une clé depuis le coffre ---- */
.pb-test {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
}
.pb-test .micro { flex: 1 1 180px; max-width: 100%; line-height: 1.4; }
