/* CinePlan — sombre « salle de montage » par défaut, accent bleu électrique ; thème clair ; impression A4. Typographie système. */
:root {
  --bg: #101318; --bg2: #0c0f13; --card: #171b22; --card2: #1d222b; --ink: #e9edf3; --mute: #9aa4b2; --line: #2a313c; --field: #12161c; --soft: #222833;
  --accent: #3d8bff; --accent-ink: #ffffff; --res: #8fbcff; --ok: #4fd18b; --warn: #ffb547; --bad: #ff6b6b; --info: #8fbcff;
  --ok-bg: #12301f; --warn-bg: #33270f; --bad-bg: #3a1618; --info-bg: #142338; --focus: #8fbcff; --radius: 12px;
  --sa-t: env(safe-area-inset-top, 0px); --sa-b: env(safe-area-inset-bottom, 0px); --sa-l: env(safe-area-inset-left, 0px); --sa-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f4f6; --bg2: #e9ebef; --card: #ffffff; --card2: #f7f8fa; --ink: #12161c; --mute: #525c69; --line: #d5d9e0; --field: #fbfcfd; --soft: #eceff3;
  --accent: #1a5fd6; --accent-ink: #ffffff; --res: #1450b8; --ok: #13703d; --warn: #8a5300; --bad: #b3261e; --info: #1450b8;
  --ok-bg: #e5f5ec; --warn-bg: #fff3df; --bad-bg: #fde8e7; --info-bg: #e8f0fd; --focus: #1a5fd6; color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; background: var(--bg); }
button, a, input, select, summary, label, textarea, .seg, .chips { touch-action: manipulation; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; padding-bottom: calc(74px + var(--sa-b)); overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--res); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: calc(8px + var(--sa-l)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mute { color: var(--mute); }
h2 { font-size: 1rem; margin: 0; }
h3 { font-size: .95rem; margin: 16px 0 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
svg { flex: none; }

/* En-tête */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: calc(6px + var(--sa-t)) calc(10px + var(--sa-r)) 6px calc(10px + var(--sa-l)); }
.top-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.08rem; min-height: 44px; white-space: nowrap; }
.brand b { color: var(--accent); }
.project-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; color: var(--mute); text-align: left; }
.pb-txt { color: var(--ink); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: .72rem; border: 1px solid var(--line); border-radius: 99px; padding: 3px 8px; white-space: nowrap; color: var(--mute); }
.pill.save[data-state="error"], .pill.save[data-state="temporary"] { color: var(--warn); border-color: var(--warn); }
.pill.save[data-state="saved"] { color: var(--ok); }
.pill.off { color: var(--warn); }
.pill[hidden], .update-bar[hidden], .toast[hidden] { display: none; }
@media (max-width: 560px) { .pill.save { display: none; } .pill.save[data-state="error"], .pill.save[data-state="temporary"] { display: inline; } .brand span { display: none; } }
.top-actions { display: flex; gap: 2px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--mute); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn.sm { width: 40px; height: 40px; }

/* Récapitulatif */
.summary { padding: 10px calc(10px + var(--sa-r)) 0 calc(10px + var(--sa-l)); }
.sum-in { max-width: 1280px; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.sum-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.sum-item { display: grid; align-content: start; min-width: 0; }
.sum-l { font-size: .72rem; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; }
.sum-item b { font-size: .98rem; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sum-item small { color: var(--mute); font-size: .78rem; }
.sum-item.bad b { color: var(--bad); }
.sum-item.status { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 8px; }
.s-ready b { color: var(--ok); } .s-check b { color: var(--warn); } .s-todo b { color: var(--info); }
@media (min-width: 760px) { .sum-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } .sum-item.status { grid-column: auto; border-top: 0; padding-top: 0; } }

/* Onglets */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(6, 1fr); background: color-mix(in srgb, var(--bg2) 94%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 4px calc(4px + var(--sa-r)) calc(4px + var(--sa-b)) calc(4px + var(--sa-l)); }
.tabs button { display: grid; justify-items: center; gap: 2px; min-height: 56px; padding: 6px 2px; border: 0; background: transparent; color: var(--mute); border-radius: 10px; cursor: pointer; font-size: .68rem; font-weight: 650; }
.tabs button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabs button[aria-selected="true"] { color: var(--accent); background: var(--soft); }
.tabs .tl-short { display: none; }
@media (max-width: 620px) { .tabs .tl-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .tabs .tl-short { display: block; } }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabs { position: sticky; top: calc(57px + var(--sa-t)); bottom: auto; max-width: 1280px; margin: 10px auto 0; border: 1px solid var(--line); border-radius: 12px; padding: 4px; background: var(--card); }
  .tabs button { grid-auto-flow: column; gap: 8px; min-height: 44px; font-size: .9rem; align-items: center; justify-content: center; }
}

