@font-face { font-family: Libron; src: url('/ui/fonts/Libron-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Libron; src: url('/ui/fonts/Libron-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: Libron; src: url('/ui/fonts/Libron-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: Libron; src: url('/ui/fonts/Libron-BoldItalic.woff2') format('woff2'); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  --paper: #faf8f4; --card: #ffffff; --ink: #1c1b19; --muted: #625e56; --line: #e4dfd5; --line-strong: #cdc6b6;
  --accent: #1f4fd8; --accent-ink: #ffffff; --accent-soft: #e8eefc; --ok: #1d7a46; --warn: #8a4f00; --danger: #b3261e;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05); --shadow-lg: 0 10px 40px rgba(0,0,0,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Libron, Georgia, serif; background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.45; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 700; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex: none; vertical-align: -3px; }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); padding: 7px 13px; border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; min-height: 36px; }
.btn:hover { border-color: var(--line-strong); background: #fffdf9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #1a43b8; }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { padding: 3px 9px; font-size: 14px; min-height: 28px; }
.btn.icon-only { padding: 7px 9px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* connexion */
.center-page { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card form { display: grid; gap: 12px; margin-top: 20px; }
.login-card input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.error { color: var(--danger); min-height: 1.4em; font-size: 14px; }

/* barre du haut */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.topbar h1 { font-size: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #fff; }

/* tableau de bord */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search { position: relative; flex: 1 1 220px; max-width: 420px; }
.search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.search .ico { position: absolute; left: 11px; top: 10px; color: var(--muted); }
select.btn { padding-right: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 3px 12px; font-size: 14px; cursor: pointer; }
.chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: #fff; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.deck-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.thumb { border-radius: 10px 10px 0 0; position: relative; aspect-ratio: 16 / 9; background: #e9e5da; overflow: hidden; display: block; border-bottom: 1px solid var(--line); }
.thumb iframe { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }
.thumb a { position: absolute; inset: 0; }
.deck-body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.deck-body h2 { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.deck-meta { font-size: 13px; color: var(--muted); }
.deck-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: #1a43b8; margin-left: 6px; vertical-align: 2px; }
.badge.ok { background: #e3f4ea; color: var(--ok); }
.tag { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); margin-right: 4px; }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 28px; color: var(--muted); background: #fffdf8; text-align: center; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 14px 18px; color: var(--muted); background: #fffdf8; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

/* fenêtres */
.modal-back { position: fixed; inset: 0; background: rgba(20,18,14,.45); z-index: 50; display: grid; place-items: start center; padding: 6vh 16px; overflow: auto; }
.modal { background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 720px; padding: 22px; display: grid; gap: 14px; }
.modal.wide { max-width: 980px; }
.modal h2 { font-size: 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 14px; color: var(--muted); }
.field input[type=text] { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.choice { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 10px; text-align: left; cursor: pointer; display: grid; gap: 6px; }
.choice:hover { border-color: var(--line-strong); }
.choice[aria-pressed=true], .choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice strong { font-size: 15px; }
.choice small { color: var(--muted); font-size: 13px; line-height: 1.3; }
.swatches { display: flex; height: 30px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.swatches i { flex: 1; }
.swatches i:first-child { flex: 3; }
.wire { width: 100%; aspect-ratio: 16 / 9; background: #f4f1e8; border-radius: 6px; border: 1px solid var(--line); }
.report-list { margin: 0; padding-left: 18px; max-height: 40vh; overflow: auto; }
.report-list li { margin: 4px 0; }
.report-list .warn { color: var(--warn); }

textarea.plan-text { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }

/* éditeur */
.editor { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.editor .topbar { padding: 8px 14px; gap: 10px; }
.editor .topbar .left, .editor .topbar .right { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.title-btn { font-weight: 700; font-size: 17px; border: 1px solid transparent; background: transparent; padding: 4px 8px; border-radius: 8px; cursor: text; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-btn:hover { border-color: var(--line); }
.title-input { font-weight: 700; font-size: 17px; padding: 4px 8px; border: 1px solid var(--accent); border-radius: 8px; width: 28vw; }
.sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.status { font-size: 13px; color: var(--muted); min-width: 110px; text-align: right; }
.status.err { color: var(--danger); }
.panes { display: grid; grid-template-columns: 230px 1fr 300px; min-height: 0; }
.slides-pane, .notes-pane { background: var(--card); overflow: auto; padding: 10px; }
.slides-pane { border-right: 1px solid var(--line); }
.notes-pane { border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.slide-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; background: #fff; display: grid; grid-template-columns: 24px 1fr; gap: 6px; position: relative; }
.slide-item .n { color: var(--muted); font-size: 13px; padding-top: 2px; }
.slide-item .t { font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.slide-item .l { grid-column: 2; font-size: 12px; color: var(--muted); }
.slide-item.active { border-color: var(--accent); background: var(--accent-soft); }
.slide-item.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.slide-item .acts { position: absolute; right: 4px; top: 4px; display: none; gap: 2px; }
.slide-item:hover .acts, .slide-item:focus-within .acts { display: flex; }
.acts button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 2px 5px; cursor: pointer; line-height: 1; }
.add-slide { width: 100%; justify-content: center; margin-top: 2px; }
.stage-pane { background: #2a2925; display: grid; place-items: center; min-width: 0; min-height: 0; padding: 12px; }
.stage-pane iframe { width: 100%; height: 100%; border: 0; background: #000; border-radius: 6px; }
.notes-pane h3 { font-size: 15px; }
.notes-pane textarea { flex: 1; min-height: 160px; resize: none; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; }
.hint { font-size: 13px; color: var(--muted); }
.hint kbd, .kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; font-family: inherit; font-size: 12px; background: #fff; }

/* panneaux flottants */
.panel { position: fixed; right: 16px; top: 56px; width: 400px; max-width: calc(100vw - 24px); max-height: 82vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--shadow-lg); z-index: 20; display: grid; gap: 12px; }
.panel.wide { width: 560px; }
.panel h3 { font-size: 17px; }
.panel input[type=text] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; }
.qr { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
.hist-item { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #222; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 14px; z-index: 80; max-width: 90vw; }

/* menus déroulants */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 330px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 30; overflow: hidden; }
.menu a, .menu button.mi { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 11px 16px; color: var(--ink); text-decoration: none; cursor: pointer; }
.menu a + a, .menu button.mi + button.mi, .menu a + button.mi, .menu button.mi + a { border-top: 1px solid var(--line); }
.menu a:hover, .menu button.mi:hover { background: var(--accent-soft); }
.menu small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* palette de commandes */
.palette { padding: 0; max-width: 620px; overflow: hidden; gap: 0; }
.palette input { border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; font-size: 18px; outline: none; width: 100%; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette li { padding: 9px 12px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.palette li[aria-selected=true] { background: var(--accent-soft); }
.palette li small { color: var(--muted); }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; align-items: center; }

@media (max-width: 1000px) {
  .panes { grid-template-columns: 180px 1fr; grid-template-rows: 1fr auto; }
  .notes-pane { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); max-height: 170px; }
  .notes-pane textarea { min-height: 60px; }
  .notes-pane .hint { display: none; }
  .btn .lbl { display: none; }
  .title-btn { max-width: 40vw; }
}
@media (max-width: 700px) {
  .topbar { padding: 10px 14px; }
  .wrap { padding: 14px; }
  .panes { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .slides-pane { display: flex; gap: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .slide-item { min-width: 120px; margin-bottom: 0; }
  .add-slide { width: auto; min-width: 44px; }
  .deck-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .panel { left: 8px; right: 8px; width: auto; top: 52px; }
  .menu { min-width: 260px; }
  .status { display: none; }
}
@media (max-width: 460px) { .deck-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
