/* Milinkut : design system des espaces (Geist local, sombre, accent orange #f97316, rayons, pilules). Aucune ressource distante. */
@font-face { font-family: "Geist"; src: url("/ui/fonts/geist-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/ui/fonts/geist-mono-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #0a0a0b; --surface: #121214; --surface-2: #1c1c1f; --surface-3: #26262b;
  --text: #ededef; --muted: #a1a1aa; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.16);
  --accent: #f97316; --accent-2: #fb923c; --accent-3: #c2410c; --accent-ink: #1a0b00;
  --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent); --accent-line: color-mix(in srgb, var(--accent) 45%, transparent);
  --danger: #f87171; --ok: #34d399; --warn: #fbbf24;
  --r-card: 22px; --r-inner: 16px; --r-field: 14px; --r-pill: 999px;
  --f-body: "Geist", system-ui, sans-serif; --f-mono: "Geist Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1); --gap: 16px;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 18px 40px -22px rgba(0,0,0,.85);
  --lane-h: 34px; --lane-label: 92px;
  /* couleurs des pistes (contraste >= 3:1 sur --surface-2) */
  --tk-plan: #3f3f46; --tk-plan-line: #71717a; --tk-titre: #f97316; --tk-st: #e4e4e7; --tk-son: #38bdf8; --tk-musique: #a78bfa; --tk-calque: #34d399;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
body { font: 400 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; min-height: 100dvh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }

/* ---------- boutons, pastilles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; font-weight: 550; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent-line); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.chip.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.chip.accent { color: var(--accent-2); border-color: var(--accent-line); background: var(--accent-soft); }
.tabs { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 4px; padding: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { scroll-snap-align: start; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 14px; white-space: nowrap; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--text); border-color: var(--accent-line); }
.tab .count { margin-left: 6px; color: var(--muted); font-size: 12px; }

/* ---------- coque ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 18px; }
.brand small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 550; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link[aria-current="page"] { color: var(--text); background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.nav-link svg { width: 18px; height: 18px; flex: none; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 6px; font-size: 12px; }
.main { min-width: 0; padding: 28px 32px 48px; }
.tabbar { display: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head p { margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: var(--gap); }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-inner); }
.err-box { padding: 12px 14px; border-radius: var(--r-inner); background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.note { font-size: 13px; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll-x { overflow-x: auto; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; }

/* ---------- projets ---------- */
.proj { display: flex; flex-direction: column; gap: 12px; text-decoration: none; transition: border-color .2s var(--ease); }
.proj:hover { border-color: var(--accent-line); }
.proj-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.versions { list-style: none; margin: 0; padding: 0; }
.versions li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.versions li:first-child { border-top: 0; }
.vnum { font-family: var(--f-mono); font-weight: 650; color: var(--muted); }
.versions li.head .vnum { color: var(--accent-2); }
.vmsg { font-size: 14px; overflow-wrap: anywhere; }
.diff-list { list-style: none; margin: 0; padding: 0; font-family: var(--f-mono); font-size: 12.5px; }
.diff-list li { padding: 6px 8px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.diff-list li.add { color: var(--ok); }
.diff-list li.remove { color: var(--danger); }

/* ---------- bibliotheque ---------- */
.lib { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: var(--gap); align-items: start; }
.asset-list { list-style: none; margin: 0; padding: 0; }
.asset-list button { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; text-align: left; padding: 11px 12px; border-radius: 12px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.asset-list button:hover { background: var(--surface-2); }
.asset-list button[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.asset-list .nm { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-list .sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail { position: sticky; top: 20px; }
.detail video, .detail img.logo-prev { width: 100%; max-height: 360px; object-fit: contain; background: #000; border-radius: var(--r-inner); }
.detail img.logo-prev { background: #3f3f46; padding: 16px; }
.detail audio { width: 100%; }
.sprite { width: 100%; border-radius: 10px; display: block; }
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r-inner); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- montage (timeline) ---------- */
.ed-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ed-head .title { display: flex; flex-direction: column; min-width: 0; }
.ed-head select { min-height: 36px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line-2); padding: 0 12px; }
.ed { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "stage side" "tl tl"; gap: var(--gap); align-items: start; }
.ed > .stage { grid-area: stage; } .ed > .ed-side { grid-area: side; min-width: 0; } .ed > .timeline { grid-area: tl; margin-top: 0; min-width: 0; }
.stage { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.stage-frame { position: relative; background: #000; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); }
.stage-frame iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; background: #000; }
.stage-frame .overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; color: var(--muted); font-size: 13px; }
.transport { display: flex; align-items: center; gap: 8px; }
.timecode { font-family: var(--f-mono); font-size: 14px; font-variant-numeric: tabular-nums; min-width: 150px; text-align: center; }
.props { min-width: 0; }
.props h3 { margin-bottom: 10px; }
.props .kv { font-size: 13.5px; }
.timeline { margin-top: var(--gap); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.tl-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tl-body { display: grid; grid-template-columns: var(--lane-label) minmax(0, 1fr); }
.tl-labels { border-right: 1px solid var(--line); background: var(--surface); }
.tl-labels div { height: var(--lane-h); display: flex; align-items: center; padding: 0 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); white-space: nowrap; }
.tl-labels div.ruler-l { height: 28px; border-top: 0; }
.tl-labels div.tall, .lane.tall { height: 56px; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; position: relative; overscroll-behavior-x: contain; }
.tl-inner { position: relative; }
.ruler { position: relative; height: 28px; cursor: pointer; background: var(--surface); }
.tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-2); font-size: 11px; color: var(--muted); padding-left: 4px; font-family: var(--f-mono); }
.tick.minor { top: 18px; border-left-color: var(--line); }
.lane { position: relative; height: var(--lane-h); border-top: 1px solid var(--line); background: var(--surface-2); }
.lane canvas { position: absolute; left: 0; top: 0; pointer-events: none; }
.item { position: absolute; top: 4px; bottom: 4px; min-width: 2px; border-radius: 6px; border: 1px solid transparent; padding: 0 6px; font-size: 11.5px; line-height: 24px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; text-align: left; color: var(--text); }
.lane.tall .item { line-height: 46px; }
.item.plan { background: var(--tk-plan); border-color: var(--tk-plan-line); }
.item.titre { background: color-mix(in srgb, var(--tk-titre) 26%, var(--surface-2)); border-color: var(--tk-titre); }
.item.st { background: color-mix(in srgb, var(--tk-st) 14%, var(--surface-2)); border-color: color-mix(in srgb, var(--tk-st) 50%, transparent); }
.item.st.cache { opacity: .55; border-style: dashed; }
.item.son { background: color-mix(in srgb, var(--tk-son) 22%, var(--surface-2)); border-color: var(--tk-son); }
.item.musique { background: color-mix(in srgb, var(--tk-musique) 22%, var(--surface-2)); border-color: var(--tk-musique); }
.item.calque { background: color-mix(in srgb, var(--tk-calque) 22%, var(--surface-2)); border-color: var(--tk-calque); }
.item.sel { outline: 2px solid var(--accent); outline-offset: 0; z-index: 2; }
.lane-empty { position: absolute; left: 8px; top: 0; line-height: var(--lane-h); font-size: 12px; color: var(--muted); }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); pointer-events: none; z-index: 5; }
.playhead::before { content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: var(--accent); }
.check-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }

/* ---------- editeur (phase 2) ---------- */
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.banner { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--r-inner); background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.banner[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60; max-width: min(92vw, 560px);
  padding: 10px 16px; border-radius: var(--r-inner); background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; transition: opacity .2s, transform .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.ed-side { max-height: var(--side-h, calc(100dvh - 140px)); overflow-y: auto; overscroll-behavior: contain; }
.ed-side .sheet-close { display: none; }
.ed-side .stack { gap: 12px; }
.group { border: 1px solid var(--line); border-radius: var(--r-inner); padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.group legend { padding: 0 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.field label { font-size: 12.5px; color: var(--muted); }
.field.bool { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
.field.bool label { order: 2; color: var(--text); font-size: 14px; }
.field input[type=text], .field textarea, .field select, .cap-list input[type=text], .cap-list select, .group select, .group input[type=text] {
  width: 100%; min-height: 38px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); padding: 6px 10px; }
.field textarea { resize: vertical; }
.field-err { color: var(--danger); font-size: 12.5px; }
.field-err:empty { display: none; }
.numbox { display: inline-flex; align-items: center; gap: 4px; }
.numbox input.num { width: 82px; min-height: 34px; text-align: center; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); font-family: var(--f-mono); font-size: 13px; }
.numbox .step { width: 32px; min-height: 32px; font-family: var(--f-mono); }
.trimbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-radius: var(--r-inner); background: var(--surface-2); }
.actions .btn { flex: 0 0 auto; }
.cap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cap-list li.cap { border: 1px solid var(--line); border-radius: var(--r-inner); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.cap-list li.cap.focus { border-color: var(--accent-line); }
.cap-list li .row > input[type=text] { flex: 1 1 140px; width: auto; }
.cap-list select { width: auto; flex: 1 1 140px; }
.tpair { display: inline-flex; align-items: center; gap: 6px; }
.check-inline { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.warn-line { color: var(--warn); font-size: 13px; }
.linkish { background: none; border: 0; padding: 0; color: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; font-size: 13.5px; }
.check-items li { font-size: 13.5px; }
.sync.bad { color: var(--danger); font-weight: 650; }
.kbd-help { margin-top: 12px; }
.kbd-help summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.mob-actions { display: none; }
/* timeline editable */
.item .lbl { pointer-events: none; }
.item.plan { padding: 0 10px; }
.item .h-l, .item .h-r { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; background: transparent; }
.item .h-l { left: 0; border-radius: 6px 0 0 6px; } .item .h-r { right: 0; border-radius: 0 6px 6px 0; }
.item.sel .h-l, .item.sel .h-r, .item:hover .h-l, .item:hover .h-r { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.item.dragging { opacity: .85; z-index: 6; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.item.diff-mod { border-color: var(--warn); box-shadow: inset 0 -3px 0 var(--warn); }
.item.diff-new { border-color: var(--ok); box-shadow: inset 0 -3px 0 var(--ok); }
.item.has-err { background: color-mix(in srgb, var(--danger) 30%, var(--surface-2)); }
.item.voix { cursor: default; }
.snap-mark { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--ok); z-index: 7; pointer-events: none; font-size: 10.5px; color: var(--ok); padding-left: 3px; white-space: nowrap; }
.drop-mark { position: absolute; top: 28px; bottom: 0; width: 3px; margin-left: -1px; background: var(--ok); z-index: 7; pointer-events: none; }
.snap-mark[hidden], .drop-mark[hidden] { display: none; }
.cmp-note { padding: 6px 12px; border-bottom: 1px solid var(--line); color: var(--warn); }
.item.diff-mod::after, .item.diff-new::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--warn); }
.item.diff-new::after { background: var(--ok); }
/* repere de recadrage (zone du centre du produit 45-52 %) */
.crop-guide { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.crop-guide[hidden], .picker[hidden] { display: none; }
.crop-guide .band { position: absolute; left: 0; right: 0; top: 45%; height: 7%; background: color-mix(in srgb, var(--ok) 16%, transparent); border-top: 1px dashed var(--ok); border-bottom: 1px dashed var(--ok); }
.crop-guide .axis { position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed var(--ok); }
.crop-guide .pt { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid var(--accent); background: rgba(0,0,0,.35); }
.picker { position: absolute; inset: 0; z-index: 4; background: transparent; border: 2px solid var(--accent); border-radius: 14px; cursor: crosshair; }

/* ---------- memoire de style ---------- */
.rules { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.rule { display: flex; flex-direction: column; gap: 10px; }
.rule blockquote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; font-style: italic; }
.rule .prov { font-size: 12.5px; color: var(--muted); }
.dom-title { margin: 22px 0 10px; }

/* ---------- agents ---------- */
.agent { display: flex; flex-direction: column; gap: 8px; }
.agent .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.agent .state { font-weight: 600; }

/* ---------- connexion ---------- */
.login-body { display: grid; place-items: center; min-height: 100dvh; padding: 20px;
  background: radial-gradient(900px 520px at 88% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%), var(--bg); }
.login-card { width: min(100%, 380px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 30px 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center; }
.login-card .brand-mark { margin: 0 auto 4px; width: 52px; height: 52px; border-radius: 16px; font-size: 26px; }
.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.login-form input[type=password] { min-height: 46px; border-radius: var(--r-field); border: 1px solid var(--line-2); background: var(--surface-2); padding: 0 14px; }
.check { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 14px; color: var(--muted); }
.login-card .err { color: var(--danger); font-size: 14px; }

/* ---------- mobile ---------- */
@media (max-width: 1100px) {
  .lib { grid-template-columns: minmax(0, 1fr); }
  .detail { position: static; }
  .ed { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "tl" "side"; }
  .ed-side { max-height: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .main { padding: 18px 14px 96px; }
  h1 { font-size: 22px; }
  .tabbar { display: grid; grid-template-columns: repeat(7, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--line); backdrop-filter: blur(14px); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 550; }
  .tabbar a[aria-current="page"] { color: var(--accent-2); background: var(--accent-soft); }
  .tabbar svg { width: 20px; height: 20px; }
  .versions li { grid-template-columns: 44px minmax(0, 1fr); }
  .versions li .vact { grid-column: 2; }
  :root { --lane-label: 64px; --lane-h: 32px; }
  .tl-labels div { padding: 0 6px; font-size: 11px; }
  .timecode { min-width: 120px; font-size: 13px; }
  /* editeur au telephone : actions par boutons, panneau de proprietes en plein ecran */
  .mob-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .mob-actions .btn { min-height: 40px; }
  .ed-head .row .btn-sm { min-height: 36px; }
  .ed > .ed-side { display: none; }
  .ed > .ed-side.sheet { display: block; position: fixed; inset: 0; z-index: 40; max-height: none; border-radius: 0; padding: 14px 14px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; }
  .ed-side.sheet .sheet-close { display: inline-flex; }
  .sheet-head { position: sticky; top: -14px; z-index: 2; background: var(--surface); padding: 6px 0 8px; margin-top: -6px; flex-wrap: nowrap; }
  .sheet-head .tabs { flex: 1 1 auto; min-width: 0; }
  body.sheet-open .tabbar { display: none; }
  .tl-tools .sync { flex-basis: 100%; }
  .tl-tools .tl-edit { display: none; }
  .ed-head .hd-undo { display: none; }
  .sheet-head .tab { min-height: 34px; padding: 0 10px; font-size: 13px; }
  .item .h-l, .item .h-r { display: none; }
}

/* statut d'enregistrement a largeur fixe : son texte change toutes les secondes sans deplacer la page (selection a la souris) */
.ed-head .row > .note[role="status"] { flex: 0 0 30ch; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ---- montage par le texte (phase 3) ---- */
.tx .tx-opts { gap: 6px 16px; }
.tx-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tx-words { font-size: 16px; line-height: 2.05; max-height: min(52vh, 460px); overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-inner); background: var(--surface); user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.tx-words:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.w { padding: 2px 3px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.w.in { color: var(--text); }
.w.relire { text-decoration: underline dotted var(--warn); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.w.corr { color: #fde68a; }
.w.garder { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--text); }
.w.couper { text-decoration: line-through; text-decoration-color: var(--danger); text-decoration-thickness: 2px; opacity: .7; }
.w.sel { background: var(--accent); color: var(--accent-ink); }
.w.active { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.tx-legend .w { cursor: default; font-size: 12px; }
.tx-block { display: inline-block; font-size: 11px; line-height: 1.5; padding: 0 8px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--muted); font-family: var(--f-mono); vertical-align: middle; }
.tx-block.rire { background: color-mix(in srgb, var(--tk-musique) 25%, transparent); color: var(--text); }
.tx-bar { position: sticky; top: -1px; z-index: 3; display: grid; gap: 6px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-inner); background: var(--surface-2); }
.tx-bar .tx-sum { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.tx-bar .row { gap: 6px; }
@media (max-width: 760px) {
  .ed > .ed-side.text-inline:not(.sheet) { display: block; max-height: none; }
  .tx-words { max-height: 46vh; font-size: 17px; line-height: 2.2; }
  .tx-bar { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 30; box-shadow: var(--shadow); padding: 6px 8px; gap: 4px; }
  .tx-bar.empty { position: static; box-shadow: none; }
  body.tx-hors-ecran .tx-bar:not(.empty) { display: none; }
  .tx-bar .tx-sum { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
  .tx-bar .row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .tx-bar .row .btn { flex: 0 0 auto; min-height: 40px; }
  .tx-bar .tx-last { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; font-size: 12px; }
  .ed-side.text-inline { padding-bottom: 120px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.main:focus { outline: none; }
.thumb-cell { background-repeat: no-repeat; }
.tab { text-decoration: none; display: inline-flex; align-items: center; }
.sprite-box { max-height: 200px; overflow-y: auto; border-radius: 10px; }
.grid > .card + .card, .rules > .card + .card, .lib > .card + .card { margin-top: 0; }

/* ---- phase 4 : agents (proposition en diff, jamais appliquee sans clic) ---- */
.item.diff-del { opacity: .55; text-decoration: line-through; border-style: dashed; border-color: var(--danger); background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--danger) 22%, transparent) 6px 8px); }
.item.diff-del::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--danger); }
.timeline.proposal .cmp-note { color: var(--text); border-left: 3px solid var(--warn); padding-left: 8px; }
.agent-panel textarea { width: 100%; min-height: 72px; border-radius: var(--r-field); background: var(--surface-2); border: 1px solid var(--line-2); padding: 10px 12px; resize: vertical; }
.agent-panel select { min-height: 40px; border-radius: var(--r-field); background: var(--surface-2); border: 1px solid var(--line-2); padding: 0 12px; width: 100%; }
.ag-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-examples .btn { min-height: 32px; font-size: 12.5px; padding: 0 12px; text-align: left; white-space: normal; line-height: 1.25; }
.ag-ctx { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.ag-check { display: inline-flex; align-items: flex-start; gap: 8px; font-size: 13.5px; cursor: pointer; }
.ag-check input { margin-top: 3px; accent-color: var(--accent); }
.ag-current { border: 1px solid var(--line-2); border-radius: var(--r-inner); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.ag-current > p { margin: 0; }
.ag-quote { font-style: italic; overflow-wrap: anywhere; }
.ag-changes > li { padding: 7px 0 7px 10px; border-left: 3px solid var(--warn); margin-top: 4px; font-size: 13.5px; overflow-wrap: anywhere; }
.ag-changes > li:first-child { border-top: 0; }
.ag-changes > li.new { border-left-color: var(--ok); }
.ag-changes > li.del { border-left-color: var(--danger); }
.ag-actions { gap: 8px; }
.ag-history summary { cursor: pointer; font-size: 13.5px; color: var(--muted); }
.ag-history li { font-size: 13px; overflow-wrap: anywhere; }
.ag-q { color: var(--warn); }
.ag-form > summary { cursor: pointer; font-size: 13.5px; color: var(--muted); padding: 4px 0; }
details.ag-form[open] { display: flex; flex-direction: column; gap: 12px; }

/* ---- phase 5 : memoire de style, controle de montage, retours ---- */
.nav-link { position: relative; }
.nav-link .badge { position: absolute; left: 24px; top: 5px; margin: 0; height: 16px; min-width: 16px; font-size: 10px; padding: 0 4px; }
.badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tabbar a { position: relative; }
.tabbar .badge { position: absolute; top: 2px; right: 8px; margin: 0; height: 17px; min-width: 17px; font-size: 10.5px; padding: 0 4px; }
.learn .honest { font-size: 14.5px; line-height: 1.45; }
.learn-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0 6px; }
.learn-stats .stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-inner); background: var(--surface-2); }
.learn-stats .stat strong { font-size: 22px; line-height: 1.1; }
.learn-stats .stat span { font-size: 12.5px; color: var(--muted); }
.learn-stats .stat.warn strong { color: var(--warn); }
.review { border-color: var(--accent-line); }
.review h2 { font-size: 17px; margin: 0 0 6px; }
.st-tools { display: flex; flex-direction: column; gap: 10px; margin: var(--gap) 0; }
.st-tools input[type=search], .st-tools select { min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.st-tools input[type=search] { flex: 1 1 220px; min-width: 0; }
.add-rule summary, .proofs summary, .hist summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.add-rule .stack { margin-top: 10px; }
.bulk-bar { position: sticky; top: 0; z-index: 5; padding: 8px 12px; margin: 10px 0; border: 1px solid var(--line-2); border-radius: var(--r-inner); background: var(--surface); }
.rule-head h3 { flex: 1 1 160px; margin: 0; font-size: 15.5px; }
.rule-head input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.rule.st-refusee, .rule.st-desactivee { opacity: .62; }
.rule.st-candidate { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.rule .stack input[type=text], .rule .stack textarea, .rule .stack select { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: inherit; }
.proofs .list > li, .hist .list > li { font-size: 12.5px; padding: 6px 0; }
.fb-box { margin-top: var(--gap); }
.fb-item p { margin: 0 0 4px; }
.lint-group h4 { margin: 12px 0 6px; font-size: 13.5px; }
.lint-plan { border-top: 1px solid var(--line); padding: 8px 0; }
.lint-plan > .linkish { font-weight: 650; }
.lint-plan.on { background: var(--accent-soft); border-radius: 10px; padding: 8px; box-shadow: inset 2px 0 0 var(--accent); }
.lint-item { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 0 4px; font-size: 13.5px; }
.lint-item details summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.lint-item details p { margin: 4px 0; font-size: 12.5px; }
.lint-manque { font-size: 12.5px; color: var(--warn); }
.fb-zone textarea { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: inherit; resize: vertical; }
.fb-zone select { min-height: 32px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); padding: 0 10px; }
@media (max-width: 760px) {
  .learn-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-tools .row > * { flex: 1 1 auto; }
}

/* ---- phase 6 : page Rendus ---- */
.renders-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.renders-grid > .col { min-width: 0; }
.renders-grid .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .renders-grid { grid-template-columns: minmax(0, 1fr); } }
.render-video { display: block; width: 100%; max-height: 70vh; aspect-ratio: 9 / 16; background: #000; border-radius: var(--r-inner); object-fit: contain; }
.render-item { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.render-item:first-child { border-top: 0; }
.render-item.on { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }
.queue li { padding: 8px 0; border-top: 1px solid var(--line); }
.queue li:first-child { border-top: 0; }
.sha { word-break: break-all; }
.steps { margin: 4px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.desc-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.desc-grid textarea, .field input[type=text] { width: 100%; }
.desc-grid textarea { min-height: 220px; font-size: 13px; line-height: 1.45; }
.lint-mini li { padding: 2px 0; }
.renders-grid select, .renders-grid input[type=text] { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); max-width: 100%; }

/* Montage a 390 px : le lien Rendus est dans la barre du bas (evite une 3e ligne d en-tete) */
@media (max-width: 759px) { .ed-head .rend-link { display: none; } }

/* ---- aide (phase 7) ---- */
.help-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.help-steps { margin: 10px 0; padding-left: 22px; display: grid; gap: 6px; font-size: 14px; }
.help-keys h3 { margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
.help-keys th { text-align: left; white-space: nowrap; font-weight: 500; padding-right: 10px; vertical-align: top; }
kbd { font-family: var(--f-mono); font-size: 12px; padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); }
.help-spaces { flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.card h3 { margin-top: 14px; }
.login-card .sso-btn { min-height: 44px; }
.login-card .small { font-size: 12.5px; margin: 0; }
@media (max-width: 760px) { .tabbar a span { font-size: 10.5px; } .help-keys th { white-space: normal; } }
.new-proj .row > input[type=text] { flex: 2 1 220px; width: auto; }
.new-proj .row > select { flex: 1 1 200px; width: auto; }
