/* =========================================================
 *  iGlace — thème sombre haut contraste
 * ========================================================= */
:root {
  --bg: #0a0c10;
  --panel: #12161e;
  --panel2: #191e29;
  --panel3: #222938;
  --line: #2a3243;
  --line2: #3a4458;
  --txt: #eef2f8;
  --muted: #8f9ab0;
  --acc: #38bdf8;
  --acc2: #0ea5e9;
  --red: #ff2d2d;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --top: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: pan-x pan-y; }
body {
  margin: 0; background: var(--bg); color: var(--txt); font: 14px/1.45 var(--font);
  min-height: 100vh; padding-bottom: env(safe-area-inset-bottom);
  overflow-x: clip; max-width: 100%;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
.muted { color: var(--muted); }
small { color: var(--muted); }
[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }

/* ---------------- barre du haut ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 60; height: calc(var(--top) + env(safe-area-inset-top)); flex: none;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: rgba(10, 12, 16, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--txt); white-space: nowrap; min-width: 0; flex-shrink: 1; overflow: hidden; }
.brand svg { flex: none; }
.brand span { min-width: 0; overflow: hidden; }
.brand small { overflow: hidden; text-overflow: ellipsis; }
.topbar { max-width: 100vw; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.mainnav { flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-size: 16px; letter-spacing: .3px; }
.brand small { font-size: 11px; }
.mainnav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.mainnav a {
  color: var(--muted); padding: 8px 11px; border-radius: 8px; font-weight: 600; font-size: 13.5px; white-space: nowrap;
}
.mainnav a:hover { color: var(--txt); background: var(--panel2); text-decoration: none; }
.mainnav a.on { color: #fff; background: var(--panel3); box-shadow: inset 0 -2px 0 var(--acc); }
.mainnav .navsep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.mainnav .logout { color: #fca5a5; }
.mainnav .ghostlink { border: 1px solid var(--line2); }
.navtoggle { display: none; margin-left: auto; background: none; border: 0; padding: 10px; cursor: pointer; }
.navtoggle span { display: block; width: 22px; height: 2px; background: var(--txt); margin: 4px 0; border-radius: 2px; }

@media (max-width: 980px) {
  .navtoggle { display: block; }
  .mainnav:not(.pub) {
    display: none; position: fixed; top: calc(var(--top) + env(safe-area-inset-top)); left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px; gap: 2px; max-height: calc(100vh - var(--top)); overflow: auto;
  }
  .navopen .mainnav { display: flex; }
  .mainnav a { padding: 13px 14px; font-size: 15px; }
  .mainnav .navsep { width: auto; height: 1px; margin: 6px 0; }
}

/* ---------------- boutons / formulaires ---------------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--txt); font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap;
  touch-action: manipulation; text-decoration: none;
}
.btn:hover { background: var(--panel3); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.icon { width: 38px; padding: 0; font-size: 22px; line-height: 1; }
.btn.primary { background: var(--acc2); border-color: var(--acc2); color: #001018; }
.btn.primary:hover { background: var(--acc); }
.btn.danger { background: #3a1214; border-color: #7f1d1d; color: #fecaca; }
.btn.danger:hover { background: #561a1d; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number],
input:not([type]), select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line2);
  background: #0d1118; color: var(--txt); font: 16px var(--font); outline: none;
  color-scheme: dark;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(56, 189, 248, .2); }
input[type=color] { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--line2); border-radius: 8px; background: #0d1118; }
label, .fld { display: block; font-weight: 600; font-size: 13px; color: #cdd5e3; margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; }
label small { font-weight: 400; }
.chk { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; cursor: pointer; }
.chk input { width: 19px; height: 19px; margin: 1px 0 0; accent-color: var(--acc2); flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr; } }

.alert { padding: 11px 14px; border-radius: 9px; margin-bottom: 14px; font-weight: 600; border: 1px solid; }
.alert.ok { background: #0b2a17; border-color: #166534; color: #bbf7d0; }
.alert.err { background: #2c0f11; border-color: #7f1d1d; color: #fecaca; }
.alert.info { background: #0b2030; border-color: #0c4a6e; color: #bae6fd; }

/* ---------------- pages génériques ---------------- */
.page { max-width: 1200px; margin: 0 auto; padding: 22px 16px 60px; }
.page.narrow { max-width: 760px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead h1 { margin: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel h2 { display: flex; align-items: center; gap: 8px; }
.tblwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 9px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: rgba(255, 255, 255, .02); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--panel3); color: var(--txt); white-space: nowrap; }
.badge.green { background: #0b2a17; color: #86efac; }
.badge.red { background: #2c0f11; color: #fca5a5; }
.badge.blue { background: #0b2030; color: #7dd3fc; }
.badge.amber { background: #2c1d05; color: #fcd34d; }
.badge.gray { background: #1f2430; color: #aab3c5; }
.sw { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: -3px; margin-right: 7px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }
.actpill { display: inline-block; padding: 3px 9px; border-radius: 5px; font-weight: 800; font-size: 12px; text-transform: uppercase; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters label { margin: 0; min-width: 140px; flex: 1 1 140px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------------- planning : barre d'outils ---------------- */
.planning { padding: 12px 14px 40px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tb-group { display: flex; gap: 6px; align-items: center; }
.tb-group.right { margin-left: auto; }
.tb-title { display: flex; flex-direction: column; line-height: 1.15; padding: 0 6px; }
.tb-title b { font-size: 16px; }
.tb-title span { color: var(--muted); font-size: 12.5px; }
.datepick { position: relative; margin: 0; width: 38px; height: 38px; border: 1px solid var(--line2); border-radius: 9px; background: var(--panel2); display: grid; place-items: center; cursor: pointer; }
.datepick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; min-height: 0; padding: 0; }
.datepick span { pointer-events: none; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.seg button { min-height: 36px; padding: 0 13px; background: var(--panel2); color: var(--muted); border: 0; font: 600 13px var(--font); cursor: pointer; }
.seg button.on { background: var(--acc2); color: #001018; }
.dropdown { position: relative; }
.dd-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; z-index: 40;
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 6px; box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
}
.dropdown.open .dd-menu { display: block; }
.dd-menu a { display: block; padding: 10px 12px; border-radius: 7px; color: var(--txt); cursor: pointer; font-weight: 500; }
.dd-menu a:hover { background: var(--panel3); text-decoration: none; }
.dd-menu a.danger { color: #fca5a5; }
.hint { position: relative; background: #0b2030; border: 1px solid #0c4a6e; color: #bae6fd; border-radius: 9px; padding: 8px 36px 8px 12px; font-size: 12.5px; margin-bottom: 10px; }
.hint .x { position: absolute; right: 6px; top: 4px; background: none; border: 0; color: #bae6fd; font-size: 20px; cursor: pointer; }
.touch-only { display: none; }
body.touch .touch-only { display: inline; }

@media (max-width: 820px) {
  .planning { padding: 10px 8px 40px; }
  .tb-title { order: -1; width: 100%; flex-direction: row; gap: 8px; align-items: baseline; padding: 0 2px; }
  .tb-group.right { margin-left: auto; }
  .tb-group.right .dropdown .btn { padding: 0 10px; }
  .hint { display: none; }
}

#app { position: relative; min-height: 200px; }
.app-loading { display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line2); border-top-color: var(--acc); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- planning : vue semaine ---------------- */
.wk-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.wk { --dw: 92px; --rw: 74px; --nw: 150px; min-width: 1320px; padding: 6px 6px 10px; }
.wk-sec + .wk-sec { margin-top: 18px; }
.wk-head { display: grid; grid-template-columns: calc(var(--dw) + var(--rw)) 1fr var(--nw); align-items: stretch; margin-bottom: 4px; }
.wk-secname { background: #000; color: #fff; font-weight: 900; letter-spacing: .5px; display: grid; place-items: center; border: 1px solid #444; border-radius: 6px 0 0 6px; font-size: 13px; }
.wk-scale { display: grid; grid-template-columns: repeat(var(--nh), 1fr); border: 1px solid var(--line2); border-left: 0; }
.hcell { border-left: 1px solid var(--line2); text-align: center; }
.hcell.odd { background: #1b2130; }
.hcell .hl { font-size: 11px; font-weight: 700; padding: 2px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.hcell .ql { display: grid; grid-template-columns: repeat(4, 1fr); font-size: 8.5px; color: var(--muted); }
.wk-notehead { display: grid; place-items: center; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.wk-day { display: grid; grid-template-columns: var(--dw) 1fr var(--nw); margin-top: 5px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #0e1219; }
.wk-day.today { border-color: rgba(255, 45, 45, .7); box-shadow: 0 0 0 1px rgba(255, 45, 45, .35); }
.wk-dlabel { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--panel2); border-right: 1px solid var(--line); text-align: center; line-height: 1.15; padding: 2px; }
.wk-dlabel b { font-size: 12.5px; }
.wk-dlabel span { font-size: 11.5px; color: var(--muted); }
.wk-day.today .wk-dlabel { background: #3a0d10; }
.wk-day.today .wk-dlabel b, .wk-day.today .wk-dlabel span { color: #fff; }
.wk-rows { display: flex; flex-direction: column; min-width: 0; }
.wk-row { display: grid; grid-template-columns: var(--rw) 1fr; height: 44px; }
.wk-row + .wk-row { border-top: 1px solid var(--line); }
.wk-rlabel { display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: #b7c1d4; background: #141924; border-right: 1px solid var(--line); text-transform: none; }
.wk-day.single .wk-rlabel { background: var(--panel2); }
.wk-note { border-left: 1px solid var(--line); padding: 4px 8px; font-size: 12px; display: flex; align-items: center; overflow: hidden; color: var(--muted); }
.wk-note.has { background: #0070C0; color: #fff; font-weight: 700; line-height: 1.2; }
.wk-note.editable { cursor: pointer; }
.wk-note.editable:hover { box-shadow: inset 0 0 0 2px var(--acc); }
.wk-note i { font-style: normal; opacity: .55; font-size: 11px; }

/* pistes */
.track {
  position: relative; touch-action: pan-x pan-y;
  background-color: #0d1118;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, .13) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: calc(100% / var(--nh)) 100%, calc(100% / var(--nh) / 4) 100%;
}
.is-editor .track { cursor: crosshair; }
.track.v {
  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, .13) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 100% var(--hpx), 100% calc(var(--hpx) / 4);
}

/* créneaux */
.slot {
  position: absolute; top: 2px; bottom: 2px; z-index: 2;
  background: var(--sbg); color: var(--sfg); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .4);
  container-type: inline-size; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  cursor: pointer;
}
.slot .in { display: flex; flex-direction: column; padding: 0 2px; max-width: 100%; min-width: 0; line-height: 1.08; pointer-events: none; }
.slot b { font-size: 10px; font-weight: 800; text-transform: uppercase; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.slot span { font-size: 9px; font-weight: 700; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.2px; }
@container (max-width: 52px) { .slot .in span { display: none; } .slot b { font-size: 9px; } }
.slot.surf { background: #000; color: #fff; box-shadow: inset 0 0 0 1px #5b6478; }
.slot.surf b { font-size: 11px; }
.slot.has-note::after { content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.slot:hover { filter: brightness(1.1); z-index: 3; }
.is-editor .slot { cursor: grab; }
.hd { position: absolute; top: 0; bottom: 0; width: 10px; max-width: 28%; cursor: ew-resize; z-index: 4; }
.hd.hs { left: 0; }
.hd.he { right: 0; }
.slot:hover .hd { background: rgba(255, 255, 255, .28); }
.slot:hover .hd::after { content: ""; position: absolute; top: 28%; bottom: 28%; left: 50%; width: 3px; margin-left: -1.5px; border-left: 1px solid currentColor; border-right: 1px solid currentColor; opacity: .8; }
.slot.resizing .hd { background: rgba(255, 255, 255, .4); }
@media not all and (any-pointer: fine) { .hd { display: none; } }
.track.v .slot { top: auto; bottom: auto; left: 3px; right: 3px; }
.track.v .slot:not(.surf) { align-items: flex-start; }
.track.v .slot .in { white-space: normal; padding: 3px 3px 1px; }
.track.v .slot.short .in { padding-top: 1px; }
.track.v .slot.short .in span { display: none; }
.track.v .slot.short b { -webkit-line-clamp: 1; }
.track.v .slot b { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }
.track.v .hd { left: 0; right: 0; width: auto; max-width: none; height: 9px; max-height: 28%; cursor: ns-resize; }
.track.v .slot:hover .hd::after { top: 50%; bottom: auto; left: 30%; right: 30%; width: auto; height: 3px; margin: -1.5px 0 0; border: 0; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; }
.track.v .hd.hs { top: 0; bottom: auto; }
.track.v .hd.he { bottom: 0; top: auto; }
.slot.drag-src { opacity: .28; }
.slot.ghost { z-index: 20; opacity: .92; outline: 2px dashed #fff; outline-offset: -2px; pointer-events: none; box-shadow: 0 6px 22px rgba(0, 0, 0, .6); }
.slot.ghost.create { background: rgba(56, 189, 248, .4); color: #fff; }
.slot.ghost.bad { outline-color: var(--red); background-image: repeating-linear-gradient(45deg, rgba(255, 0, 0, .45) 0 6px, transparent 6px 12px); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

/* curseur heure actuelle */
.nowline { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--red); z-index: 10; pointer-events: none; box-shadow: 0 0 8px rgba(255, 45, 45, .9); }
.nowline::before { content: ""; position: absolute; top: -1px; left: -4px; border: 5px solid transparent; border-top-color: var(--red); }
.track.v .nowline { top: auto; bottom: auto; left: -2px; right: -2px; width: auto; height: 2px; margin: -1px 0 0; }
.track.v .nowline::before { display: none; }
.dv-col:nth-child(2) .track.v .nowline::after {
  content: attr(data-t); position: absolute; left: 2px; top: -10px; background: var(--red); color: #fff;
  font: 700 10px var(--font); padding: 1px 5px; border-radius: 4px;
}

/* légende */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12px; color: #c4cddc; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }

/* ---------------- planning : vue jour (mobile) ---------------- */
.dv-tabs { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 8px; }
.dtab { position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--muted); cursor: pointer; font-family: var(--font); touch-action: manipulation; }
.dtab small { font-size: 11px; color: inherit; }
.dtab b { font-size: 17px; color: var(--txt); }
.dtab.on { background: var(--acc2); border-color: var(--acc2); color: #001018; }
.dtab.on b { color: #001018; }
.dtab.today::after { content: ""; position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.dv-secs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 6px; }
.chip { flex: none; min-height: 32px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel2); color: var(--muted); font: 700 12.5px var(--font); cursor: pointer; }
.chip.on { background: #fff; color: #000; border-color: #fff; }
.dv-date { font-size: 15px; text-transform: capitalize; margin: 4px 2px 8px; }
.dv-note { background: #0070C0; color: #fff; font-weight: 700; padding: 8px 12px; border-radius: 9px; margin-bottom: 8px; font-size: 13px; }
.dv-note:not(.has) { background: transparent; border: 1px dashed var(--line2); color: var(--muted); font-weight: 500; }
.dv-note i { font-style: normal; }
.dv-note.editable { cursor: pointer; }
.dv-scroll { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.dv { display: grid; grid-template-columns: 42px repeat(var(--cols), minmax(72px, 1fr)); }
.dv-head {
  position: sticky; top: calc(var(--top) + env(safe-area-inset-top)); z-index: 15; height: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000; color: #fff; font-weight: 800; font-size: 12px; text-align: center; line-height: 1.1; border-bottom: 1px solid var(--line2); border-left: 1px solid #222; padding: 0 2px;
  overflow: hidden; overflow-wrap: anywhere;
}
@media (max-width: 480px) { .dv-head { font-size: 10.5px; } }
.dv-head small { color: #9aa4b8; font-size: 9.5px; font-weight: 700; }
.dv-col { min-width: 0; border-left: 1px solid var(--line); }
.dv-hours { position: relative; }
.dv-hours span { position: absolute; right: 5px; transform: translateY(-50%); font-size: 10.5px; color: var(--muted); font-weight: 700; }
.dv-hours span:first-child { transform: none; }
@media (max-width: 420px) { .dv { grid-template-columns: 36px repeat(var(--cols), minmax(66px, 1fr)); } .track.v .slot b { font-size: 10px; } }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 200;
  background: var(--panel3); border: 1px solid var(--line2); color: var(--txt); padding: 11px 18px; border-radius: 10px; font-weight: 600; max-width: min(92vw, 560px);
  transition: .25s; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: #166534; }
.toast.err { border-color: #b91c1c; background: #2c0f11; color: #fecaca; }
.toast.info { border-color: #0c4a6e; }

/* ---------------- modales ---------------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .65); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card {
  width: 100%; max-width: 640px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 24px 70px rgba(0, 0, 0, .7); overflow: hidden;
}
.modal-card.small { max-width: 460px; }
.modal-card > header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-card > header h3 { margin: 0; font-size: 16px; display: flex; align-items: center; }
.modal-card .x { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-card .mbody { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-card > footer { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-card .sp { flex: 1; }
.mbody.info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mbody.info small { display: block; text-transform: uppercase; font-size: 11px; letter-spacing: .4px; }
.mbody.info .full { grid-column: 1 / -1; }
.mbody.info p { margin: 2px 0 0; white-space: pre-wrap; }
@media (max-width: 600px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal-card, .modal-card.small { max-width: none; max-height: 94vh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* éditeur */
.tsel { display: flex; gap: 6px; margin-top: 5px; }
.tsel select { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; text-align-last: center; flex: 1; min-width: 0; }
.tadj { flex: none; width: 44px; min-height: 40px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--txt); font: 700 20px var(--font); cursor: pointer; touch-action: manipulation; }
.tadj:hover { border-color: var(--acc); }
.durs { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.durs button { min-height: 32px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel2); color: var(--txt); font: 600 12.5px var(--font); cursor: pointer; touch-action: manipulation; }
.durs button:hover { border-color: var(--acc); }
.ed .lbl { font-weight: 600; font-size: 13px; color: #cdd5e3; margin-bottom: 6px; }
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-bottom: 14px; }
.act { margin: 0; cursor: pointer; }
.act input { position: absolute; opacity: 0; pointer-events: none; }
.act span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 40px; padding: 4px 8px; border-radius: 7px;
  background: var(--sbg); color: var(--sfg); font-weight: 800; font-size: 11.5px; text-transform: uppercase; line-height: 1.15;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3); transition: transform .1s;
}
.act.is-surf span { box-shadow: inset 0 0 0 1px #5b6478; }
.act input:checked + span { outline: 3px solid #fff; outline-offset: 2px; transform: scale(1.02); }
.act input:focus-visible + span { outline: 3px solid var(--acc); outline-offset: 2px; }
.surfrow { display: flex; gap: 8px 18px; flex-wrap: wrap; background: #0d1118; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px 0; margin-bottom: 14px; }
.surfrow .chk { margin-bottom: 11px; }
.conflict { background: #2c0f11; border: 1px solid #7f1d1d; color: #fecaca; border-radius: 9px; padding: 9px 12px; font-weight: 600; font-size: 13px; }

/* ---------------- authentification / PIN ---------------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.authcard { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.authcard .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.authcard .logo b { font-size: 18px; display: block; }
.authcard .btn.primary { width: 100%; min-height: 46px; font-size: 15px; }
.authcard .foot { text-align: center; margin-top: 16px; font-size: 13px; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 14px 0 22px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line2); transition: .15s; }
.pin-dots i.on { background: var(--acc); border-color: var(--acc); }
.pin-dots.shake { animation: shake .4s; }
.pin-dots.shake i { border-color: var(--red); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 0 auto; }
.pad button {
  height: 66px; border-radius: 50%; aspect-ratio: 1; justify-self: center; width: 66px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--txt); font: 600 26px var(--font); cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pad button:active { background: var(--acc2); color: #001018; }
.pad button.fn { background: transparent; border-color: transparent; font-size: 15px; color: var(--muted); }

/* ---------------- statistiques ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi small { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.kpi b { display: block; font-size: 28px; line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.gauge { height: 6px; background: var(--panel3); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.gauge i { display: block; height: 100%; background: var(--acc2); border-radius: 4px; }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: minmax(110px, 200px) 1fr 92px; gap: 10px; align-items: center; font-size: 13px; }
.bar .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; }
.bar .bt { height: 14px; background: var(--panel3); border-radius: 2px 4px 4px 2px; position: relative; }
.bar .bt i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px 4px 4px 2px; min-width: 2px; }
.bar .bv { text-align: right; font-variant-numeric: tabular-nums; color: #cdd5e3; }
@media (max-width: 600px) { .bar { grid-template-columns: 96px 1fr 74px; font-size: 12px; } }
.grp { display: grid; grid-template-columns: 56px 1fr; gap: 6px 10px; align-items: center; }
.grp .gl { font-weight: 700; font-size: 12.5px; text-transform: capitalize; }
.grp .gb { display: flex; flex-direction: column; gap: 2px; }
.grp .gb .bt { height: 11px; background: var(--panel3); border-radius: 2px 4px 4px 2px; position: relative; }
.grp .gb .bt i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px 4px 4px 2px; }
.grp .gb .bt em { position: absolute; left: calc(var(--w) + 6px); top: -2px; font-size: 10.5px; font-style: normal; color: #cdd5e3; white-space: nowrap; }
.chartlegend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 10px; }
.chartlegend span { display: inline-flex; align-items: center; gap: 6px; }
.chartlegend i { width: 12px; height: 12px; border-radius: 3px; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 11px; width: 100%; min-width: 640px; }
.heat th { color: var(--muted); font-weight: 700; padding: 2px; text-align: center; }
.heat th.d { text-align: left; padding-right: 6px; text-transform: capitalize; }
.heat td { height: 26px; border-radius: 3px; text-align: center; font-variant-numeric: tabular-nums; color: #fff; font-weight: 600; font-size: 10px; }
.heatscale { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.heatscale i { width: 26px; height: 10px; border-radius: 2px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .cols2 { grid-template-columns: 1fr; } }

/* journal */
.logrow details summary { cursor: pointer; color: var(--acc); font-size: 12px; }
.logrow pre { white-space: pre-wrap; word-break: break-word; background: #0d1118; border: 1px solid var(--line); padding: 8px; border-radius: 7px; font-size: 11.5px; max-width: 520px; margin: 6px 0 0; color: #cbd5e1; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* impression écran (secours) */
@media print {
  .topbar, .toolbar, .hint, .legend, .toast { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------------- installateur ---------------- */
.inst { max-width: 760px; margin: 0 auto; padding: 28px 16px 40px; }
.inst-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.inst-head h1 { margin: 0; font-size: 24px; }
.inst-foot { text-align: center; font-size: 12px; margin-top: 18px; }
.stepper { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; counter-reset: st; }
.stepper li { counter-increment: st; font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 6px 0; border-top: 3px solid var(--line2); text-align: center; }
.stepper li::before { content: counter(st) ". "; }
.stepper li.on { color: #fff; border-color: var(--acc); }
.stepper li.done { color: #86efac; border-color: #16a34a; cursor: pointer; }
@media (max-width: 600px) { .stepper li { font-size: 0; padding-top: 4px; } .stepper li::before { font-size: 12px; content: counter(st); } }
.step .nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.req, .steps-done { list-style: none; padding: 0; margin: 0 0 12px; }
.req li, .steps-done li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.req li span { display: flex; flex-direction: column; }
.req i, .steps-done i { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 900; font-size: 13px; }
.req .ok i, .steps-done .ok i { background: #0b2a17; color: #86efac; }
.req .warn i, .steps-done .warn i { background: #2c1d05; color: #fcd34d; }
.req .err i, .steps-done .err i { background: #2c0f11; color: #fca5a5; }
.steps-done .err { color: #fecaca; }
.ro-opt { margin: -4px 0 12px 28px; }
.danger-zone { background: #2c0f11; border: 1px solid #7f1d1d; border-radius: 9px; padding: 10px 12px; color: #fecaca; }
.recap { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.recap dt { color: var(--muted); font-weight: 600; }
.recap dd { margin: 0; font-weight: 600; word-break: break-word; }
.lbl { font-weight: 600; font-size: 13px; color: #cdd5e3; margin: 6px 0 8px; }
code { background: var(--panel3); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

.hide-sm { }
@media (max-width: 520px) {
  .hide-sm { display: none; }
  .topbar { gap: 8px; }
  .brand small { display: none; }
  .mainnav.pub { gap: 0; }
  .mainnav.pub a { padding: 8px 8px; font-size: 13px; }
}
@media (max-width: 820px) {
  .planning { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .toolbar { gap: 8px; }
  .tb-group.right { margin-left: 0; width: 100%; justify-content: flex-end; }
}

/* ---------------- publication des semaines ---------------- */
.pubbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; font-weight: 700; }
.pubbar.off {
  color: #1a1000; border: 2px solid #f59e0b;
  background: repeating-linear-gradient(-45deg, #fbbf24 0 18px, #f59e0b 18px 36px);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .25), 0 8px 24px rgba(245, 158, 11, .2);
  animation: pubpulse 2.4s ease-in-out infinite;
}
.pubbar.off .ico { font-size: 22px; }
.pubbar.off b { font-size: 16px; letter-spacing: .3px; text-transform: uppercase; }
.pubbar.off small { display: block; color: #3a2600; font-weight: 600; font-size: 12.5px; }
.pubbar.off .btn { margin-left: auto; background: #111; color: #fff; border-color: #111; min-height: 42px; padding: 0 18px; font-size: 14px; }
.pubbar.on { background: #0b2a17; border: 1px solid #166534; color: #bbf7d0; font-size: 13px; padding: 7px 12px; }
.pubbar.on .btn { margin-left: auto; min-height: 32px; font-size: 12.5px; }
@keyframes pubpulse { 50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, .12), 0 8px 24px rgba(245, 158, 11, .25); } }
#app.unpublished .wk-scroll, #app.unpublished .dv-scroll { border: 2px dashed #f59e0b; }
#app.unpublished .wk-scroll { background-image: repeating-linear-gradient(-45deg, rgba(245, 158, 11, .05) 0 22px, transparent 22px 44px); }
.tb-title .pubtag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 800; vertical-align: 2px; }
.pubtag.off { background: #f59e0b; color: #1a1000; }
.pubtag.on { background: #0b2a17; color: #86efac; }
.hiddenweek { text-align: center; padding: 60px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.hiddenweek .big { font-size: 52px; line-height: 1; margin-bottom: 10px; }
.hiddenweek h2 { font-size: 20px; }
.hiddenweek p { color: var(--muted); max-width: 460px; margin: 0 auto 18px; }

/* ---------------- tableau de bord « En direct » ---------------- */
.live { padding: 16px 16px 40px; max-width: 1500px; margin: 0 auto; }
.live-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.live-clock { font: 800 46px/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.live-date { color: var(--muted); font-size: 15px; text-transform: capitalize; }
.live-top .sp { flex: 1; }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-right: 6px; animation: blink 1.4s infinite; vertical-align: 1px; }
@keyframes blink { 50% { opacity: .25; } }
.surfalert { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 12px; margin-bottom: 14px; background: #000; border: 2px solid #fff; }
.surfalert .sicon { flex: none; width: 52px; height: 52px; border-radius: 10px; background: #fff; color: #000; display: grid; place-items: center; font: 900 32px var(--font); }
.surfalert b { display: block; font-size: 20px; }
.surfalert span { color: #cbd5e1; font-size: 14px; }
.surfalert .cd { margin-left: auto; font: 800 34px var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.surfalert.now { border-color: var(--red); animation: pubpulse 1.6s infinite; }
.surfalert.now .cd { color: #fca5a5; }
.surfalert.soon { border-color: #f59e0b; }
.livegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.zcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.zhead { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #000; }
.zhead b { font-size: 16px; letter-spacing: .3px; }
.zhead small { color: #9aa4b8; font-weight: 700; text-transform: uppercase; font-size: 11px; }
.znow { padding: 16px; background: var(--sbg, #151a24); color: var(--sfg, var(--txt)); min-height: 128px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.znow .tag { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; opacity: .8; }
.znow .lab { font-size: 25px; font-weight: 900; text-transform: uppercase; line-height: 1.1; margin: 4px 0; overflow-wrap: anywhere; }
.znow .hr { font-weight: 700; font-size: 14px; opacity: .9; }
.znow .rest { margin-top: 8px; font-weight: 800; font-size: 14px; }
.znow .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(0, 0, 0, .25); }
.znow .prog i { display: block; height: 100%; background: currentColor; opacity: .7; }
.znow.free { background: #0d1118; color: var(--muted); }
.znow.free .lab { color: #e6edf7; }
.znow.surf { background: #000; color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.zinfo { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.zrow { display: flex; align-items: center; gap: 10px; }
.zrow .k { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; width: 92px; flex: none; }
.zrow .v { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zrow .t { color: #cbd5e1; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; }
.zrow .sw { margin-right: 6px; }
.zrow.zsurf .v { color: #fff; }
.zrow.zsurf.soon .t { color: #fbbf24; font-weight: 800; }
.zlist { border-top: 1px solid var(--line); padding: 8px 14px 12px; font-size: 13px; }
.zlist div { display: flex; gap: 8px; padding: 3px 0; color: #cbd5e1; }
.zlist div span:first-child { font-variant-numeric: tabular-nums; color: var(--muted); width: 98px; flex: none; }
.zlist div span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.live-note { background: #0070C0; color: #fff; font-weight: 700; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
body.kiosk .topbar { display: none; }
body.kiosk .live-clock { font-size: 64px; }
@media (max-width: 600px) { .live-clock { font-size: 36px; } .surfalert b { font-size: 16px; } .surfalert .cd { font-size: 24px; } .surfalert .sicon { width: 40px; height: 40px; font-size: 24px; } .livegrid { grid-template-columns: 1fr; } }

/* ---------------- Mode TV : tout tient dans l'écran ---------------- */
body.kiosk { overflow: hidden; cursor: none; }
body.kiosk .live { height: 100vh; height: 100dvh; max-width: none; display: flex; flex-direction: column; overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); gap: 1.4vh; }
body.kiosk .live-top { justify-content: center; text-align: center; margin: 0; flex: none; }
body.kiosk .live-top > div { display: flex; align-items: baseline; gap: 2vw; }
body.kiosk .live-clock { font-size: clamp(34px, 7.5vh, 96px); }
body.kiosk .live-date { font-size: clamp(14px, 2.4vh, 28px); }
body.kiosk .tvhide { display: none !important; }
body.kiosk #surf, body.kiosk #lnote, body.kiosk #pubWarn { flex: none; }
body.kiosk .surfalert, body.kiosk .live-note, body.kiosk .pubbar { margin: 0; }
body.kiosk .surfalert { padding: 1.2vh 1.6vw; }
body.kiosk .surfalert .sicon { width: clamp(36px, 6vh, 70px); height: clamp(36px, 6vh, 70px); font-size: clamp(22px, 4vh, 44px); }
body.kiosk .surfalert b { font-size: clamp(16px, 2.8vh, 34px); }
body.kiosk .surfalert span { font-size: clamp(12px, 1.8vh, 20px); }
body.kiosk .surfalert .cd { font-size: clamp(24px, 5vh, 60px); }
body.kiosk .live-note { padding: 1vh 1.4vw; font-size: clamp(13px, 2vh, 24px); }
body.kiosk .livegrid { flex: 1; min-height: 0; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 1.4vh 1vw; }
body.kiosk .zcard { min-height: 0; }
body.kiosk .zhead { padding: 1vh 1vw; }
body.kiosk .zhead b { font-size: clamp(14px, 2.6vh, 30px); }
body.kiosk .zhead small { font-size: clamp(10px, 1.4vh, 15px); }
body.kiosk .znow { flex: 1; min-height: 0; padding: 1.6vh 1.2vw; }
body.kiosk .znow .tag { font-size: clamp(10px, 1.5vh, 16px); }
body.kiosk .znow .lab { font-size: clamp(20px, 4.4vh, 54px); }
body.kiosk .znow .hr { font-size: clamp(12px, 2vh, 24px); }
body.kiosk .znow .rest { font-size: clamp(12px, 2.2vh, 26px); }
body.kiosk .znow .prog { height: 0.9vh; }
body.kiosk .zinfo { padding: 1.2vh 1vw; gap: 0.9vh; font-size: clamp(12px, 2vh, 24px); }
body.kiosk .zrow { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 1px; }
body.kiosk .zrow .k { grid-column: 1 / -1; width: auto; font-size: clamp(10px, 1.4vh, 15px); }
body.kiosk .zrow .v { font-size: clamp(13px, 2.2vh, 26px); }
body.kiosk .zrow .t { font-size: clamp(11px, 1.8vh, 22px); }

/* ---------------- menu contextuel ---------------- */
.ctxmenu { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.ctxmenu .mp {
  position: fixed; min-width: 236px; max-width: 320px; max-height: calc(100vh - 12px); overflow-y: auto; pointer-events: auto;
  background: rgba(25, 30, 41, .98); border: 1px solid var(--line2); border-radius: 11px; padding: 5px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .4); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: ctxin .09s ease-out;
}
@keyframes ctxin { from { opacity: 0; transform: scale(.97); } }
.ctxmenu .mh { display: flex; align-items: center; gap: 8px; padding: 7px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ctxmenu .mh span { display: flex; flex-direction: column; font-weight: 800; font-size: 13px; line-height: 1.2; min-width: 0; }
.ctxmenu .mh small { font-weight: 500; font-size: 11.5px; text-transform: none; }
.ctxmenu .mh .sw { margin: 0; flex: none; }
.ctxmenu .mi {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 7px; background: none;
  color: var(--txt); font: 500 13.5px var(--font); text-align: left; cursor: pointer; min-height: 34px;
}
.ctxmenu .mi:hover, .ctxmenu .mi:focus-visible { background: var(--acc2); color: #001018; outline: none; }
.ctxmenu .mi:hover kbd, .ctxmenu .mi:hover b { color: #001018; }
.ctxmenu .mi i { width: 18px; text-align: center; font-style: normal; flex: none; font-weight: 800; }
.ctxmenu .mi i.sw { width: 14px; height: 14px; margin: 0 2px; }
.ctxmenu .mi span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctxmenu .mi kbd { font: 600 11px var(--font); color: var(--muted); }
.ctxmenu .mi b { color: var(--muted); }
.ctxmenu .mi.on { font-weight: 800; }
.ctxmenu .mi.danger { color: #fca5a5; }
.ctxmenu .mi.danger:hover { background: #b91c1c; color: #fff; }
.ctxmenu .mi:disabled { opacity: .4; cursor: default; background: none; }
.ctxmenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
body.touch .ctxmenu .mi { min-height: 44px; font-size: 15px; }
.slot.hot { outline: 2px solid #fff; outline-offset: 1px; z-index: 6; }
.clipchip {
  position: fixed; left: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 90; display: flex; align-items: center; gap: 10px;
  background: var(--panel3); border: 1px solid var(--acc2); border-radius: 10px; padding: 8px 8px 8px 12px; max-width: min(92vw, 460px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .5); font-size: 13px; font-weight: 700;
}
.clipchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clipchip small { font-weight: 500; white-space: nowrap; }
.clipchip button { flex: none; background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0 4px; }
@media (max-width: 700px) { .clipchip small { display: none; } }
.toast.has-act { pointer-events: auto; display: flex; align-items: center; gap: 14px; }
.toast-act { background: none; border: 1px solid var(--acc); color: var(--acc); border-radius: 7px; padding: 4px 10px; font: 700 13px var(--font); cursor: pointer; }
.toast.err .toast-act { border-color: #fca5a5; color: #fca5a5; }

/* menu Administration */
.navdd { position: relative; }
.navdd summary { list-style: none; cursor: pointer; color: var(--muted); padding: 8px 11px; border-radius: 8px; font-weight: 600; font-size: 13.5px; white-space: nowrap; user-select: none; }
.navdd summary::-webkit-details-marker { display: none; }
.navdd summary:hover, .navdd[open] summary { color: var(--txt); background: var(--panel2); }
.navdd.on summary { color: #fff; background: var(--panel3); box-shadow: inset 0 -2px 0 var(--acc); }
.navdd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 6px; box-shadow: 0 14px 40px rgba(0, 0, 0, .5); z-index: 70; display: flex; flex-direction: column; }
.navdd-menu a { padding: 10px 12px !important; }
@media (max-width: 980px) {
  .navdd summary { padding: 13px 14px; font-size: 15px; }
  .navdd-menu { position: static; box-shadow: none; border: 0; background: transparent; padding: 0 0 0 12px; }
}

/* ---------------- administration des écrans ---------------- */
.page.wide { max-width: 1560px; }
.scrlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .scrlist { grid-template-columns: 1fr; } }
.scrcard { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.scrcard.off { opacity: .6; }
.scrtop { display: flex; justify-content: space-between; gap: 12px; }
.scrstat { font-size: 13px; color: #cbd5e1; margin-top: 4px; }
.dotst { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.dotst.green { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.dotst.red { background: #ef4444; }
.dotst.gray { background: #64748b; }
.scrthumb { width: 74px; height: 44px; border-radius: 6px; border: 1px solid var(--line2); position: relative; flex: none; overflow: hidden; }
.scrthumb span { position: absolute; left: 8px; right: 30px; top: 9px; height: 4px; border-radius: 2px; }
.scrtags { display: flex; gap: 6px; flex-wrap: wrap; }
.linkbox { display: flex; gap: 6px; }
.linkbox input { font: 12px ui-monospace, Menlo, Consolas, monospace; min-height: 34px; color: #9fb3cf; }
.scredit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 46%); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .scredit { grid-template-columns: 1fr; } .scrprev { position: static !important; order: -1; } }
.scrprev { position: sticky; top: calc(var(--top) + 12px); }
.prevbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.prevbar b { margin-right: auto; }
.prevbox { position: relative; overflow: hidden; border-radius: 10px; background: #000; border: 1px solid var(--line2); box-shadow: 0 10px 40px rgba(0, 0, 0, .5); margin: 0 auto; }
.prevbox iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.chkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 14px; }
.reslist { display: flex; flex-direction: column; gap: 6px; }
.resitem { display: flex; align-items: center; gap: 6px; background: #0d1118; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px 6px 12px; }
.resitem .btn.icon { width: 32px; min-height: 32px; font-size: 15px; }
.themes, .modes, .savers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.themecard, .modecard, .savercard { margin: 0; cursor: pointer; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; border: 2px solid var(--line); background: #0d1118; }
.themecard input, .modecard input, .savercard input { position: absolute; opacity: 0; pointer-events: none; }
.themecard:has(input:checked), .modecard:has(input:checked), .savercard:has(input:checked) { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(56, 189, 248, .18); }
.themecard small, .savercard small, .modecard small { font-weight: 500; font-size: 11.5px; line-height: 1.3; }
.modecard span { display: flex; flex-direction: column; gap: 2px; }
.tprev { height: 58px; border-radius: 6px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; padding: 14px 6px 6px; position: relative; }
.tprev::before { content: ""; position: absolute; left: 6px; top: 5px; width: 34%; height: 4px; border-radius: 2px; background: currentColor; opacity: .7; }
.tprev i { border-radius: 3px; }
.tprev.t-nuit { background: #0b0e14; color: #eef2f8; } .tprev.t-nuit i { background: #141924; border: 1px solid #232a38; }
.tprev.t-noir { background: #000; color: #eee; } .tprev.t-noir i { background: #080808; border: 1px solid #1b1b1b; }
.tprev.t-glace { background: radial-gradient(120% 90% at 20% 0%, #0d2a55, #020812); color: #fff; } .tprev.t-glace i { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); }
.tprev.t-clair { background: #e9eef5; color: #0b1220; } .tprev.t-clair i { background: #fff; border: 1px solid #d4dbe6; }
.tprev i:nth-child(1) { background: #f7a829 !important; }
.scrthumb.t-nuit { background: #0b0e14; } .scrthumb.t-noir { background: #000; } .scrthumb.t-glace { background: #0d2a55; } .scrthumb.t-clair { background: #e9eef5; }
.vblock { margin-bottom: 14px; }
.plage { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #0d1118; border: 1px solid var(--line); border-radius: 9px; padding: 8px; margin-bottom: 8px; }
.plage select { width: auto; min-height: 36px; font-size: 15px; font-variant-numeric: tabular-nums; }
.plage > span { color: var(--muted); font-size: 13px; }
.plage .days { display: flex; gap: 3px; margin-left: auto; }
.plage .day { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel2); color: var(--muted); font: 700 12px var(--font); cursor: pointer; }
.plage .day.on { background: var(--acc2); color: #001018; border-color: var(--acc2); }
.sprev { height: 62px; border-radius: 6px; background: #000; position: relative; overflow: hidden; }
.sprev i { position: absolute; }
.sprev.s-horloge i::after { content: "22:47"; position: absolute; left: 18px; top: 14px; color: #cfd6e4; font: 200 22px var(--font); }
.sprev.s-aurore { background: radial-gradient(circle at 25% 30%, rgba(14, 165, 233, .55), transparent 55%), radial-gradient(circle at 75% 70%, rgba(124, 58, 237, .55), transparent 55%), radial-gradient(circle at 50% 100%, rgba(16, 185, 129, .45), transparent 60%), #000; }
.sprev.s-aurore i::after { content: "22:47"; position: absolute; left: 50px; top: 20px; color: #fff; font: 300 14px var(--font); opacity: .8; }
.sprev.s-logo i { left: 40%; top: 14px; width: 26px; height: 26px; border-radius: 6px; background: #0ea5e9; }
.sprev.s-prochain i::after { content: "22:47 · Prochain : HGD 08H15"; position: absolute; left: 10px; top: 22px; color: #9aa6b8; font: 600 10.5px var(--font); white-space: nowrap; }
.sprev.s-noir i { left: 64%; top: 40px; width: 5px; height: 5px; border-radius: 50%; background: #2a3140; }

/* créneaux simultanés (couloirs) */
.track:not(.v) .slot.lane .in { flex-direction: row; gap: 4px; align-items: baseline; }
.track:not(.v) .slot.lane b { font-size: 9px; -webkit-line-clamp: 1; }
.track:not(.v) .slot.lane .in span { font-size: 8.5px; }
@container (max-width: 110px) { .slot.lane .in span { display: none; } }

/* onglets statistiques */
.stabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.stabs a:not(.btn) { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 700; }
.stabs a:not(.btn):hover { background: var(--panel2); color: var(--txt); text-decoration: none; }
.stabs a.on { background: var(--panel3); color: #fff; box-shadow: inset 0 -2px 0 var(--acc); }
.stabs .sp { flex: 1; }
/* histogramme vertical */
.vbars { display: flex; align-items: flex-end; gap: 3px; height: 220px; padding: 22px 0 0; border-bottom: 1px solid var(--line2); position: relative; }
.vbars .vb { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.vbars .vb i { display: block; width: 100%; max-width: 46px; border-radius: 4px 4px 0 0; min-height: 0; }
.vbars .vb em { position: absolute; top: -18px; font-style: normal; font-size: 10.5px; color: #cdd5e3; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vbars.dense .vb em { display: none; }
.vbars .vb:hover em { display: block; z-index: 2; background: var(--panel3); padding: 1px 5px; border-radius: 4px; }
.vlabels { display: flex; gap: 3px; margin-top: 5px; }
.vlabels span { flex: 1; min-width: 0; text-align: center; font-size: 10.5px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.vlabels span.we { color: #fca5a5; }
