/* Wone — la régie connectée */
:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #1d1d1b; --muted: #6b6a66; --line: #e4e2dc;
  --brand: #e2572b; --brand-ink: #ffffff; --ok: #1f8a4c; --warn: #d98a00; --bad: #c8322b; --info: #2a62c9;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.hidden { display: none !important; }

/* Barre supérieure */
.topbar { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.25rem; background: var(--ink); color: #fff; }
.topbar a { color: #fff; }
.logo { font-weight: 800; letter-spacing: .02em; font-size: 1.15rem; display: flex; align-items: baseline; gap: .5rem; }
.logo b { color: var(--brand); }
.logo span { font-weight: 400; font-size: .8rem; opacity: .7; }
.topbar .spacer { flex: 1; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.25rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* Formulaires */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
input, select, textarea { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.field { margin-bottom: .7rem; }
.inline-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.check { display: flex; align-items: center; gap: .4rem; color: var(--ink); font-size: .9rem; }
.check input { width: auto; }

button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .5rem .85rem; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; }
button:hover, .btn:hover { background: #f1efea; text-decoration: none; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.primary:hover { filter: brightness(.95); }
button.danger { color: var(--bad); }
button.sm, .btn.sm { padding: .25rem .55rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: default; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td input, td select { padding: .3rem .45rem; }

/* Badges de statut */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eee; color: #444; white-space: nowrap; }
.badge.deposited { background: #e6efff; color: var(--info); }
.badge.validated { background: #e3f4ea; color: var(--ok); }
.badge.locked { background: #1d1d1b; color: #fff; }
.badge.rejected { background: #fbe6e5; color: var(--bad); }
.badge.to_convert, .badge.missing { background: #fff3dc; color: #9a6200; }
.badge.converting { background: #efe6ff; color: #6a3fc8; }
.badge.converted { background: #eee; color: #777; }
.badge.link { background: #e6f6f8; color: #0c7480; }
.badge.demo { background: #fdeaf3; color: #a0336b; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { border: none; background: none; border-bottom: 3px solid transparent; border-radius: 0; padding: .6rem .9rem; color: var(--muted); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--brand); }

.total { font-weight: 700; }
.total.ok { color: var(--ok); }
.total.over { color: var(--bad); }
.total.under { color: var(--warn); }

#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 1000; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.error { background: var(--bad); }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--brand); background: #fff6f2; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.progress > div { height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.qr { width: 132px; height: 132px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.linkbox { display: flex; gap: .4rem; }
.linkbox input { font-size: .82rem; }

/* ============ RÉGIE ============ */
body.regie { background: #121212; color: #eee; }
body.regie .card { background: #1c1c1c; border-color: #2c2c2c; box-shadow: none; }
body.regie .muted { color: #999; }
body.regie button, body.regie .btn { background: #262626; border-color: #333; color: #eee; }
body.regie button:hover { background: #303030; }
body.regie button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
body.regie button.on { background: #eee; color: #111; }
body.regie .check { color: #ddd; }
body.regie input, body.regie select { background: #262626; border-color: #333; color: #eee; }
.regie-grid { display: grid; grid-template-columns: 330px 1fr 300px; gap: 1rem; padding: 1rem; }
@media (max-width: 1100px) { .regie-grid { grid-template-columns: 1fr; } }
.seglist { list-style: none; margin: 0; padding: 0; }
.seglist li { padding: .5rem .6rem; border-radius: 8px; border: 1px solid #2c2c2c; margin-bottom: .4rem; cursor: pointer; }
.seglist li:hover { border-color: #555; }
.seglist li.current { border-color: var(--brand); background: #2a1c17; }
.seglist .t { float: right; font-family: ui-monospace, Menlo, monospace; color: #bbb; }
.sess-title { font-weight: 700; margin: .6rem 0 .3rem; }
.sess-title.current { color: var(--brand); }
.monitor { background: #000; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; position: relative; border: 2px solid #c8322b; }
.monitor .lbl { position: absolute; top: 6px; left: 8px; background: #c8322b; color: #fff; font-size: .7rem; font-weight: 700; padding: .1rem .4rem; border-radius: 4px; z-index: 3; }
.monitor iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
.bigtimer { font-family: ui-monospace, Menlo, monospace; font-size: 3.2rem; font-weight: 700; text-align: center; padding: .4rem; border-radius: 10px; }
.t-green { color: #3ddc84; }
.t-orange { color: #ffb020; }
.t-red { color: #ff4d4d; }
.t-over { color: #fff; background: #c8322b; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.btngrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.kbd { font-size: .75rem; opacity: .6; }

/* ============ ÉCRAN / RETOUR SCÈNE ============ */
body.screen { background: #000; color: #fff; overflow: hidden; height: 100vh; cursor: none; }
.stagearea { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.stagearea canvas, .stagearea img, .stagearea video { max-width: 100%; max-height: 100%; }
.titlecard { text-align: center; padding: 6vh 8vw; }
.titlecard .ev { font-size: 2.2vw; color: var(--brand); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.titlecard .ti { font-size: 4.2vw; font-weight: 800; margin: 2vh 0; line-height: 1.1; }
.titlecard .who { font-size: 2.4vw; opacity: .85; }
.titlecard .qrs { display: flex; justify-content: center; gap: 4vw; margin-top: 5vh; }
.titlecard .qrs img { width: 13vw; height: 13vw; background: #fff; padding: .6vw; border-radius: .6vw; }
.titlecard .qrs div { font-size: 1.2vw; opacity: .8; }
.pubtimer { z-index: 10; position: fixed; right: 2vw; bottom: 2vh; font-family: ui-monospace, Menlo, monospace; font-size: 5vw; font-weight: 800; background: rgba(0,0,0,.65); padding: .2vw 1.2vw; border-radius: 1vw; }
.fulltimer { font-family: ui-monospace, Menlo, monospace; font-size: 22vw; font-weight: 800; }
.netwarn { position: fixed; top: 8px; right: 8px; background: #c8322b; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; z-index: 50; }
.stage-grid { position: fixed; inset: 0; display: grid; grid-template-columns: 1.6fr 1fr; grid-template-rows: auto 1fr auto; gap: 1.5vh 1.5vw; padding: 2vh 2vw; }
.stage-grid .cur, .stage-grid .nxt { background: #111; border-radius: 1vw; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.stage-grid canvas, .stage-grid img { max-width: 100%; max-height: 100%; }
.stage-grid .cap { position: absolute; top: .6vh; left: .8vw; font-size: 1.3vw; opacity: .7; }
.stage-grid .head { grid-column: 1 / 3; display: flex; justify-content: space-between; align-items: center; font-size: 2vw; }
.stage-grid .foot { grid-column: 1 / 3; font-size: 3vw; text-align: center; min-height: 5vh; }
.stage-grid .clock { font-family: ui-monospace, Menlo, monospace; font-size: 8vw; font-weight: 800; text-align: center; }
.msg { background: #ffb020; color: #111; font-weight: 800; padding: .5vh 1vw; border-radius: .6vw; display: inline-block; }

/* ============ TÉLÉCOMMANDE (téléphone) ============ */
body.remote { background: #111; color: #eee; min-height: 100vh; }
.remote-wrap { max-width: 520px; margin: 0 auto; padding: 1rem; display: flex; flex-direction: column; gap: .8rem; min-height: 100vh; }
.remote-wrap input { background: #222; border-color: #333; color: #fff; font-size: 1.4rem; text-align: center; letter-spacing: .3em; }
.rtimer { font-family: ui-monospace, Menlo, monospace; font-size: 3.6rem; font-weight: 800; text-align: center; border-radius: 14px; padding: .3rem; background: #1b1b1b; }
.rprev { display: grid; grid-template-columns: 2fr 1fr; gap: .5rem; }
.rprev > div { background: #000; border-radius: 8px; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.rprev canvas, .rprev img { max-width: 100%; max-height: 100%; }
.rprev .cap { position: absolute; top: 2px; left: 6px; font-size: .7rem; opacity: .7; }
.rbtns { display: grid; grid-template-columns: 1fr 2fr; gap: .6rem; flex: 1; min-height: 34vh; }
.rbtns button { font-size: 1.6rem; border-radius: 16px; background: #262626; border: 1px solid #333; color: #fff; justify-content: center; }
.rbtns button.next { background: var(--brand); border-color: var(--brand); font-size: 2rem; }
.rbtns button:disabled { opacity: .3; }
.rstatus { text-align: center; padding: .5rem; border-radius: 10px; background: #1b1b1b; }
.rstatus.hand { background: #163a24; color: #9ff0bd; }

/* ============ SUIVI PUBLIC ============ */
body.follow { background: #0f0f0f; color: #eee; min-height: 100vh; }
.follow-wrap { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.follow-slide { background: #000; border-radius: 10px; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.follow-slide img { max-width: 100%; max-height: 100%; }
.follow-nav { display: flex; gap: .5rem; justify-content: center; align-items: center; margin: .8rem 0; }
.follow-nav button { background: #262626; border-color: #333; color: #eee; min-width: 3rem; justify-content: center; }
.follow-nav button.live { background: #c8322b; border-color: #c8322b; }
.livedot { display: inline-block; width: .6rem; height: .6rem; background: #c8322b; border-radius: 50%; margin-right: .35rem; animation: blink 1.2s infinite; }
.thumbs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; }
.thumbs img { height: 64px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; }
.thumbs img.sel { border-color: var(--brand); }

/* Page de connexion */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login { width: 100%; max-width: 380px; }

/* Partage d'écran, liens de démo, sous-titres */
.stagearea video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stagearea iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.captions { position: fixed; left: 5vw; right: 5vw; bottom: 3vh; text-align: center; font-size: 2.6vw; font-weight: 600; line-height: 1.25; color: #fff; background: rgba(0,0,0,.72); padding: .6vw 1.2vw; border-radius: .6vw; z-index: 20; }
.follow-caps { background: #1b1b1b; border-radius: 10px; padding: .6rem .8rem; margin-top: .6rem; font-size: 1.05rem; min-height: 2.6rem; }

/* Aperçus (régie, télécommande, retour scène) : une vidéo doit tenir dans son cadre, comme une image */
.rprev video, .stage-grid video, #mon video, #cur video, #nxt video { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; background: #000; }

.rguide { text-align: center; font-size: 1.05rem; padding: .2rem .4rem; color: #ddd; }
.rfiles { display: flex; flex-direction: column; gap: .5rem; }
.rfiles .rfile { display: flex; align-items: center; justify-content: space-between; gap: .6rem; background: #1b1b1b; border: 1px solid #333; border-radius: 12px; padding: .6rem .8rem; }
.rfiles .rfile.on { border-color: #2f9e5e; background: #163a24; }
.rfiles .rfile b { display: block; word-break: break-word; }
.rfiles .rfile button { background: var(--brand); border-color: var(--brand); color: #fff; font-size: 1.05rem; padding: .7rem 1rem; border-radius: 10px; white-space: nowrap; }
.rfiles .rfile.on button { background: #262626; border-color: #333; }

.rprev.big { grid-template-columns: 1fr; }
.rprev.big > div:last-child { display: none; }
.rprev.big > div:first-child { aspect-ratio: auto; height: 52vh; }
