/* Kairos · DA « Régie » : multiview de broadcast, tally, timecode, file In/Out. */
:root {
  --bg: #0B0C0E; --panel: #131417; --panel2: #1A1C20; --line: #262930; --line2: #33373F;
  --text: #ECEDEF; --mute: #8A8F98; --faint: #5A5F68;
  --tally: #FF3B30; --cue: #FFC400; --air: #2BD45A; --info: #4C8DFF;
  --tally-soft: rgba(255,59,48,.14); --cue-soft: rgba(255,196,0,.13); --air-soft: rgba(43,212,90,.13);
  --shadow: 0 10px 40px rgba(0,0,0,.45);
  --ui: "Barlow", system-ui, sans-serif; --cond: "Barlow Condensed", "Barlow", sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
  --r: 10px; --r2: 14px; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F1F1EE; --panel: #FFFFFF; --panel2: #F7F7F4; --line: #E0E0DA; --line2: #CFCFC8;
    --text: #121316; --mute: #686C73; --faint: #A3A6AB;
    --tally: #E5322A; --cue: #C99700; --air: #16A447; --info: #2F6FE0;
    --tally-soft: rgba(229,50,42,.10); --cue-soft: rgba(201,151,0,.12); --air-soft: rgba(22,164,71,.10);
    --shadow: 0 10px 40px rgba(20,20,20,.12); color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F1F1EE; --panel: #FFFFFF; --panel2: #F7F7F4; --line: #E0E0DA; --line2: #CFCFC8;
  --text: #121316; --mute: #686C73; --faint: #A3A6AB;
  --tally: #E5322A; --cue: #C99700; --air: #16A447; --info: #2F6FE0;
  --tally-soft: rgba(229,50,42,.10); --cue-soft: rgba(201,151,0,.12); --air-soft: rgba(22,164,71,.10);
  --shadow: 0 10px 40px rgba(20,20,20,.12); color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 500 15px/1.4 var(--ui); -webkit-font-smoothing: antialiased; overflow: hidden; touch-action: manipulation; }
body, button, a { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
input, textarea { user-select: text; -webkit-user-select: text; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }
::-webkit-scrollbar { width: 0; height: 0; }
.mute { color: var(--mute); }
.mono { font-family: var(--mono); font-feature-settings: "zero" 1; letter-spacing: -.01em; }
.label { font: 600 11.5px/1 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.big { font: 700 34px/1 var(--cond); letter-spacing: -.01em; }

/* ---- structure : rail (ordi) / barre du bas (iPhone) ---- */
.app { display: grid; grid-template-columns: 216px minmax(0, 1fr); height: 100dvh; }
.rail { display: flex; flex-direction: column; gap: 2px; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; font: 700 19px/1 var(--cond); letter-spacing: .16em; }
.logo { width: 28px; height: 28px; }
.logo.big { width: 64px; height: 64px; margin: 0 auto 10px; }
.logo-box { fill: var(--text); }
.logo-k { stroke: var(--bg); stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.logo-dot { fill: var(--tally); }
.tab { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 9px; color: var(--mute);
  font: 600 14px/1 var(--ui); transition: background .2s var(--ease), color .2s var(--ease); }
.tab svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tab svg .fill { fill: currentColor; stroke: none; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); background: var(--panel2); }
.tab.on::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--cue); }
.badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--cue); color: #111;
  font: 700 12.5px/20px var(--cond); text-align: center; }
.rail-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.stage { position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; opacity: 0; pointer-events: none;
  transform: translateY(6px); transition: opacity .22s var(--ease), transform .22s var(--ease); padding: 26px 30px 60px; }
.view.on { opacity: 1; pointer-events: auto; transform: none; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .rail { order: 2; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + var(--sab)); border-right: 0;
    border-top: 1px solid var(--line); gap: 0; backdrop-filter: blur(20px); }
  .brand, .rail-foot { display: none; }
  .tab { flex: 1; flex-direction: column; gap: 5px; padding: 7px 0 4px; font-size: 11px; border-radius: 0; background: none !important; }
  .tab.on::before { left: 30%; right: 30%; top: -7px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .tab svg { width: 24px; height: 24px; }
  .badge { position: absolute; top: 2px; left: calc(50% + 8px); margin: 0; min-width: 19px; height: 17px; font-size: 11.5px; line-height: 17px; padding: 0 5px; }
  .view { padding: calc(14px + var(--sat)) 16px 30px; }
}

