/* Application Montor : même direction artistique que la landing
   (fond blanc, typographie noire, accent bleu clair #8FD3FF). */
:root {
  --bg: #ffffff;
  --bg-alt: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f4f4f1;
  --line: #e9e9e5;
  --line-strong: #d9d9d4;
  --text: #0a0a0a;
  --muted: #66666b;
  --accent: #8fd3ff;
  --accent-soft: #e6f5ff;
  --accent-ink: #0a0a0a;
  --ok: #138a4a;
  --err: #c62828;
  --radius: 16px;
  --shadow-soft: 0 1px 2px rgba(10, 10, 10, .04), 0 14px 34px -16px rgba(10, 10, 10, .18);
  --font: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 6px; }

/* ---------- Cadre : barre latérale + contenu ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: block; width: 36px; height: 36px; object-fit: contain; }
.brand-name { font-family: "Fredoka", var(--font); font-weight: 600; font-size: 26px; line-height: 1; letter-spacing: -.01em; }

.shell { display: flex; min-height: 100vh; }
.shell-main { flex: 1; min-width: 0; background: var(--bg-alt); }
.sidebar {
  flex: none; width: 236px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30;
  display: flex; flex-direction: column; gap: 6px; padding: 18px 12px 14px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px 16px 0; }
.side-brand { padding: 4px 10px; min-width: 0; }
.side-collapse {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px;
  border: 0; background: none; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.side-collapse:hover { background: var(--surface-2); color: var(--text); }
.side-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Barre réduite : seulement les icônes */
.sidebar { transition: width .25s var(--ease), padding .25s var(--ease); }
body.side-collapsed .sidebar { width: 68px; padding-left: 10px; padding-right: 10px; }
body.side-collapsed .side-top { flex-direction: column; gap: 10px; padding-right: 0; }
body.side-collapsed .side-brand { padding: 4px 0; }
body.side-collapsed :is(.brand-name, .side-text, .side-badge, .side-soon, .usage) { display: none; }
body.side-collapsed .side-link { justify-content: center; padding: 10px 0; }
body.side-collapsed .side-collapse svg { transform: scaleX(-1); }
.side-brand .brand-mark { width: 34px; height: 34px; }
.side-brand .brand-name { font-size: 24px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  font-size: 14px; font-weight: 550; color: #3a3a40; text-decoration: none; transition: background .15s, color .15s;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: var(--text); font-weight: 650; }
.side-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: none; color: var(--text); }
.icon { display: block; }
.side-badge { margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--text); color: #fff; }
.side-link.soon { color: #a1a1a6; cursor: default; }
.side-link.soon:hover { background: none; color: #a1a1a6; }
.side-soon { margin-left: auto; font-size: 10.5px; font-weight: 650; color: #a1a1a6; }
.side-sep { height: 1px; background: var(--line); margin: 10px 6px; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; }
.usage { margin: 0 2px 8px; padding: 12px; border-radius: 12px; background: var(--accent-soft); display: grid; gap: 6px; }
.usage-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.usage-label { font-size: 12px; font-weight: 650; color: #0b5c8f; }
.usage-value { font-size: 15px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.usage-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .8); overflow: hidden; }
.usage-bar i { display: block; height: 100%; border-radius: 99px; background: #3aa7e8; transition: width .4s var(--ease); }
.usage.low .usage-bar i { background: #e5484d; }
.usage-sub { font-size: 11.5px; color: var(--muted); }
.usage-cta { justify-self: start; font-size: 12.5px; font-weight: 650; color: #0b5c8f; text-decoration: none; }
.usage-cta:hover { text-decoration: underline; }
.credit-note { margin-top: 10px; font-size: 13px; padding: 9px 12px; border-radius: 10px; background: var(--accent-soft); color: #0b5c8f; }
.credit-note.short { background: #fdecec; color: var(--err); }

/* Choix « motion design » (motionPicker dans app.js) */
.motion-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.motion-choice {
  display: grid; gap: 4px; text-align: left; padding: 14px 16px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.motion-choice strong { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; }
.motion-choice > span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.motion-choice:hover { border-color: var(--text); }
.motion-choice.on { border-color: var(--text); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--text) inset; }
.motion-cost { padding: 2px 8px; border-radius: 99px; background: #fff3d6; color: #8a5a00; font-size: 11px; font-weight: 700; }
.motion-warn { background: #fff3d6; color: #8a5a00; }
@media (max-width: 760px) { .motion-choices { grid-template-columns: 1fr; } }

.mobilebar { display: none; }
.menu-btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }

.container { max-width: 1240px; margin: 0 auto; padding: 48px 28px 96px; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: 0 0 40px rgba(10, 10, 10, .2); }
  body.menu-open .sidebar { transform: none; }
  /* sur mobile la barre s'ouvre par-dessus la page : pas de version réduite */
  .side-collapse { display: none; }
  body.side-collapsed .sidebar { width: 236px; padding: 18px 12px 14px; }
  body.side-collapsed .side-top { flex-direction: row; }
  body.side-collapsed :is(.brand-name, .side-text, .side-badge, .side-soon) { display: initial; }
  body.side-collapsed .usage { display: block; }
  body.side-collapsed .side-link { justify-content: flex-start; padding: 9px 10px; }
  body.menu-open .shell-main::before { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(10, 10, 10, .35); }
  .mobilebar {
    display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 60px; position: sticky; top: 0; z-index: 20;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  }
  .mobilebar .brand-mark { width: 32px; height: 32px; }
  .mobilebar .brand-name { font-size: 22px; }
}

/* ---------- Accueil ---------- */
.welcome { max-width: 1080px; margin: 0 auto; }
.welcome-title { font-size: clamp(30px, 4vw, 44px); letter-spacing: -.035em; margin-bottom: 10px; }
.welcome-title em { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 400; color: #1f87c9; letter-spacing: -.01em; }
.welcome .lead { margin-bottom: 10px; }
.name-box { display: flex; align-items: center; gap: 8px; min-height: 36px; margin-bottom: 26px; }
.name-input { max-width: 220px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--text); }

.wc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.wc-card {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; transition: border-color .2s, transform .25s var(--ease), box-shadow .25s var(--ease);
}
a.wc-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.wc-card.soon { opacity: .75; }
.wc-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.wc-body h3 { margin: 6px 0 0; font-size: 17px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.wc-body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.wc-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); color: var(--text); flex: none; }
.wc-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 14px; font-weight: 650; color: #1f6fa6; }
.wc-cta .icon { width: 16px; height: 16px; transition: transform .2s var(--ease); }
a.wc-card:hover .wc-cta .icon { transform: translateX(3px); }

/* aperçus dessinés en CSS, avec les vraies miniatures quand il y en a */
.wc-preview { height: 150px; background: linear-gradient(180deg, var(--accent-soft), #f6fbff); border-bottom: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.mock-pill { display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 99px; background: var(--surface); box-shadow: var(--shadow-soft); width: 72%; align-self: center; }
.mock-pill span { flex: 1; height: 6px; border-radius: 4px; background: var(--surface-2); }
.mock-pill i { width: 40px; height: 14px; border-radius: 99px; background: var(--accent); }
.mock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mock-card { aspect-ratio: 16 / 10; border-radius: 8px; background: var(--surface); overflow: hidden; box-shadow: 0 1px 2px rgba(10, 10, 10, .08); }
.mock-card img, .mock-phone img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wc-edit { display: grid; grid-template-columns: 64px 1fr; grid-template-rows: 1fr auto; gap: 8px 12px; }
.mock-phone { grid-row: 1 / 3; border-radius: 10px; background: #1b1b1f; overflow: hidden; }
.mock-chat { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.mock-bubble { align-self: flex-start; font-size: 11px; font-weight: 600; padding: 5px 9px; border-radius: 10px; background: var(--surface); color: var(--ok); box-shadow: 0 1px 2px rgba(10, 10, 10, .08); }
.mock-bubble.user { align-self: flex-end; color: var(--text); background: var(--surface-2); }
.mock-tl { display: flex; gap: 3px; height: 14px; }
.mock-tl i { border-radius: 4px; background: #2a2a2e; }
.mock-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; height: 100%; }
.mock-cal span { border-radius: 5px; background: var(--surface); }
.mock-cal span.on { background: var(--accent); }

.tools-head { margin-top: 34px; }
.tools-head h2 { margin: 0; }
.tool-row { display: flex; flex-wrap: wrap; gap: 10px; }
.tool-chip {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 14px; text-decoration: none;
  font-size: 14px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); transition: border-color .15s;
}
.tool-chip:hover { border-color: var(--text); }
.tool-chip .wc-icon { width: 30px; height: 30px; background: var(--accent-soft); border-color: transparent; }
@media (max-width: 900px) { .wc-grid { grid-template-columns: 1fr; } .wc-preview { height: 130px; } }

/* ---------- Notifications ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: min(340px, calc(100vw - 40px)); }
.toast {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 14px; font-size: 13px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 40px -18px rgba(10, 10, 10, .35);
  animation: toast-in .35s var(--ease); transition: opacity .35s, transform .35s;
}
.toast strong { color: var(--text); font-size: 14px; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
h1 { font-size: 40px; letter-spacing: -.04em; margin: 0 0 8px; line-height: 1.1; font-weight: 750; }
h2 { font-size: 20px; margin: 0 0 18px; letter-spacing: -.02em; font-weight: 700; }
.lead { color: var(--muted); margin: 0 0 28px; font-size: 17px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  border: 1px solid transparent; border-radius: 999px; padding: 13px 24px; font-weight: 650; cursor: pointer; text-decoration: none;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s, background-color .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 1px rgba(10, 10, 10, .06) inset; }
.btn-primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(10, 10, 10, .1) inset, 0 8px 20px -8px rgba(20, 110, 180, .45); }
.btn-primary:disabled { opacity: .6; }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--text); }
.btn-dark { background: var(--text); color: #fff; }
.btn-dark:hover { background: #2a2a2e; }
.btn-small { padding: 8px 14px; font-size: 13px; }

/* ---------- Accueil : agent de clipping ---------- */
.agent-hero { text-align: center; max-width: 760px; margin: 12px auto 64px; }
.agent-hero h1 { font-size: clamp(36px, 5vw, 52px); }
.agent { position: relative; border-radius: 28px; padding: 6px; transition: background .2s; }
.agent.drag { background: var(--accent-soft); outline: 2px dashed var(--text); outline-offset: 2px; }

.pill {
  display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-soft);
  transition: border-color .15s, box-shadow .15s;
}
.pill:focus-within { border-color: var(--text); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-soft); }
.pill-upload {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg-alt); cursor: pointer; font-size: 18px; transition: background .15s, border-color .15s;
}
.pill-upload:hover { background: var(--accent-soft); border-color: var(--line-strong); }
.pill-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 10px 6px; font-size: 16px; }
.pill-submit { flex: none; padding: 13px 22px; }
.file-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 999px; background: var(--accent-soft); text-align: left; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--muted); font-size: 13px; white-space: nowrap; }
.file-clear { margin-left: auto; border: 0; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted); }
.file-clear:hover { color: var(--text); }
.pill-help { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

.settings { margin-top: 14px; }
.settings summary { display: inline-block; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; list-style: none; }
.settings summary::-webkit-details-marker { display: none; }
.settings summary::before { content: "⚙ "; }
.settings[open] summary { color: var(--text); }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; text-align: left; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-alt); }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.select { width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.range-row { display: flex; align-items: center; gap: 10px; padding-top: 8px; }
.range-row input[type=range] { flex: 1; accent-color: #3aa7e8; }
.range-value { min-width: 24px; text-align: right; font-weight: 700; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; padding-top: 10px; }
.toggle input { width: 18px; height: 18px; accent-color: #3aa7e8; }
.form-error { color: var(--err); font-size: 14px; margin-top: 12px; }

/* ---------- Accueil : grille des projets ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.project {
  display: flex; flex-direction: column; text-decoration: none; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s, transform .25s var(--ease), box-shadow .25s var(--ease);
}
.project:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.project-thumb { aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.project-thumb img, .clip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.is-loading { animation: shimmer 1.4s ease-in-out infinite; }
.is-missing { background: var(--surface-2); }
@keyframes shimmer { 50% { background: #ececea; } }
.project-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.project-title { font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-meta { color: var(--muted); font-size: 13px; }
.project-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; }
.project-count { font-size: 13px; font-weight: 650; }
.project-hint { color: var(--muted); font-size: 12px; text-align: center; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 6px; }
/* Projet en cours : anneau de progression sur la miniature, étape en clair */
.project-thumb { position: relative; }
.project-thumb.is-live img { filter: saturate(.6) brightness(.82); }
.ring { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-track { fill: rgba(255, 255, 255, .88); stroke: rgba(10, 10, 10, .08); stroke-width: 5; }
.ring-fill { fill: none; stroke: #3aa7e8; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.ring-pct { position: relative; font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; }
.live { margin-top: auto; padding-top: 8px; display: grid; gap: 8px; }
.live-step { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; font-weight: 600; }
.live-note { color: var(--muted); font-size: 12px; line-height: 1.4; text-align: center; }
.spinner { flex: none; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--text); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { grid-column: 1 / -1; color: var(--muted); padding: 28px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 14px; }

.badge { font-size: 12px; font-weight: 650; padding: 4px 10px; border-radius: 99px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.badge.done { background: #e8f6ee; color: var(--ok); }
.badge.done::before { content: "● "; font-size: 9px; vertical-align: 1px; }
.badge.running, .badge.queued { background: var(--accent-soft); color: #0b5c8f; }
.badge.error { background: #fdecec; color: var(--err); }
.badge.incomplete { background: var(--surface-2); color: var(--muted); }

/* ---------- Page projet ---------- */
.back { color: var(--muted); text-decoration: none; font-size: 14px; display: inline-block; margin-bottom: 20px; }
.back:hover { color: var(--text); }
.job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.job-head h1 { font-size: 30px; }
.job-head .sub { color: var(--muted); font-size: 14px; }
.job-head .badge { flex: none; max-width: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; max-width: 760px; }
.steps { display: grid; gap: 4px; margin-bottom: 28px; }
.step { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 10px 4px; }
.step-dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); font-size: 12px; font-weight: 750; color: var(--muted);
}
.step.done .step-dot { background: var(--text); border-color: var(--text); color: #fff; }
.step.active .step-dot { border-color: var(--text); background: var(--accent); color: var(--text); animation: pulse 1.4s ease-in-out infinite; }
.step.failed .step-dot { background: var(--err); border-color: var(--err); color: #fff; }
.step-label { font-weight: 600; }
.step:not(.done):not(.active):not(.failed) .step-label { color: var(--muted); }
.step-pct { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.bar { grid-column: 2 / 4; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }

.alert { border-radius: 14px; padding: 14px 16px; margin-bottom: 24px; font-size: 14px; max-width: 760px; }
.alert.error { background: #fdecec; border: 1px solid #f5c2c2; color: #8e1c1c; }
.alert.info { background: var(--bg-alt); border: 1px solid var(--line); color: var(--muted); }

/* ---------- Grille des clips ---------- */
.clip-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1100px) { .clip-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .clip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.clip-card { display: flex; flex-direction: column; gap: 8px; }
.clip-thumb-btn { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 14px; overflow: hidden; }
.clip-thumb { aspect-ratio: 9 / 16; background: var(--surface-2); border-radius: 14px; overflow: hidden; border: 1px solid rgba(10, 10, 10, .08); transition: transform .35s var(--ease); }
.clip-thumb-btn:hover .clip-thumb { transform: scale(1.03); }
.clip-score { position: absolute; top: 8px; left: 8px; background: rgba(255, 255, 255, .95); border-radius: 99px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.clip-play {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .92); font-size: 16px; padding-left: 3px;
  opacity: 0; transform: scale(.9); transition: opacity .2s, transform .25s var(--ease);
}
.clip-thumb-btn:hover .clip-play, .clip-thumb-btn:focus-visible .clip-play { opacity: 1; transform: scale(1); }
.clip-info { display: flex; flex-direction: column; gap: 2px; }
.clip-name {
  padding: 0; border: 0; background: none; cursor: pointer; text-align: left; font-weight: 650; font-size: 14px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.clip-name:hover { text-decoration: underline; }
.clip-dur { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.clip-buttons { display: grid; gap: 6px; }
.btn-post { background: var(--accent-soft); color: #4f6b80; }

/* ---------- Fenêtre d'analyse d'un clip ---------- */
.clip-modal {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0;
  border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -20px rgba(10, 10, 10, .45);
}
.clip-modal::backdrop { background: rgba(10, 10, 10, .55); }
.clip-modal[open] { animation: modal-in .3s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-head { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; flex: 1; }
.modal-x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-x:hover { color: var(--text); }
.modal-body { display: grid; grid-template-columns: 300px 1fr; gap: 24px; padding: 22px; overflow: auto; max-height: calc(100vh - 180px); }
.modal-video video { width: 100%; aspect-ratio: 9 / 16; display: block; background: #111; border-radius: 14px; object-fit: cover; }
.modal-analysis h4 { margin: 0 0 10px; font-size: 15px; }
.timecode { display: inline-block; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 650; padding: 4px 10px; border-radius: 8px; background: var(--accent-soft); }
.reason { color: #2b2b30; margin: 14px 0 18px; line-height: 1.6; }
.modal-analysis dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 16px; font-size: 14px; }
.modal-analysis dt { color: var(--muted); }
.modal-analysis dd { margin: 0; }
.transcript summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.transcript p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .container { padding: 28px 16px 64px; }
  .pill { flex-wrap: wrap; border-radius: 22px; }
  .pill-input { flex-basis: calc(100% - 60px); }
  .pill-submit { width: 100%; }
  .options { grid-template-columns: 1fr; }
  .job-head { flex-direction: column; }
  .clip-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-video video { max-height: 55vh; width: auto; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Fenêtre « Choisir le style » ---------- */
.chooser {
  width: min(920px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 0; overflow: hidden;
  border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -20px rgba(10, 10, 10, .45);
}
.chooser::backdrop { background: rgba(10, 10, 10, .55); }
/* en-tête et boutons fixes, seul le contenu défile : une seule barre de défilement */
.chooser[open] { display: flex; flex-direction: column; animation: modal-in .3s var(--ease); }
.chooser .modal-head, .chooser .modal-foot { flex: none; }
.chooser-body { padding: 20px 22px 8px; overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; min-height: 0; }

.src-box { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-alt); }
.src-thumb { flex: none; width: 112px; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: var(--surface-2); }
.src-thumb img, .src-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.src-text { min-width: 0; }
.src-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.src-meta { color: var(--muted); font-size: 13px; }
.src-error { color: var(--err); font-size: 13px; margin-top: 4px; }

.section-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 22px 0 10px; }
.row-label { font-weight: 650; font-size: 14px; }
.hint { color: var(--muted); font-size: 12px; }

/* Carrousel : la carte du milieu est le style choisi */
/* hauteur = carte 9:16 + son nom, pour que le nom du style choisi ne soit jamais coupé */
.carousel {
  --card-w: clamp(140px, 22vh, 190px); --cw: var(--card-w); --ratio: 9 / 16; --frame-h: calc(var(--card-w) * 16 / 9);
  position: relative; height: calc(var(--frame-h) + 48px); transition: height .35s var(--ease);
}
/* l'aperçu prend le format de sortie choisi */
.carousel[data-aspect="1:1"] { --cw: calc(var(--card-w) * 1.4); --ratio: 1 / 1; --frame-h: calc(var(--card-w) * 1.4); }
.carousel[data-aspect="16:9"] { --cw: calc(var(--card-w) * 2.2); --ratio: 16 / 9; --frame-h: calc(var(--card-w) * 2.2 * 9 / 16); }
.carousel-track { position: absolute; inset: 0 56px; overflow: hidden; }
.style-card {
  position: absolute; left: 50%; top: 6px; width: var(--cw);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% 40%; transition: transform .45s var(--ease), opacity .35s, width .35s var(--ease);
}
.style-frame {
  position: relative; display: block; width: 100%; aspect-ratio: var(--ratio); overflow: hidden; border-radius: 16px; background: #111;
  border: 2px solid transparent; box-shadow: var(--shadow-soft); transition: border-color .2s;
}
.style-card.selected .style-frame { border-color: var(--text); }
.style-card.selected .style-frame::after {
  content: "Choisi"; position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 99px; background: var(--accent); color: var(--accent-ink);
}
.style-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.style-frame.fit { background: #111 url("/media/styles/preview.jpg") center / cover; }
.style-frame.fit::before { content: ""; position: absolute; inset: 0; backdrop-filter: blur(14px) brightness(.7); }
.style-frame.fit video { position: relative; object-fit: contain; }
/* sous-titres dessinés dans une boîte large comme le petit côté de l'image (tailles en cqw) */
.cap-box { position: absolute; top: 0; bottom: 0; left: 50%; width: min(100%, calc(var(--frame-h) - 4px)); transform: translateX(-50%); container-type: inline-size; pointer-events: none; }
.style-name { font-size: 13px; font-weight: 650; color: var(--muted); }
.style-card.selected .style-name { color: var(--text); }
.car-arrow {
  position: absolute; top: 42%; z-index: 20; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: var(--shadow-soft);
}
.car-arrow:hover { border-color: var(--text); }
.car-prev { left: 4px; } .car-next { right: 4px; }
.car-dots { display: flex; justify-content: center; gap: 6px; margin: 6px 0 4px; }
.dot { width: 7px; height: 7px; padding: 0; border-radius: 50%; border: 0; background: var(--line-strong); cursor: pointer; transition: width .25s var(--ease), background .2s; }
.dot.on { width: 20px; border-radius: 99px; background: var(--text); }

.color-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.swatches { display: flex; gap: 8px; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%; padding: 0; cursor: pointer; background: var(--c);
  border: 1px solid rgba(10, 10, 10, .15); box-shadow: 0 0 0 0 var(--text); transition: box-shadow .15s, transform .15s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

.range-box { margin-top: 20px; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 14px; }
.range-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.saver { font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 99px; background: var(--accent-soft); color: #0b5c8f; }
.range-info { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.dual-range { position: relative; height: 28px; margin-top: 10px; }
.range-rail { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 99px; background: var(--surface-2); }
.range-fill { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: var(--accent); }
.dual-range input[type=range] { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.dual-range input[type=range]::-webkit-slider-runnable-track { background: none; }
.dual-range input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; margin-top: 0;
  background: var(--surface); border: 2px solid var(--text); cursor: grab;
}
.dual-range input[type=range]::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--text); cursor: grab; }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- Aperçu des styles ----------
   Mêmes réglages que backend/app/captions.py (STYLES), convertis pour une carte :
   taille en cqw = taille en pixels / 1080 × 100 ; contour = 2 × outline / 1080 × 100.
   Les polices Montserrat sont les fichiers servis par /fonts (ceux du rendu FFmpeg). */
@font-face { font-family: "Montserrat"; font-weight: 600; src: url("/fonts/Montserrat-SemiBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Montserrat"; font-weight: 700; src: url("/fonts/Montserrat-Bold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Montserrat"; font-weight: 800; src: url("/fonts/Montserrat-ExtraBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Montserrat"; font-weight: 900; src: url("/fonts/Montserrat-Black.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Inter Tight Montor"; font-weight: 500; src: url("/fonts/InterTight-Medium.ttf") format("truetype"); font-display: swap; }

.cap {
  position: absolute; left: 4%; right: 4%; top: 70%; transform: translateY(-50%); text-align: center;
  color: #fff; line-height: 1.18; pointer-events: none; font-family: "Montserrat", sans-serif; font-weight: 800;
  font-size: 8.15cqw; -webkit-text-stroke: 1.11cqw #000; paint-order: stroke fill; text-shadow: 0 .28cqw 0 rgba(0, 0, 0, .5);
}
.cap .w { display: inline-block; }
/* Simple (par défaut) : Inter Tight non grasse, aucune couleur ; blanc ou noir selon l'image (couleur envoyée par le serveur) */
.cap-simple { font-family: "Inter Tight Montor", "Inter Tight", sans-serif; font-weight: 500; font-size: 6.85cqw; -webkit-text-stroke: 0;
  text-shadow: 0 .19cqw .45cqw rgba(0, 0, 0, .45); }
.cap-simple.tone-dark { text-shadow: 0 .1cqw .3cqw rgba(255, 255, 255, .45); }
.cap-simple .on, .cap-simple .w.hl { color: inherit; }
/* Classique : phrase entière, minuscules, semi-gras, contour fin */
.cap-classique { font-weight: 600; font-size: 6.11cqw; -webkit-text-stroke: .56cqw #000; text-shadow: 0 .19cqw 0 rgba(0, 0, 0, .5); }
/* Surligné : 3 mots, le mot prononcé change de couleur */
.cap-surligne .on { color: var(--accent); }
/* Pop : 2 mots, le mot prononcé surgit et reste nettement plus gros */
.cap-pop { font-size: 7.78cqw; }
/* le mot grossi prend vraiment sa place (taille de police, pas un simple agrandissement visuel) */
.cap-pop .on { color: var(--accent); font-size: 1.25em; -webkit-text-stroke-width: 1.4cqw; animation: cap-pop .12s ease-out both; }
@keyframes cap-pop { from { transform: scale(1.16); } to { transform: scale(1); } }
/* Hormozi : 4 mots sur deux lignes, très gras, ombre marquée */
.cap-hormozi { font-weight: 900; font-size: 8.89cqw; -webkit-text-stroke: 1.3cqw #000; text-shadow: 0 .56cqw 0 rgba(0, 0, 0, .6); }
.cap-hormozi .on { color: var(--accent); }
/* Boîte : le mot prononcé posé sur un bloc de couleur */
.cap-boite { font-size: 7.78cqw; -webkit-text-stroke: .93cqw #000; text-shadow: none; }
.cap-boite .on { color: #000; -webkit-text-stroke: 0; background: var(--accent); border-radius: 1.6cqw; padding: 0 1.85cqw; }
/* Minimaliste : un seul mot à la fois */
.cap-minimaliste { font-weight: 700; font-size: 7.59cqw; -webkit-text-stroke: .74cqw #000; text-shadow: 0 .19cqw 0 rgba(0, 0, 0, .5); }
/* Glow : minuscules grasses, halo lumineux + ombre sombre pour rester lisible */
.cap-glow { font-weight: 700; font-size: 7.78cqw; -webkit-text-stroke: 0;
  text-shadow: 0 0 1.3cqw rgba(0, 0, 0, .45), 0 0 1.1cqw var(--accent), 0 0 2.4cqw var(--accent); }
/* Vlog : phrase entière, serif fin, ton crème */
.cap-vlog { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 6.3cqw; -webkit-text-stroke: 0;
  text-shadow: 0 .28cqw .5cqw rgba(0, 0, 0, .55); }
.cap-none { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .45); padding: 3px 9px; border-radius: 99px; }

/* Format de sortie */
.format-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.format-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 16px 10px 14px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .15s, background .15s;
}
.format-card:hover { border-color: var(--line-strong); }
.format-card.on { border-color: var(--text); background: var(--accent-soft); }
.format-shape { display: block; border: 2px solid currentColor; border-radius: 6px; margin-bottom: 8px; color: var(--muted); }
.format-card.on .format-shape { color: var(--text); }
.shape-9-16 { width: 20px; height: 34px; }
.shape-1-1 { width: 30px; height: 30px; margin-top: 2px; margin-bottom: 10px; }
.shape-16-9 { width: 40px; height: 23px; margin-top: 6px; margin-bottom: 13px; }
.format-name { font-weight: 700; font-size: 14px; }
.format-ratio { font-size: 12px; font-weight: 650; color: var(--muted); }
.format-use { font-size: 12px; color: var(--muted); }

@media (max-width: 720px) {
  .format-grid { gap: 6px; }
  .format-use { display: none; }
  .carousel { --card-w: 140px; }
  .carousel[data-aspect="16:9"] { --cw: calc(var(--card-w) * 1.5); --frame-h: calc(var(--card-w) * 1.5 * 9 / 16); }
  .carousel-track { inset: 0 44px; }
  .color-row { flex-direction: column; align-items: flex-start; }
  .range-info { margin-left: 0; width: 100%; }
}

/* ---------- Actions d'un projet (annuler, relancer, supprimer) ---------- */
.job-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.action-buttons { display: flex; gap: 8px; }
.btn-danger { color: var(--err); }
.btn-danger:hover { border-color: var(--err); }
.badge.cancelled { background: var(--surface-2); color: var(--muted); }
@media (max-width: 720px) { .job-actions { justify-content: flex-start; } }

/* ---------- Correction des textes d'un clip ---------- */
.analysis-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.analysis-head h4 { margin: 0; }
.edit-hint { margin: 0 0 14px; line-height: 1.5; }
.edit-label { display: block; font-size: 13px; font-weight: 650; margin: 14px 0 6px; }
.edit-input {
  width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 11px; outline: none; resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.edit-input:focus { border-color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }
.edit-sentences { display: grid; gap: 8px; }
.edit-sentence { line-height: 1.45; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.replace-box { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.replace-box .edit-label { margin-top: 0; }
.replace-row { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; }
.replace-row > span { color: var(--muted); }
.edit-msg { margin-top: 12px; font-size: 13px; padding: 9px 12px; border-radius: 10px; background: var(--bg-alt); border: 1px solid var(--line); }
.edit-msg.ok { background: #e8f6ee; border-color: #bfe6cf; color: var(--ok); }
.edit-msg.error { background: #fdecec; border-color: #f5c2c2; color: var(--err); }
@media (max-width: 720px) {
  .replace-row { grid-template-columns: 1fr; }
  .replace-row > span { display: none; }
}



/* ---------- Chargements (squelettes) et erreurs avec la mascotte ---------- */
.skel { background: linear-gradient(90deg, #efefec 0%, #f7f7f5 45%, #efefec 90%); background-size: 200% 100%;
  animation: skel-shine 1.3s ease-in-out infinite; border-radius: 12px; }
@keyframes skel-shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skel-card { display: grid; gap: 10px; }
.skel-thumb { aspect-ratio: 16 / 10; }
.skel-line { height: 14px; width: 80%; }
.skel-line.short { width: 45%; }
.skel-block { height: 96px; }
.ed-skel { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: minmax(320px, 55vh) 160px; gap: 16px; padding: 16px; }
.ed-skel-video { grid-row: 1; }
.ed-skel-side { display: grid; gap: 12px; align-content: start; }
.ed-skel-tl { grid-column: 1 / -1; }
@media (max-width: 760px) { .ed-skel { grid-template-columns: 1fr; grid-template-rows: 50vh 120px; } .ed-skel-side { display: none; } }
.inline-err { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }

.app-err { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 16px; }
.app-err-robot { position: relative; width: 150px; height: 150px; }
.app-err-robot img { width: 100%; height: 100%; object-fit: contain; animation: app-err-lost 3.2s ease-in-out infinite;
  transform-origin: 50% 85%; filter: drop-shadow(0 20px 26px rgba(20, 110, 180, .22)); }
.app-err-bubble { position: absolute; top: -4px; right: -14px; width: 42px; height: 42px; border-radius: 50% 50% 50% 8px; display: grid;
  place-items: center; background: #fff; border: 2px solid var(--text); font-weight: 800; font-size: 22px; }
.app-err-code { margin: 18px 0 0; font-weight: 800; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #1f87c9; }
.app-err h1 { margin: 6px 0 0; max-width: 560px; font-size: clamp(24px, 4vw, 34px); line-height: 1.12; }
.app-err-text { margin: 12px 0 0; max-width: 480px; color: var(--muted); }
.app-err-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
@keyframes app-err-lost { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .skel, .app-err-robot img { animation: none; } }
.project-expiry { margin-top: 6px; font-size: 12.5px; font-weight: 600; color: #b45309; }
