/* Studio Montage - interface. Jetons de couleur en tete ; mode sombre via prefers-color-scheme. */
:root {
  --ink: #101828; --muted: #5a6577; --line: #e2e7ee; --bg: #f3f5f9; --card: #ffffff; --soft: #f7f9fc;
  --brand: #2748d0; --brand-ink: #1a34a8; --brand-soft: #e9eeff; --on-brand: #ffffff;
  --ok: #0e7a54; --ok-soft: #e1f4ea; --warn: #9a5a06; --warn-soft: #fdf0d8;
  --err: #b0261e; --err-soft: #fdebe9; --info: #1d5da6; --info-soft: #e4effa;
  --side: #0e1626; --side-ink: #c9d3e6; --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 14px rgba(16,24,40,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8edf6; --muted: #98a3b8; --line: #263247; --bg: #0b1220; --card: #121b2d; --soft: #0f1829;
    --brand: #6f8bff; --brand-ink: #9db0ff; --brand-soft: #1a2750; --on-brand: #0b1220;
    --ok: #4cc79a; --ok-soft: #10301f; --warn: #f0b15a; --warn-soft: #36270d;
    --err: #ff8a80; --err-soft: #3a1714; --info: #7db6f2; --info-soft: #11283f;
    --side: #070c17; --side-ink: #aab6cf; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; } h3 { font-size: 1rem; margin: 1.1rem 0 .4rem; }
p { margin: 0 0 .75rem; } .muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }

/* Mise en page */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .brand { color: #fff; font-weight: 700; font-size: 1.05rem; padding: 4px 10px 16px; display: block; letter-spacing: .01em; }
.side a.nav { display: flex; justify-content: space-between; align-items: center; color: var(--side-ink); padding: 8px 10px; border-radius: 8px; font-size: .93rem; }
.side a.nav:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.side a.nav.on { background: rgba(255,255,255,.12); color: #fff; }
.side .sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 4px; opacity: .6; }
.side form { margin-top: 18px; padding: 0 4px; }
.main { padding: 26px clamp(16px, 3vw, 40px) 60px; max-width: 1280px; width: 100%; }
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top .in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 12px 20px; flex-wrap: wrap; }
.top .brand { font-weight: 700; color: var(--ink); } .top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.top nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; } .top nav a.on, .top nav a:hover { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 26px 20px 70px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols.two { grid-template-columns: 2fr 1fr; } .cols.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .cols.two, .cols.three { grid-template-columns: 1fr; } }

/* Cartes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card > h2:first-child { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card.flat { box-shadow: none; background: var(--soft); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi b { font-size: 1.5rem; display: block; line-height: 1.1; } .kpi span { color: var(--muted); font-size: .83rem; }

/* Badges, alertes */
.badge { display: inline-block; font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; } .badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.err { background: var(--err-soft); color: var(--err); border-color: transparent; } .badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.note { border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; background: var(--info-soft); color: var(--info); border: 1px solid transparent; }
.note.ok { background: var(--ok-soft); color: var(--ok); } .note.warn { background: var(--warn-soft); color: var(--warn); } .note.err { background: var(--err-soft); color: var(--err); }
.note a { color: inherit; text-decoration: underline; } .note ul { margin: 4px 0 0 18px; padding: 0; }
.flash { position: sticky; top: 0; z-index: 30; }

/* Boutons et formulaires */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: var(--on-brand); border: 1px solid var(--brand); padding: 8px 16px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brand-ink); text-decoration: none; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--brand-ink); border-color: var(--line); } .btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; } .btn.sm { padding: 4px 10px; font-size: .86rem; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
label { display: block; font-weight: 600; font-size: .88rem; margin: 0 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
textarea { min-height: 84px; resize: vertical; } input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.field { margin-bottom: 12px; } .field .hint { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin-bottom: 6px; } .check input { margin-top: 4px; }
.inline { display: inline; } .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; } details[open] > summary { margin-bottom: 6px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; } legend { padding: 0 6px; font-weight: 600; font-size: .9rem; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; } tr:last-child td { border-bottom: 0; } tbody tr:hover { background: var(--soft); }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Etapes */
.stepper { display: flex; gap: 0; margin: 4px 0 18px; overflow-x: auto; padding-bottom: 4px; }
.step { flex: 1; min-width: 86px; text-align: center; font-size: .78rem; color: var(--muted); position: relative; padding-top: 22px; }
.step::before { content: ""; position: absolute; top: 5px; left: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--line); transform: translateX(-50%); z-index: 1; }
.step::after { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.step:first-child::after { display: none; }
.step.done { color: var(--ink); } .step.done::before, .step.done::after { background: var(--ok); } .step.now { color: var(--brand-ink); font-weight: 700; }
.step.now::before { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); } .step.now::after { background: var(--ok); }

/* Frise chronologique */
.timeline { list-style: none; margin: 0; padding: 0; } .timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.timeline li:last-child { border-bottom: 0; } .timeline time { color: var(--muted); font-size: .82rem; }
.timeline .hid { opacity: .65; }