/* ---- en-têtes de vue ---- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { margin: 0; font: 700 30px/1 var(--cond); letter-spacing: .01em; text-transform: uppercase; }
.head .sub { margin-top: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }

/* ---- boutons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  background: var(--panel2); border: 1px solid var(--line2); font: 600 14px/1 var(--ui); white-space: nowrap;
  transition: transform .12s var(--ease), background .2s var(--ease), opacity .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--text); color: var(--bg); border-color: transparent; }
.btn.air { background: var(--air); color: #04140A; border-color: transparent; font-weight: 700; }
.btn.ghost { background: none; }
.btn.danger { color: var(--tally); }
.btn.wide { width: 100%; height: 48px; font-size: 15.5px; }
.btn.small { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.busy { pointer-events: none; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line2); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- champs ---- */
.field { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 6px 0 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line2);
  transition: border-color .2s; }
.field:focus-within { border-color: var(--text); }
.field input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--text); font: 500 15px var(--ui); }
.field input::placeholder { color: var(--faint); }
textarea.area, input.line { width: 100%; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; color: var(--text);
  font: 500 15px/1.45 var(--ui); padding: 10px 12px; outline: 0; resize: none; transition: border-color .2s; }
textarea.area:focus, input.line:focus { border-color: var(--text); }
input.line.title { font: 700 19px/1.2 var(--cond); letter-spacing: .01em; text-transform: uppercase; }