/* Panneau */
.panel { max-width: 1280px; margin: 0 auto; padding: 12px calc(10px + var(--sa-r)) 12px calc(10px + var(--sa-l)); outline: none; scroll-margin-top: 64px; }
.cols { display: grid; gap: 12px; }
.col-in, .col-out { display: grid; gap: 12px; align-content: start; min-width: 0; }
@media (min-width: 1000px) { .cols { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card > * + * { margin-top: 10px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
details.card > summary, details.profile > summary, details > summary { cursor: pointer; font-weight: 650; min-height: 32px; }
.result { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, var(--card)), var(--card)); }
.r-mid { font-size: 1.2rem; font-weight: 700; color: var(--res); margin: 0; }
.r-sub { margin: 4px 0 0; color: var(--mute); font-size: .92rem; }
.kind { font-size: .66rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; border-radius: 99px; padding: 3px 8px; border: 1px solid currentColor; white-space: nowrap; }
.k-calc { color: var(--res); } .k-est { color: var(--warn); } .k-doc { color: var(--ok); } .k-user, .k-tip { color: var(--mute); }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; border-radius: 6px; padding: 2px 7px; white-space: nowrap; border: 1px solid currentColor; }
.b-ok { color: var(--ok); background: var(--ok-bg); } .b-cond { color: var(--warn); background: var(--warn-bg); } .b-custom { color: var(--info); background: var(--info-bg); } .b-bad { color: var(--bad); background: var(--bad-bg); }
.note { font-size: .86rem; color: var(--mute); margin: 0; }
.note.warn { color: var(--warn); background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); border-radius: 10px; padding: 10px 12px; }
.note.info { color: var(--info); background: var(--info-bg); border-radius: 10px; padding: 10px 12px; }
.warn { color: var(--warn); }
.kv { margin: 0; display: grid; gap: 6px; }
.kv div { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--mute); font-size: .86rem; } .kv dd { margin: 0; font-size: .92rem; }
.tips { margin: 6px 0 0; padding-left: 20px; font-size: .9rem; display: grid; gap: 5px; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl thead th { color: var(--mute); font-weight: 650; font-size: .76rem; white-space: nowrap; }
.tbl.compact td, .tbl.compact th { padding: 4px 6px; }
.tbl.grid th[scope="row"] { position: sticky; left: 0; background: var(--card); white-space: nowrap; color: var(--mute); font-weight: 600; }
.tbl.grid td { white-space: nowrap; }
.tbl.grid tr.differs th, .tbl.grid tr.differs td { background: var(--warn-bg); }
.tbl.grid tr.differs th::before { content: "≠ "; color: var(--warn); font-weight: 800; }

/* Champs */
.fld { display: grid; gap: 4px; min-width: 0; }
.fld.wide, .grid2 > .wide { grid-column: 1 / -1; }
.f-lab { font-size: .84rem; color: var(--mute); font-weight: 600; }
.f-box { display: flex; align-items: center; background: var(--field); border: 1px solid var(--line); border-radius: 10px; min-height: 46px; min-width: 0; overflow: hidden; }
.f-box:focus-within { border-color: var(--focus); }
.f-box input, .f-box select { flex: 1 1 auto; width: 0; min-width: 0; border: 0; background: transparent; min-height: 44px; padding: 0 10px; font-size: 16px; outline: none; }
.f-box select { appearance: none; -webkit-appearance: none; background: linear-gradient(45deg, transparent 50%, var(--mute) 50%) calc(100% - 16px) 50% / 6px 6px no-repeat, linear-gradient(-45deg, transparent 50%, var(--mute) 50%) calc(100% - 10px) 50% / 6px 6px no-repeat; padding-right: 26px; max-width: 100%; text-overflow: ellipsis; }
.f-box select option { background: var(--card); color: var(--ink); }
.f-box input[type="date"] { color-scheme: inherit; }
.f-unit { padding: 0 10px; color: var(--mute); font-size: .86rem; white-space: nowrap; }
.f-hint { font-size: .78rem; color: var(--mute); }
.f-err { font-size: .8rem; color: var(--bad); margin: 0; }
.f-err:empty { display: none; }
input[aria-invalid="true"] { color: var(--bad); }
textarea { width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 16px; resize: vertical; min-height: 70px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 10px; }
.seg { display: flex; flex-wrap: wrap; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1 1 auto; min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--mute); cursor: pointer; font-weight: 650; font-size: .88rem; padding: 0 10px; }
.seg button.on { background: var(--soft); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.chk { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 0; cursor: pointer; }
.chk input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.chk small { display: block; color: var(--mute); font-size: .78rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 40px; min-width: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--card2); cursor: pointer; font-weight: 650; }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); cursor: pointer; font-weight: 650; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 38px; font-size: .86rem; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: transparent; }
.linklike { border: 0; background: none; padding: 4px 0; color: var(--res); text-decoration: underline; cursor: pointer; font-size: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Caméras, séquences, supports */
.cam > summary { display: flex; align-items: center; gap: 10px; list-style: none; min-height: 52px; }
.cam > summary::-webkit-details-marker { display: none; }
.cam > summary::after { content: ""; width: 10px; height: 10px; border-right: 2px solid var(--mute); border-bottom: 2px solid var(--mute); transform: rotate(45deg); margin-left: auto; flex: none; }
.cam[open] > summary::after { transform: rotate(-135deg); }
.cam.inactive { opacity: .65; }
.cam-tag { display: grid; place-items: center; min-width: 38px; height: 38px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 800; padding: 0 6px; }
.cam-sum { display: grid; min-width: 0; flex: 1; }
.cam-sum b, .cam-sum small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-sum small { color: var(--mute); font-weight: 500; font-size: .8rem; }
.cam-form { display: grid; gap: 10px; margin-top: 10px; }
.grp { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0; min-width: 0; display: grid; gap: 8px; }
.grp legend { padding: 0 6px; font-weight: 700; font-size: .88rem; color: var(--res); }
.mode-line { margin: 0; font-size: .88rem; }
.profile { border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; }
.profile > * + * { margin-top: 8px; }
.seqs, .seq { display: grid; gap: 10px; }
.seq, .media { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card2); display: grid; gap: 8px; }
.seq-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.seq-h b { display: flex; align-items: center; gap: 6px; }
.cards-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .86rem; }
.cards-list li { border-left: 3px solid var(--line); padding: 4px 8px; }
.cards-list .cc-ok { border-color: var(--ok); } .cards-list .cc-low, .cards-list .cc-unsupported { border-color: var(--bad); } .cards-list .cc-unknown { border-color: var(--warn); }
.helper-out { display: grid; gap: 4px; }