/* Devis */
.quote { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.quote .qh { background: var(--soft); padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.quote .qb { padding: 12px 14px; } .quote table td { padding: 6px 4px; } .total { font-size: 1.2rem; font-weight: 700; }
.conditions { font-size: .86rem; color: var(--muted); } .conditions li { margin-bottom: 4px; }

/* Formules */
.formulas { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 18px; }
.formula { position: relative; border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--card); cursor: pointer; display: block; font-weight: 400; }
.formula input { position: absolute; opacity: 0; } .formula:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.formula:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.formula .name { font-size: 1.1rem; font-weight: 700; } .formula .price { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin: 4px 0; }
.formula ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: .88rem; }

/* Candidats */
.cands { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.cand { border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.cand:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cand video { width: 100%; aspect-ratio: 9/16; background: #000; display: block; object-fit: cover; }
.cand .cb { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; } .cand .t { font-weight: 600; font-size: .9rem; line-height: 1.25; }
.cand .check { margin: 0; align-items: center; font-weight: 600; } .cand .check input { margin: 0; width: 18px; height: 18px; }
.selbar { position: sticky; bottom: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(16,24,40,.18); padding: 12px 16px; margin-top: 16px; z-index: 5; }

/* Televersement */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; background: var(--soft); transition: .15s; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); } progress { width: 100%; height: 10px; accent-color: var(--brand); }

/* Charge */
.bars { display: flex; gap: 6px; align-items: flex-end; height: 90px; } .bar { flex: 1; min-width: 14px; background: var(--brand-soft); border-radius: 5px 5px 0 0; position: relative; display: flex; align-items: flex-end; }
.bar i { display: block; width: 100%; background: var(--brand); border-radius: 5px 5px 0 0; } .bar.hot i { background: var(--warn); } .bar.over i { background: var(--err); }
.bar span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: .66rem; color: var(--muted); } .bars-wrap { padding-bottom: 20px; }
.toggle { display: flex; gap: 6px; flex-wrap: wrap; } .toggle button { flex: 1; min-width: 120px; }
.toggle .btn.cur { box-shadow: 0 0 0 3px var(--brand-soft); } .toggle .btn.online.cur { background: var(--ok); border-color: var(--ok); color: #fff; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-right: 6px; } .dot.online { background: var(--ok); } .dot.busy { background: var(--warn); }

/* Connexion */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; } .auth .card { width: 100%; } .auth h1 { text-align: center; margin-bottom: 14px; }
.sticky-nav { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 8px 0; display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.sticky-nav a { padding: 4px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: .84rem; }
.sticky-nav a:hover { color: var(--brand-ink); text-decoration: none; border-color: var(--brand); }
.pre { white-space: pre-wrap; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .88rem; }
dialog { border: 0; border-radius: var(--radius); padding: 0; background: var(--card); color: var(--ink); max-width: min(420px, 94vw); box-shadow: 0 12px 40px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(8,12,22,.55); } dialog .in { padding: 20px; }
@media print { .side, .top, .flash, .actions, .btn { display: none !important; } body { background: #fff; } }

/* Liste de demarrage, carte d'etat */
.spread { display: flex; justify-content: space-between; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.progress-line { height: 6px; background: var(--soft); border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.progress-line i { display: block; height: 100%; background: var(--ok); transition: width .4s; }
.guide { list-style: none; margin: 0; padding: 0; }
.guide li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.guide li:first-child { border-top: 0; }
.guide .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); margin-top: 1px; display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: #fff; }
.guide li.done .tick { background: var(--ok); border-color: var(--ok); } .guide li.done .tick::before { content: "\2713"; }
.guide li.done b { color: var(--muted); font-weight: 600; }
.guide .body { flex: 1; min-width: 0; } .guide .act { flex: none; }
.preset-help { background: var(--info-soft); color: var(--info); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }

/* Catalogue elargi : cartes groupees, prix « a partir de » */
.group-title { margin: 22px 0 2px; font-size: 1.05rem; } .group-intro { margin: 0 0 10px; }
.formula .price .from { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: 0; text-transform: none; }
.formula .price { line-height: 1.15; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Fichiers par emplacement : une zone de depot compacte par ligne */
.drop.compact { padding: 8px 10px; text-align: left; border-width: 1px; }
.drop.compact .drop-title { margin: 0 0 4px; font-size: .86rem; }
.drop.compact input[type=file] { max-width: 100%; font-size: .84rem; }
.drop.compact input.slot-label { margin-bottom: 6px; }
.drop.compact .msg { margin: 4px 0 0; }
table.slots td { vertical-align: top; } table.slots td:last-child { min-width: 210px; }
.switched-form { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.switched-form .btn { margin-top: 6px; }
.draft-player { width: 100%; max-height: 70vh; background: #000; border-radius: 10px; display: block; margin-bottom: 8px; }

/* Tableau de bord : tuiles cliquables, alerte */
a.kpi { color: inherit; display: block; } a.kpi:hover { text-decoration: none; border-color: var(--brand); }
.kpi.bad b { color: var(--err); }