/* ---- tally et pastilles ---- */
.tally { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font: 700 12px/1 var(--cond); letter-spacing: .12em; }
.tally.rec { background: var(--tally); color: #fff; }
.tally.rec::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.6s steps(1) infinite; }
.tally.cue { background: var(--cue); color: #111; }
.tally.air { background: var(--air); color: #04140A; }
.tally.off { background: var(--panel2); color: var(--mute); border: 1px solid var(--line2); }
@keyframes blink { 50% { opacity: .25; } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--tally); box-shadow: 0 0 0 4px var(--tally-soft); }
.dot.ok { background: var(--air); }
.plat { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font: 700 11px/1 var(--cond); color: #fff; flex: none; }
.plat.twitch { background: #9146FF; } .plat.kick { background: #2BC016; color: #000; } .plat.youtube { background: #FF0033; } .plat.replay { background: var(--line2); color: var(--text); }

/* ---- régie : multiview ---- */
.multiview { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tile { position: relative; border-radius: var(--r2); overflow: hidden; background: #000; aspect-ratio: 16 / 9; outline: 2px solid transparent;
  outline-offset: -2px; transition: outline-color .3s var(--ease); isolation: isolate; }
.tile.rec { outline-color: var(--tally); }
.tile.hot { outline-color: var(--cue); animation: hot 1.2s var(--ease) 3; }
@keyframes hot { 50% { outline-color: transparent; } }
.tile img.frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s; }
.tile img.frame.ready { opacity: 1; }
.tile .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 32%, rgba(0,0,0,0) 48%, rgba(0,0,0,.82) 100%); }
.tile .top { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; align-items: center; gap: 8px; color: #fff; }
.tile .name { font: 700 16px/1 var(--cond); letter-spacing: .03em; text-transform: uppercase; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.tile .tc { margin-left: auto; font: 500 13px/1 var(--mono); color: #fff; background: rgba(0,0,0,.55); padding: 4px 7px; border-radius: 5px; }
.tile .bottom { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: flex-end; gap: 10px; color: #fff; }
.meters { display: flex; gap: 3px; height: 40px; align-items: flex-end; }
.meter { width: 7px; height: 100%; border-radius: 2px; background: rgba(255,255,255,.14); position: relative; overflow: hidden; }
.meter i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, #2BD45A 0%, #2BD45A 60%, #FFC400 78%, #FF3B30 100%);
  background-size: 100% 40px; background-position: bottom; transition: height .6s var(--ease); }
.meter-l { font: 600 9.5px/1 var(--cond); letter-spacing: .1em; color: rgba(255,255,255,.65); margin-top: 3px; text-align: center; }
.spark { flex: 1; min-width: 0; height: 40px; }
.spark path.l { fill: none; stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark path.a { fill: rgba(255,255,255,.12); }
.spark line { stroke: var(--cue); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.tile .count { font: 700 22px/1 var(--cond); text-align: right; }
.tile .count small { display: block; font: 600 9.5px/1 var(--cond); letter-spacing: .1em; color: rgba(255,255,255,.65); margin-top: 3px; }
.tile.empty { background: var(--panel); border: 1px dashed var(--line2); display: grid; place-items: center; color: var(--mute); outline: 0; }

.strip { margin-top: 26px; }
.strip-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.source { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line);
  min-width: 0; transition: border-color .2s; }
.source:hover { border-color: var(--line2); }
.source .nm { font: 600 14.5px/1.1 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source .st { font: 500 12px/1.2 var(--ui); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.add { margin-top: 10px; }

/* journal façon liste d'événements vMix */
.events { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.ev { display: grid; grid-template-columns: 72px 22px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 13.5px; }
.ev:first-child { border-top: 0; }
.ev .t { font: 500 12px/1 var(--mono); color: var(--mute); }
.ev .m { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .k { width: 8px; height: 8px; border-radius: 2px; background: var(--faint); margin: auto; }
.ev .k.live { background: var(--tally); } .ev .k.clip, .ev .k.moment { background: var(--cue); } .ev .k.publié { background: var(--air); } .ev .k.erreur { background: var(--tally); }

/* ---- à valider ---- */
.review { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; height: 100%; }
.queue { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; padding-right: 2px; }
.qi { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 8px; border-radius: 11px;
  border: 1px solid transparent; transition: background .2s, border-color .2s; text-align: left; }
.qi:hover { background: var(--panel); }
.qi.on { background: var(--panel); border-color: var(--line2); }
.qi img, .qi .ph { width: 44px; height: 78px; object-fit: cover; border-radius: 7px; background: var(--panel2); }
.qi .tt { font: 700 15px/1.1 var(--cond); text-transform: uppercase; letter-spacing: .01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qi .meta { font: 500 12px/1 var(--mono); color: var(--mute); margin-top: 6px; }
.qi .sc { font: 700 21px/1 var(--cond); color: var(--cue); }
.qi.rendering .sc { color: var(--mute); }

.deck { display: flex; gap: 28px; align-items: flex-start; justify-content: center; min-height: 0; }
.deck .player { flex: none; }
.deck .inspector { flex: 1 1 340px; max-width: 410px; }
.player { position: relative; height: min(calc(100dvh - 110px), 820px); aspect-ratio: 9 / 16; border-radius: 18px; overflow: hidden; background: #000;
  box-shadow: var(--shadow); touch-action: pan-y; transition: transform .35s var(--ease), opacity .35s var(--ease); }
.player video { width: 100%; height: 100%; object-fit: cover; display: block; }
.player .ov { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.player .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.18); }
.player .prog i { display: block; height: 100%; background: #fff; width: 0; }
.player .tap { position: absolute; inset: 0; }
.player.swipe-r { transform: translateX(40%) rotate(6deg); opacity: 0; }
.player.swipe-l { transform: translateX(-40%) rotate(-6deg); opacity: 0; }
.player .stamp { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-8deg); padding: 8px 16px; border: 3px solid; border-radius: 10px;
  font: 700 30px/1 var(--cond); letter-spacing: .12em; opacity: 0; transition: opacity .15s; }
.player .stamp.r { color: var(--air); } .player .stamp.l { color: var(--tally); }
.player .rendering { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0,0,0,.55); font: 600 13px var(--cond); letter-spacing: .1em; }
.inspector { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.scorebox { display: flex; align-items: flex-end; gap: 14px; }
.scorebox .big { color: var(--cue); font-size: 56px; }
.why { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line);
  font: 600 13px/1 var(--ui); white-space: nowrap; }
.chip b { font: 700 13px/1 var(--mono); color: var(--cue); }
.chip.sel { border-color: var(--text); background: var(--panel); }
.chip.acc img { width: 18px; height: 18px; border-radius: 50%; }
.curve { position: relative; height: 92px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; touch-action: none; }
.curve svg { width: 100%; height: 100%; }
.curve .area { fill: var(--cue-soft); } .curve .line { fill: none; stroke: var(--cue); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.curve .chat { fill: none; stroke: var(--mute); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .7; }
.curve .thr { stroke: var(--faint); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.curve .head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); transform: translateX(-1px); pointer-events: none; }
.curve .peak { position: absolute; top: 6px; transform: translateX(-50%); font: 700 10px/1 var(--cond); letter-spacing: .1em; color: var(--cue); }
.curve .out { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--bg) 72%, transparent); pointer-events: none; }
.curve .h { position: absolute; top: 0; bottom: 0; width: 16px; transform: translateX(-8px); cursor: ew-resize; touch-action: none; }
.curve .h::after { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: var(--text); }
.curve-axis { display: flex; justify-content: space-between; margin-top: 6px; font: 500 11.5px/1 var(--mono); color: var(--mute); }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.keys { font: 500 11.5px/1 var(--mono); color: var(--faint); text-align: center; }
kbd { font: inherit; padding: 2px 5px; border: 1px solid var(--line2); border-radius: 4px; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.seg button { height: 30px; padding: 0 12px; border-radius: 7px; font: 600 13px/1 var(--ui); color: var(--mute); transition: background .2s, color .2s; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.empty-state { display: grid; place-items: center; text-align: center; padding: 70px 20px; color: var(--mute); gap: 10px; }
.empty-state .big { color: var(--text); }

@media (max-width: 1100px) { .review { grid-template-columns: 1fr; } .queue { display: none; } }
@media (max-width: 820px) {
  .deck { flex-direction: column; align-items: stretch; gap: 14px; }
  .deck .inspector { max-width: none; flex: none; }
  .keys { display: none; }
  .player { height: auto; width: 100%; max-height: calc(100dvh - 210px - var(--sat) - var(--sab)); margin: 0 auto; }
  #v-valider.view { padding-top: calc(8px + var(--sat)); }
  .scorebox .big { font-size: 44px; }
}

/* ---- publiés ---- */
.posted { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.pc { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.pc .thumb { position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: var(--panel2); }
.pc .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pc .views { position: absolute; left: 8px; bottom: 8px; font: 700 20px/1 var(--cond); color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.pc .views small { font: 600 10px/1 var(--cond); letter-spacing: .1em; display: block; opacity: .8; }
.pc .tt { font: 700 14.5px/1.15 var(--cond); text-transform: uppercase; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 22px; }
.kpi { padding: 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.kpi .big { margin-top: 8px; }

/* ---- réglages ---- */
.settings { display: grid; gap: 26px; max-width: 760px; }
.group h2 { margin: 0 0 10px; }
.card { border-radius: 14px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 14px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .nm { font: 600 14.5px/1.2 var(--ui); }
.item .hint { font: 500 12.5px/1.3 var(--mono); color: var(--mute); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .field { height: 40px; margin-top: 8px; }
.item.open { grid-template-columns: 1fr; }
.range { width: 100%; accent-color: var(--cue); }
.val { font: 700 18px/1 var(--cond); min-width: 48px; text-align: right; }
.switch { position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--line2); transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .22s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--air); } .switch.on::after { transform: translateX(18px); }

/* ---- feuille du bas, toast, connexion ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0; transition: opacity .25s; }
.sheet { position: absolute; left: 50%; bottom: 0; width: min(560px, 100%); max-height: 88dvh; transform: translate(-50%, 100%); background: var(--panel);
  border-radius: 20px 20px 0 0; border: 1px solid var(--line); border-bottom: 0; box-shadow: var(--shadow); transition: transform .32s var(--ease);
  display: flex; flex-direction: column; padding-bottom: var(--sab); }
.sheet-wrap.open .sheet-back { opacity: 1; } .sheet-wrap.open .sheet { transform: translate(-50%, 0); }
.grip { height: 22px; display: grid; place-items: center; cursor: grab; }
.grip::after { content: ""; width: 38px; height: 5px; border-radius: 3px; background: var(--line2); }
.sheet-body { overflow-y: auto; padding: 4px 20px 22px; display: grid; gap: 14px; }
@media (min-width: 821px) { .sheet { bottom: auto; top: 50%; border-radius: 20px; border-bottom: 1px solid var(--line); transform: translate(-50%, -46%); opacity: 0;
  transition: transform .28s var(--ease), opacity .2s; } .sheet-wrap.open .sheet { transform: translate(-50%, -50%); opacity: 1; } .grip { display: none; } .sheet-body { padding-top: 22px; } }
.toast { position: fixed; left: 50%; bottom: calc(86px + var(--sab)); transform: translate(-50%, 20px); opacity: 0; z-index: 60; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; font: 600 14px/1.2 var(--ui); transition: opacity .2s, transform .25s var(--ease); max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 821px) { .toast { bottom: 28px; } }
.login { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.login-card { width: min(340px, 100%); text-align: center; display: grid; gap: 10px; }
.login h1 { margin: 0; font: 700 30px/1 var(--cond); letter-spacing: .2em; }
.err { color: var(--tally); font-size: 14px; }

/* trim et facecam dans la feuille */
.srcwrap { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; touch-action: none; }
.srcwrap video { width: 100%; height: 100%; display: block; }
.fc { position: absolute; border: 2px solid var(--cue); border-radius: 6px; background: rgba(255,196,0,.08); cursor: move; touch-action: none; }
.fc .rs { position: absolute; right: -9px; bottom: -9px; width: 20px; height: 20px; border-radius: 6px; background: var(--cue); cursor: nwse-resize; }
.fc .lb { position: absolute; left: 6px; top: 5px; font: 700 10px/1 var(--cond); letter-spacing: .1em; color: var(--cue); }
.reveal { animation: rise .35s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- v2 : icônes, bande de chiffres, mur auto ---- */
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic .fill { fill: currentColor; stroke: none; }
.btn .ic { width: 17px; height: 17px; stroke-width: 2.2; }
.icon-btn .ic { width: 19px; height: 19px; }
.icon-btn.spin .ic { animation: spin .8s linear infinite; }
.kband { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.k { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px 14px;
  border-radius: 12px; background: var(--panel); border: 1px solid var(--line); min-width: 0; transition: border-color .2s, transform .12s; }
.k .ic { grid-row: 1 / 3; width: 22px; height: 22px; color: var(--mute); }
.k b { font: 700 28px/1 var(--cond); letter-spacing: -.01em; }
.k span { font: 600 11px/1.2 var(--cond); letter-spacing: .09em; text-transform: uppercase; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k.live .ic { color: var(--tally); animation: blink 1.6s steps(1) infinite; }
.k.cue { cursor: pointer; } .k.cue .ic { color: var(--cue); } .k.cue:hover { border-color: var(--cue); } .k.cue:active { transform: scale(.98); }
.multiview[data-n="1"] { grid-template-columns: minmax(0, 1fr); }
.multiview[data-n="2"], .multiview[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.multiview[data-n="3"], .multiview[data-n="5"], .multiview[data-n="6"], .multiview[data-n="7"], .multiview[data-n="8"], .multiview[data-n="9"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.multiview[data-n="1"] .tile { aspect-ratio: 21 / 9; }
.meter-ic { display: flex; gap: 3px; margin-top: 4px; color: rgba(255,255,255,.75); }
.meter-ic .ic { width: 7px; height: 9px; stroke-width: 2.4; }
.tile .count { display: flex; align-items: center; gap: 4px; font: 700 24px/1 var(--cond); }
.tile .count .ic { width: 16px; height: 16px; color: var(--cue); }
.source { padding: 9px 12px; gap: 9px; }
.source .nm { font: 600 14px/1 var(--ui); text-align: left; }
.source.on { border-color: var(--line2); }
.tally.mini { height: 18px; padding: 0 6px; font-size: 10.5px; gap: 5px; }
.tally.mini::before { width: 5px; height: 5px; }
.events .ev { padding: 7px 12px; font-size: 13px; }
@media (max-width: 820px) {
  .kband { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .k { padding: 10px; column-gap: 8px; } .k b { font-size: 24px; } .k .ic { width: 18px; height: 18px; }
  .k:nth-child(2), .k:nth-child(5) { display: none; }
  .multiview, .multiview[data-n] { grid-template-columns: minmax(0, 1fr); }
  .multiview[data-n="1"] .tile { aspect-ratio: 16 / 9; }
  .sources { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- v3 : validation sans chiffres techniques ---- */
.scorebox { align-items: center; }
.worth { display: flex; align-items: baseline; gap: 2px; color: var(--cue); }
.worth b { font: 700 54px/1 var(--cond); }
.worth span { font: 700 18px/1 var(--cond); color: var(--mute); }
.force { display: flex; align-items: flex-end; gap: 4px; height: 46px; }
.force i { width: 9px; border-radius: 2px; background: var(--line2); }
.force i:nth-child(1) { height: 30%; } .force i:nth-child(2) { height: 47%; } .force i:nth-child(3) { height: 64%; }
.force i:nth-child(4) { height: 82%; } .force i:nth-child(5) { height: 100%; }
.force i.on { background: var(--cue); }
.sig { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 11px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); }
.sig .ic { width: 18px; height: 18px; }
.lv { display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.lv i { width: 4px; border-radius: 1px; background: var(--line2); }
.lv i:nth-child(1) { height: 40%; } .lv i:nth-child(2) { height: 70%; } .lv i:nth-child(3) { height: 100%; }
.lv i.on { background: var(--cue); }
.curve-axis { align-items: center; } .curve-axis .ic { width: 14px; height: 14px; color: var(--faint); }
.seg.lay button { height: 38px; padding: 0 14px; display: grid; place-items: center; }
.lay-ic { width: 13px; height: 20px; }
.lay-ic .o { fill: none; stroke: currentColor; stroke-width: 1.6; }
.lay-ic .f { fill: currentColor; } .lay-ic .f2 { fill: currentColor; opacity: .45; }
.actions { grid-template-columns: 52px 1fr; }
.actions .btn { height: 52px; border-radius: 13px; font-size: 16px; }
.actions #rej .ic { width: 22px; height: 22px; }
.qi .meta { display: flex; gap: 6px; align-items: center; }

/* ---- iPhone : vidéo plein cadre, décision au pouce, détail dans une feuille ---- */
.mbar { display: none; }
@media (max-width: 820px) {
  #v-valider .review { height: auto; grid-template-columns: minmax(0, 1fr); }
  #vd { min-width: 0; }
  .deck .inspector:not(.in-sheet) { display: none; }
  .inspector.in-sheet { display: flex; }
  .player { height: min(calc(100dvh - 158px - var(--sat) - var(--sab)), calc((100vw - 32px) * 16 / 9)); width: auto; max-width: 100%; max-height: none; align-self: center; }
  .mbar { display: grid; grid-template-columns: 60px minmax(0, 1fr) 60px; align-items: center; gap: 12px; }
  .round { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line2); background: var(--panel);
    transition: transform .12s var(--ease); }
  .round:active { transform: scale(.92); }
  .round .ic { width: 26px; height: 26px; stroke-width: 2.4; }
  .round.no { color: var(--tally); }
  .round.yes { background: var(--air); border-color: transparent; color: #04140A; }
  .mmid { display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; border-radius: 14px; min-width: 0; }
  .mmid b { font: 700 17px/1 var(--cond); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mmid .ic { width: 18px; height: 18px; color: var(--mute); }
  .deck { gap: 10px; }
}

/* ---- v4 : réglages en tuiles ---- */
.svc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.svc { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  transition: border-color .2s, transform .12s var(--ease); min-width: 0; }
.svc:hover { border-color: var(--line2); } .svc:active { transform: scale(.98); }
.svc.ok { border-color: color-mix(in srgb, var(--air) 45%, var(--line)); }
.svc.opt:not(.ok) { opacity: .72; }
.svc-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; font: 700 19px/1 var(--cond); flex: none; }
.svc-ic.big { width: 48px; height: 48px; font-size: 24px; border-radius: 12px; }
.svc-nm { display: block; font: 700 16px/1.1 var(--cond); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-sub { display: block; font: 500 12.5px/1.2 var(--ui); color: var(--mute); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .row > .ic { color: var(--mute); }
.toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tgl { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-align: left;
  font: 600 14.5px/1.2 var(--ui); transition: border-color .2s; }
.tgl span { flex: 1; min-width: 0; }
.tgl.on { border-color: var(--line2); }
.tgl .switch { flex: none; }
.lay-ic.big { width: 18px; height: 28px; color: var(--text); }
@media (max-width: 820px) {
  .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toggles { grid-template-columns: minmax(0, 1fr); }
  .svc { padding: 12px; gap: 10px; } .svc-ic { width: 34px; height: 34px; }
}

/* ---- v5 : découvrir ---- */
.field > .ic { color: var(--mute); }
.disco { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dc { display: flex; flex-direction: column; gap: 7px; text-align: left; min-width: 0; transition: transform .12s var(--ease), opacity .2s; }
.dc:active { transform: scale(.97); }
.dc-img { position: relative; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: var(--panel2); display: block; }
.dc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dc-v { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 5px;
  background: rgba(0,0,0,.65); color: #fff; font: 600 11.5px/1 var(--mono); }
.dc-v .ic { width: 8px; height: 8px; color: var(--tally); }
.dc-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dc-row b { flex: 1; min-width: 0; font: 600 13.5px/1.1 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-add { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--text); color: var(--bg); flex: none; transition: background .2s; }
.dc-add .ic { width: 15px; height: 15px; stroke-width: 2.4; }
.dc.on .dc-add { background: var(--air); color: #04140A; }
.dc.skel { aspect-ratio: 16 / 13; border-radius: 9px; background: var(--panel2); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
@media (max-width: 820px) { .disco { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 821px) { .sheet { width: min(640px, 100%); } }

/* ---- v6 : tuiles de connexion lisibles à 390 px ---- */
.svc .tally.off { display: none; }
@media (max-width: 820px) { .svc-nm { font-size: 15px; white-space: normal; line-height: 1.05; } .svc-sub { white-space: normal; } .svc .tally.mini { padding: 0 5px; } }

/* ---- v7 : demande à Kairos, notifications ---- */
.ask { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 5px 0 12px; border-radius: 12px; background: var(--panel);
  border: 1px solid var(--line2); transition: border-color .2s, box-shadow .2s; }
.ask:focus-within { border-color: var(--cue); box-shadow: 0 0 0 3px var(--cue-soft); }
.ask-ic .ic { width: 18px; height: 18px; color: var(--cue); }
.ask input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--text); font: 500 14.5px var(--ui); }
.ask input::placeholder { color: var(--faint); }
.ask-go { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--text); color: var(--bg); flex: none; }
.ask-go .ic { width: 17px; height: 17px; stroke-width: 2.4; }
.ask.busy { border-color: var(--cue); background: linear-gradient(90deg, var(--panel) 0%, var(--cue-soft) 50%, var(--panel) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.ask-go.busy .ic { display: none; }
.tgl > .ic { width: 22px; height: 22px; color: var(--mute); }
.tgl[disabled] { opacity: .5; }
.tgl.busy { pointer-events: none; opacity: .7; }

/* ---- v8 : notes horodatées façon Frame.io ---- */
.notes { display: flex; flex-direction: column; gap: 8px; }
.tcchip { flex: none; font: 600 12.5px/1 var(--mono); color: var(--bg); background: var(--cue); padding: 5px 7px; border-radius: 6px; }
.nlist { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; }
.nlist:empty { display: none; }
.ni { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 8px 7px 7px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); animation: rise .25s var(--ease) both; }
.ni-t { display: inline-flex; align-items: center; gap: 4px; font: 600 12.5px/1 var(--mono); color: var(--cue); padding: 5px 7px; border-radius: 6px; background: var(--cue-soft); }
.ni-t .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.ni-x { font: 500 14px/1.3 var(--ui); overflow-wrap: anywhere; }
.ni-del { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: var(--mute); }
.ni-del .ic { width: 15px; height: 15px; }
.ni.done { opacity: .55; } .ni.done .ni-t { color: var(--air); background: var(--air-soft); }
.notes.busy .ask { border-color: var(--cue); background: linear-gradient(90deg, var(--panel) 0%, var(--cue-soft) 50%, var(--panel) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
#apply .ic, #revert .ic { width: 16px; height: 16px; }
.player .prog { overflow: visible; }
#pmarks i { position: absolute; bottom: -2px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--cue); box-shadow: 0 0 0 2px rgba(0,0,0,.6); }
.pnote { position: absolute; right: 12px; bottom: 16px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(8px); z-index: 2; transition: transform .12s var(--ease); }
.pnote:active { transform: scale(.92); }
.pnote .ic { width: 22px; height: 22px; }
.curve .npin { position: absolute; bottom: 4px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--cue); box-shadow: 0 0 0 2px var(--panel); }
.vtag { height: 22px; }