/* Alertes */
.alert { border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 10px 12px; background: var(--card); display: grid; gap: 6px; }
.alert header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert .lvl { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.alert dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: .88rem; }
.alert dt { color: var(--mute); } .alert dd { margin: 0; }
.alert.l-block { border-left-color: var(--bad); } .alert.l-block .lvl, .alert.l-block svg { color: var(--bad); }
.alert.l-review { border-left-color: var(--warn); } .alert.l-review .lvl, .alert.l-review svg { color: var(--warn); }
.alert.l-info { border-left-color: var(--info); } .alert.l-info .lvl, .alert.l-info svg { color: var(--info); }
.alert.accepted { opacity: .75; border-left-color: var(--ok); } .alert.accepted .lvl { color: var(--ok); }
.alert .acc { margin: 0; font-size: .86rem; }
@media (max-width: 480px) { .alert dl { grid-template-columns: 1fr; } .alert dt { margin-top: 4px; } }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 2px; border-bottom: 1px dashed var(--line); }
.checklist .chk { flex: 1; min-width: 0; }
.add-row { display: flex; gap: 6px; }
.add-row .f-box { flex: 1; }
.add-row input { flex: 1; min-width: 0; border: 0; background: transparent; min-height: 44px; padding: 0 10px; font-size: 16px; outline: none; }

