/* ============================================================
   Interface : bibliothèque (clair) et présentateur (sombre)
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: #F6F7FB; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #DCDFEA; background: #fff; border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #B9BED3; background: #FAFBFD; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: #E45C2B; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn svg { width: 15px; height: 15px; fill: currentColor; }
.muted { color: var(--muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: #EEF0F6; color: var(--ink2); }
.tag.q { background: #FDEBE3; color: #B4461F; } .tag.i { background: #E2F4F1; color: #12776B; } .tag.c { background: #ECEBFF; color: #4F46C9; }
input[type=text], input[type=search] { border: 1px solid #DCDFEA; border-radius: 10px; padding: 9px 12px; background: #fff; outline: none; width: 100%; }
input[type=text]:focus, input[type=search]:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(26,158,143,.15); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 100; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------------- Bibliothèque ---------------- */
.lib { display: grid; grid-template-columns: 270px 1fr 380px; grid-template-rows: 64px 1fr; height: 100vh; }
.lib header { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 22px; background: var(--ink); color: #fff; }
.lib header .logo { display: flex; align-items: center; gap: 12px; font-weight: 750; font-size: 17px; }
.lib header .logo img { width: 30px; height: 30px; }
.lib header .logo small { font-weight: 500; color: var(--light); font-size: 13px; margin-left: 4px; }
.lib header nav { margin-left: auto; display: flex; gap: 6px; }
.lib header nav .btn { background: transparent; border-color: rgba(255,255,255,.18); color: #fff; }
.lib header nav .btn:hover { background: rgba(255,255,255,.08); }
.side { border-right: 1px solid #E6E8F0; background: #fff; overflow: auto; padding: 18px 14px 30px; }
.side h4 { margin: 18px 8px 8px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.side h4:first-child { margin-top: 0; }
.preset { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 10px; padding: 10px 10px; cursor: pointer; }
.preset:hover { background: #F2F3F8; }
.preset b { display: block; font-size: 14px; }
.preset span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.preset .row2 { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.preset .del { opacity: 0; font-size: 12px; color: var(--muted); border: 0; background: none; cursor: pointer; padding: 2px 6px; }
.preset:hover .del { opacity: 1; }
.side .empty { font-size: 13px; color: var(--muted); padding: 4px 10px; line-height: 1.45; }

.main { overflow: auto; padding: 22px 28px 60px; }
.toolbar { display: flex; gap: 12px; align-items: center; position: sticky; top: -22px; padding: 14px 0; margin-top: -14px; background: #F6F7FB; z-index: 5; }
.toolbar input { max-width: 360px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid #DCDFEA; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chsec { margin-top: 26px; }
.chsec h2 { display: flex; align-items: center; gap: 12px; font-size: 18px; margin: 0 0 14px; }
.chsec h2 .n { color: var(--orange); font-weight: 800; }
.chsec h2 .btn { margin-left: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.sc { background: #fff; border: 2px solid transparent; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 2px rgba(24,27,63,.06), 0 4px 14px rgba(24,27,63,.05); cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.sc:hover { transform: translateY(-2px); }
.sc.sel { border-color: var(--teal); }
.sc .th { aspect-ratio: 16 / 9; background: #EEF0F6; }
.sc .meta { padding: 10px 12px 12px; display: flex; gap: 10px; align-items: flex-start; }
.sc .meta .tt { font-size: 13.5px; font-weight: 650; line-height: 1.3; flex: 1; }
.sc .meta .d { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sc .add { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.95); box-shadow: 0 2px 8px rgba(0,0,0,.18); cursor: pointer; font-size: 20px; font-weight: 700; color: var(--ink); display: flex; align-items: center; justify-content: center; }
.sc.sel .add { background: var(--teal); color: #fff; }
.sc .pos { position: absolute; top: 10px; left: 10px; background: var(--teal); color: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; display: none; }
.sc.sel .pos { display: block; }

.prog { border-left: 1px solid #E6E8F0; background: #fff; display: flex; flex-direction: column; min-height: 0; }
.prog .top { padding: 18px 18px 12px; border-bottom: 1px solid #EEF0F6; }
.prog .top label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.prog .top input { margin-top: 8px; font-weight: 650; }
.prog .sum { display: flex; justify-content: space-between; margin-top: 12px; font-size: 14px; }
.prog .sum b { font-size: 20px; }
.plist { flex: 1; overflow: auto; padding: 8px 10px; margin: 0; list-style: none; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: #fff; }
.plist li:hover { background: #F4F5F9; }
.plist li.drag { opacity: .4; }
.plist li.over { box-shadow: inset 0 3px 0 var(--teal); }
.plist .grip { cursor: grab; color: #A3A8BF; font-size: 16px; user-select: none; padding: 0 2px; }
.plist .mini { width: 84px; height: 47.25px; border-radius: 6px; overflow: hidden; flex: none; background: #EEF0F6; }
.plist .tt { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.3; min-width: 0; }
.plist .tt small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }
.plist .x { border: 0; background: none; color: #A3A8BF; cursor: pointer; font-size: 18px; padding: 4px 6px; border-radius: 6px; }
.plist .x:hover { color: var(--orange); background: #FDEBE3; }
.plist .nm { font-size: 12px; color: var(--muted); width: 20px; text-align: right; font-variant-numeric: tabular-nums; }
.prog .empty { padding: 30px 22px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.prog .actions { padding: 14px 18px 18px; border-top: 1px solid #EEF0F6; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prog .actions .primary { grid-column: 1 / -1; justify-content: center; padding: 13px; font-size: 15px; }

/* aperçu */
.modal { position: fixed; inset: 0; background: rgba(15,17,48,.72); display: none; align-items: center; justify-content: center; z-index: 40; padding: 30px; }
.modal.on { display: flex; }
.modal .box { background: #fff; border-radius: 18px; width: min(1500px, 100%); max-height: 100%; display: grid; grid-template-columns: 1fr 420px; overflow: hidden; }
.modal .pv { aspect-ratio: 16 / 9; background: #000; }
.modal .nt { padding: 22px 24px; overflow: auto; max-height: calc((min(1500px, 100vw - 60px) - 420px) * 9 / 16); }
.modal .nt h3 { margin: 0 0 6px; font-size: 18px; }
.modal .bar { grid-column: 1 / -1; display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #EEF0F6; align-items: center; }
.notes p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }
.notes .take { background: #FDEBE3; border-radius: 10px; padding: 10px 14px; font-weight: 650; margin-bottom: 14px; }
.notes b.nl { color: var(--teal); font-size: .86em; letter-spacing: .04em; }

/* ---------------- Présentateur ---------------- */
body.pres { background: #0F1130; color: #E8E9F3; overflow: hidden; }
.pres .btn { background: #1E2148; border-color: #2E3263; color: #E8E9F3; }
.pres .btn:hover { background: #262A58; border-color: #3B4078; }
.pres .btn.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.pres .btn.primary { background: var(--orange); border-color: var(--orange); }
.pv-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(360px, 1fr); grid-template-rows: 58px minmax(0, 1fr) 132px; height: 100vh; gap: 14px; padding: 0 16px 14px; }
.ptop { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #23264F; margin: 0 -16px; padding: 0 16px; }
.ptop .name { font-weight: 700; font-size: 15px; max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptop .count { font-variant-numeric: tabular-nums; color: #A9ADCB; font-size: 14px; }
.ptop .sp { flex: 1; }
.clock { display: flex; align-items: center; gap: 14px; font-variant-numeric: tabular-nums; }
.clock .timer { font-size: 26px; font-weight: 750; letter-spacing: -.01em; min-width: 92px; text-align: right; }
.clock .pace { font-size: 12.5px; padding: 4px 9px; border-radius: 999px; background: #1E2148; color: #A9ADCB; }
.clock .pace.ahead { color: #7DE0D3; } .clock .pace.late { color: #FFB199; }
.clock .now { color: #A9ADCB; font-size: 14px; }
.pcur { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.pcur .stage { flex: 1; border-radius: 12px; background: #000; outline: 3px solid var(--orange); outline-offset: 0; }
.pcur .stage.off { outline-color: var(--amber); }
.pcur .ctl { display: flex; gap: 10px; align-items: center; }
.pcur .ctl .big { flex: 1; justify-content: center; padding: 12px; font-size: 15px; }
.pcur .ctl .flag { font-size: 13px; color: var(--amber); }
.pside { display: flex; flex-direction: column; min-height: 0; gap: 12px; }
.pside .lbl { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: #8A8FB4; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.pnext { aspect-ratio: 16 / 9; border-radius: 10px; background: #000; opacity: .92; }
.pnext.end { display: flex; align-items: center; justify-content: center; color: #8A8FB4; font-size: 14px; }
.pnotes { flex: 1; min-height: 0; overflow: auto; background: #161944; border-radius: 12px; padding: 16px 18px; }
.pnotes.notes p { color: #E8E9F3; font-size: var(--nsize, 17px); }
.pnotes.notes .take { background: rgba(242,107,58,.16); color: #FFD7C7; }
.pnotes.notes b.nl { color: #6FD3C6; }
.pnotes .dur { font-size: 12.5px; color: #8A8FB4; margin-bottom: 10px; }
.strip { grid-column: 1 / -1; display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 4px; scrollbar-width: thin; }
.strip .it { flex: none; width: 176px; cursor: pointer; }
.strip .it .th { width: 176px; height: 99px; border-radius: 8px; overflow: hidden; background: #000; outline: 2px solid transparent; outline-offset: 1px; }
.strip .it.cur .th { outline-color: var(--orange); }
.strip .it .cap { font-size: 11.5px; color: #8A8FB4; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .it.cur .cap { color: #fff; }
.strip .it.done .th { opacity: .55; }

.drawer { position: fixed; inset: 0; background: rgba(8,9,30,.86); backdrop-filter: blur(4px); z-index: 30; display: none; flex-direction: column; padding: 22px 28px; }
.drawer.on { display: flex; }
.drawer .dh { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.drawer .dh h3 { margin: 0; font-size: 18px; }
.drawer .dh input { max-width: 360px; background: #161944; border-color: #2E3263; color: #fff; }
.drawer .dgrid { overflow: auto; flex: 1; }
.drawer .dgrid h4 { margin: 18px 0 10px; color: #A9ADCB; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.drawer .dcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.drawer .dc { background: #161944; border-radius: 12px; overflow: hidden; }
.drawer .dc .th { aspect-ratio: 16 / 9; background: #000; }
.drawer .dc .tt { font-size: 13px; font-weight: 600; padding: 8px 10px 4px; line-height: 1.3; min-height: 42px; }
.drawer .dc .bb { display: flex; gap: 6px; padding: 4px 10px 10px; }
.drawer .dc .bb .btn { flex: 1; justify-content: center; }
.drawer .dc.inprog .tt::after { content: " · au programme"; color: #6FD3C6; font-weight: 500; }

.help { position: fixed; inset: 0; z-index: 35; background: rgba(8,9,30,.8); display: none; align-items: center; justify-content: center; }
.help.on { display: flex; }
.help .hb { background: #161944; border-radius: 16px; padding: 26px 30px; width: 520px; }
.help h3 { margin: 0 0 14px; }
.help table { width: 100%; font-size: 14px; border-collapse: collapse; }
.help td { padding: 7px 0; border-bottom: 1px solid #23264F; }
.help td:first-child { width: 190px; }
.help kbd { background: #262A58; border-radius: 6px; padding: 2px 7px; font-family: inherit; font-size: 12.5px; margin-right: 3px; }

/* ---------------- Sources ---------------- */
.doc { max-width: 980px; margin: 0 auto; padding: 40px 28px 80px; }
.doc h1 { font-size: 34px; margin: 0 0 6px; }
.doc .bib { margin-top: 28px; }
.doc .bib h2 { font-size: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 34px 0 12px; }
.doc .ref { background: #fff; border-radius: 12px; padding: 16px 18px; margin-bottom: 10px; display: flex; gap: 16px; box-shadow: 0 1px 2px rgba(24,27,63,.05); }
.doc .ref p { margin: 0; flex: 1; font-size: 14.5px; line-height: 1.5; }
.doc .ref .used { font-size: 12.5px; color: var(--muted); max-width: 260px; text-align: right; }
.doc .ref .used a { color: var(--teal); text-decoration: none; }