/* Fiche */
.sheet { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.sheet h1 { font-size: 1.3rem; margin: 0; } .sheet h2 { font-size: 1rem; margin: 16px 0 6px; color: var(--res); }
.sheet .meta { color: var(--mute); margin: 4px 0 0; font-size: .9rem; }
.sheet ul { margin: 0; padding-left: 18px; font-size: .9rem; display: grid; gap: 3px; }
.sheet .pre { white-space: pre-wrap; font-size: .9rem; }
.sheet .foot-note { color: var(--mute); font-size: .78rem; margin-top: 14px; }
.sheet-tbl { font-size: .8rem; } .sheet-tbl td, .sheet-tbl th { white-space: nowrap; }
.print-sheet { display: none; }

/* Modales, projets */
dialog.modal { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); padding: 0; width: min(560px, calc(100vw - 20px)); max-height: calc(100dvh - 30px - var(--sa-t) - var(--sa-b)); }
dialog.modal.wide { width: min(780px, calc(100vw - 20px)); }
dialog.modal[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #000000b0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 6px 16px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 14px 16px; overflow: auto; display: grid; gap: 10px; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 10px 16px 12px; border-top: 1px solid var(--line); }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plist li { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 2px 4px 2px 10px; background: var(--field); }
.plist li.on { border-color: var(--accent); }
.fav { flex: 1; min-width: 0; text-align: left; border: 0; background: none; display: grid; min-height: 48px; cursor: pointer; padding: 4px 0; }
.fav b, .fav small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .fav small { color: var(--mute); }
.about ol, .about ul { margin: 0; }

/* Pied, bandeau, messages */
.foot { max-width: 1280px; margin: 10px auto 0; padding: 8px calc(14px + var(--sa-r)) 20px calc(14px + var(--sa-l)); font-size: .8rem; color: var(--mute); }
.foot p { margin: 6px 0; }
.update-bar { position: fixed; z-index: 40; left: calc(10px + var(--sa-l)); right: calc(10px + var(--sa-r)); bottom: calc(80px + var(--sa-b)); max-width: 560px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; box-shadow: 0 10px 30px #0008; }
.update-bar > span { flex: 1 1 200px; display: grid; } .update-bar small { color: var(--mute); }
.toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(88px + var(--sa-b)); max-width: calc(100vw - 30px); background: var(--soft); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: .9rem; box-shadow: 0 8px 24px #0008; }
@media (min-width: 900px) { .update-bar { bottom: 20px; } .toast { bottom: 24px; } }
.noscript { padding: 20px; text-align: center; }

/* Impression A4 : seule la fiche est imprimée */
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; color: #000 !important; padding: 0 !important; font-size: 10.5pt; overflow: visible !important; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block !important; }
  .sheet { border: 0; padding: 0; background: #fff; color: #000; }
  .sheet h2 { color: #000; break-after: avoid; } .sheet .meta, .sheet .foot-note { color: #333; }
  .sheet table, .sheet ul { break-inside: auto; } .sheet tr, .sheet li { break-inside: avoid; }
  .tbl th, .tbl td { border-color: #999; color: #000; } .tbl-wrap { overflow: visible; }
  .sheet-tbl { font-size: 8pt; } .sheet-tbl td, .sheet-tbl th { white-space: normal; padding: 3px 4px; }
}
/* Grille de compatibilité : pleine largeur */
@media (min-width: 1000px) { body[data-tab="compat"] .cols { grid-template-columns: minmax(0, 1fr); } }
.media-sum { display: flex; align-items: center; gap: 8px; list-style: none; min-height: 44px; }
.media-sum::-webkit-details-marker { display: none; }
.media-sum span { display: grid; min-width: 0; } .media-sum small { color: var(--mute); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.media:not([open]) { padding-bottom: 4px; }
