/* Gefor Planning — interface web (nouvelle version)
 * Palette : couleurs du logo Groupe GEFOR — bleu marine #293378 (couleur
 * principale) et orange #F25822 → rouge #F32B11 (touches de marque),
 * neutres teintés vers le marine.
 * Thème automatique : suit le réglage clair / sombre de l'appareil.
 * Logo du groupe en filigrane au fond de la page (body::before).
 * Les couleurs de filière sont calculées à partir d'une teinte (--h)
 * posée sur chaque élément, avec luminosité adaptée au thème. */

:root {
  --bg: #f3f4f9;
  --surface: #ffffff;
  --surface-2: #e9ebf5;
  --ink: #161a35;
  --muted: #5b6182;
  --line: #d9dcea;
  --accent: #293378;
  --accent-ink: #ffffff;
  --accent-soft: #e2e5f5;
  --orange: #f25822;
  --degrade-marque: linear-gradient(90deg, #293378 0 38%, #f25822 38%, #f32b11);
  --warn: #9a6212;
  --warn-soft: #fbefd9;
  --crit: #b3361f;
  --crit-soft: #fbe3dd;
  --ok: #2a7a4f;
  --chip-s: 55%;
  --chip-l: 91%;
  --chip-ink-l: 24%;
  --shadow: 0 1px 2px rgba(22, 26, 53, 0.06), 0 2px 8px rgba(22, 26, 53, 0.05);
  --font-display: "Bricolage Grotesque", "Public Sans", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0d0f1c;
    --surface: #151829;
    --surface-2: #1d2136;
    --ink: #e6e8f4;
    --muted: #9ca1bf;
    --line: #2a2f4b;
    --accent: #9ba8f5;
    --accent-ink: #10142e;
    --accent-soft: #252b52;
    --orange: #ff7a45;
    --degrade-marque: linear-gradient(90deg, #9ba8f5 0 38%, #ff7a45 38%, #f5503a);
    --warn: #e0a84d;
    --warn-soft: #3a2c14;
    --crit: #ee7a63;
    --crit-soft: #3f1d17;
    --ok: #6cc896;
    --chip-s: 32%;
    --chip-l: 21%;
    --chip-ink-l: 86%;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0f1c;
  --surface: #151829;
  --surface-2: #1d2136;
  --ink: #e6e8f4;
  --muted: #9ca1bf;
  --line: #2a2f4b;
  --accent: #9ba8f5;
  --accent-ink: #10142e;
  --accent-soft: #252b52;
  --orange: #ff7a45;
  --degrade-marque: linear-gradient(90deg, #9ba8f5 0 38%, #ff7a45 38%, #f5503a);
  --warn: #e0a84d;
  --warn-soft: #3a2c14;
  --crit: #ee7a63;
  --crit-soft: #3f1d17;
  --ok: #6cc896;
  --chip-s: 32%;
  --chip-l: 21%;
  --chip-ink-l: 86%;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
}

/* Filigrane : logo du groupe (version sans fond blanc) derrière le contenu. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("logo-gefor-fond.png") no-repeat center calc(100% - 40px) / min(70vw, 760px) auto;
  opacity: 0.07;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) body::before, :root[data-theme="auto"] body::before { filter: brightness(0) invert(1); opacity: 0.05; }
}
:root[data-theme="dark"] body::before { filter: brightness(0) invert(1); opacity: 0.05; }
@media print { body::before { display: none; } }

button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding-inline: 16px;
}

/* ---------- Bandeau du site de test ---------- */
.bandeau-test {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  padding: 6px 16px;
  background: repeating-linear-gradient(135deg, #f25822 0 18px, #e2481a 18px 36px);
  color: #ffffff;
  font-size: 13px;
  text-align: center;
}
.bandeau-test strong { letter-spacing: 0.08em; }
@media print { .bandeau-test { display: none; } }

/* ---------- En-tête ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 3px solid transparent;
  border-image: var(--degrade-marque) 1;
}
.topbar .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding-block: 14px;
}
.brand { display: flex; align-items: center; gap: 14px; margin-right: auto; }
.brand-texte { display: flex; flex-direction: column; gap: 2px; }
/* Logo sur fond blanc (le fichier en a un), lisible sur tous les thèmes. */
.brand-logo {
  display: block;
  height: 44px;
  width: auto;
  background: #ffffff;
  border-radius: 6px;
  padding: 5px 8px;
}
@media (max-width: 640px) {
  .brand-logo { height: 34px; }
  .brand p { display: none; }
}

.brand h1 {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.brand p { margin: 0; color: var(--muted); font-size: 13px; }

.source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.source::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn);
}
.source[data-source="api"]::before { background: var(--ok); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { background: var(--surface-2); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 -2px 0 var(--orange); }
.tab .count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: var(--crit);
  color: var(--surface);
  border-radius: 999px;
  padding: 0 6px;
  line-height: 18px;
}

/* ---------- Barre d'outils ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-block: 16px;
}
.weeknav { display: flex; align-items: center; gap: 6px; }
.weeknav .label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  min-width: 13ch;
}
.weeknav .label small {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 6px 10px;
  line-height: 1.2;
}
.btn:hover { border-color: var(--accent); }
.btn[disabled] { opacity: 0.4; cursor: default; border-color: var(--line); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.field select, .field input {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 6px 8px;
  max-width: 100%;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 12px;
}
.summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }

main { padding-bottom: 40px; }

/* ---------- Vue semaine ---------- */
.week {
  display: grid;
  grid-template-columns: 92px repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.week .head {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--surface-2);
}
.week .head:first-child { border-left: 0; }
.week .head .dow { font-weight: 700; text-transform: capitalize; }
.week .head .dom { color: var(--muted); font-size: 12px; }
.week .head.today .dow { color: var(--accent); }
.week .head, .week .slotname, .week .cell { grid-column: var(--col); grid-row: var(--row); }
.week .slotname {
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  border-top: 1px solid var(--line);
}
.week .cell {
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 72px;
}
.week .cell.first { border-top: 0; }
.week .cell.today { background: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
.empty-slot { color: var(--muted); font-size: 12px; padding: 4px; }

.course {
  --h: 200;
  background: hsl(var(--h) var(--chip-s) var(--chip-l));
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  text-align: left;
  width: 100%;
  display: grid;
  gap: 2px;
  font-size: 12.5px;
  line-height: 1.3;
}
.course:hover { border-color: hsl(var(--h) 40% 50%); }
.course.has-crit { box-shadow: inset 3px 0 0 var(--crit); }
.course.has-warn { box-shadow: inset 3px 0 0 var(--warn); }
.course .time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: hsl(var(--h) 30% var(--chip-ink-l));
  display: flex; justify-content: space-between; gap: 6px;
}
.course .subject { font-weight: 600; overflow-wrap: anywhere; }
.course .meta { color: var(--muted); overflow-wrap: anywhere; }
.course .fils { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.course .fil {
  font-weight: 700;
  color: hsl(var(--h) 45% var(--chip-ink-l));
}

/* ---------- Vue salles ---------- */
.scroll-x { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.rooms { border-collapse: collapse; width: 100%; min-width: 860px; }
table.rooms th, table.rooms td {
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 6px;
  vertical-align: top;
  font-size: 12px;
}
table.rooms thead th {
  background: var(--surface-2);
  text-align: left;
  font-weight: 700;
  position: sticky; top: 0;
}
table.rooms thead tr:last-child th { font-weight: 500; color: var(--muted); }
table.rooms th.room {
  text-align: left;
  border-left: 0;
  white-space: nowrap;
  background: var(--surface);
  position: sticky; left: 0;
  z-index: 1;
}
table.rooms th.room .cap { display: block; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
table.rooms tr.travaux th.room .cap { color: var(--warn); }
table.rooms td.blocked {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, transparent 6px 12px);
}
.occ {
  --h: 200;
  display: block;
  border: 0;
  width: 100%;
  text-align: left;
  background: hsl(var(--h) var(--chip-s) var(--chip-l));
  color: hsl(var(--h) 45% var(--chip-ink-l));
  border-radius: 4px;
  padding: 3px 5px;
  font-weight: 600;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.occ + .occ { margin-top: 3px; }
.occ.has-crit { outline: 2px solid var(--crit); outline-offset: -2px; }
.occ.has-warn { outline: 2px solid var(--warn); outline-offset: -2px; }

/* ---------- Alertes ---------- */
.alert-groups { display: grid; gap: 18px; }
.alert-group h2 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.alert-group h2 .n { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.alert-group p.why { margin: -4px 0 10px; color: var(--muted); max-width: 70ch; }
.alert-list { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; }
.alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}
.sev {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.sev.crit { background: var(--crit-soft); color: var(--crit); }
.sev.warn { background: var(--warn-soft); color: var(--warn); }
.alert .date { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.alert .txt { overflow-wrap: anywhere; }
.alert .go { font-size: 12px; }
.none { color: var(--muted); padding: 24px 0; }

/* ---------- Référentiel ---------- */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel h2 {
  font-family: var(--font-display);
  font-size: 15px;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 8px;
}
.panel h2 span { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.panel ul { list-style: none; margin: 0; padding: 6px 0; max-height: 420px; overflow-y: auto; }
.panel li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 5px 14px;
}
.panel li .sub { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.dot { --h: 200; width: 9px; height: 9px; border-radius: 50%; background: hsl(var(--h) 55% 50%); display: inline-block; margin-right: 8px; flex: none; }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Détail d'un cours ---------- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 20, 22, 0.35);
  display: flex; justify-content: flex-end;
  z-index: 20;
}
.drawer {
  background: var(--surface);
  width: min(420px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px calc(18px + env(safe-area-inset-bottom, 0px));
  display: grid; align-content: start; gap: 14px;
  border-left: 1px solid var(--line);
}
.drawer header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.drawer h2 { font-family: var(--font-display); margin: 0; font-size: 20px; text-wrap: balance; }
.drawer dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; }
.drawer dt { color: var(--muted); }
.drawer dd { margin: 0; overflow-wrap: anywhere; }
.drawer .issues { display: grid; gap: 6px; }
.drawer .issue { display: flex; gap: 8px; align-items: baseline; }
.docs-cours { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.docs-cours h3 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.docs-cours .hint { margin: 0; }
.docs-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.docs-liste li { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.doc-texte { white-space: pre-wrap; margin: 4px 0; }
.doc-form { display: grid; gap: 8px; }
.doc-form label:not(.check) { display: grid; gap: 4px; }
.doc-form textarea { width: 100%; font: inherit; }

.notice {
  background: var(--warn-soft);
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ---------- Cloison B/C ---------- */
:root { --open: #1f6fb2; --open-soft: #dcebf8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --open: #7db8ea; --open-soft: #173049; } }
:root[data-theme="dark"] { --open: #7db8ea; --open-soft: #173049; }
.cloison-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  margin-bottom: 18px;
}
.cs {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  font-size: 12.5px;
}
.cs-day { color: var(--muted); font-size: 12px; }
.cs-state { font-weight: 700; }
.cs.libre .cs-state { color: var(--muted); font-weight: 500; }
.cs.ouverte { background: var(--open-soft); border-color: transparent; }
.cs.ouverte .cs-state { color: var(--open); }
.cs.fermee { background: var(--surface-2); border-color: transparent; }
.cs.change { box-shadow: inset 0 0 0 2px var(--accent); }
.cs.conflit { box-shadow: inset 0 0 0 2px var(--crit); }
.cs-act { font-size: 12px; font-weight: 600; color: var(--accent); }
.cs.conflit .cs-act { color: var(--crit); }
.sev.open { background: var(--open-soft); color: var(--open); }
.sev.close { background: var(--surface-2); color: var(--ink); }
.mails { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.mail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  gap: 10px;
}
.mail header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mail dl { display: grid; grid-template-columns: 52px 1fr; gap: 4px 10px; margin: 0; font-size: 13px; }
.mail dt { color: var(--muted); }
.mail dd { margin: 0; overflow-wrap: anywhere; }
.mail pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-body);
  font-size: 13px;
  background: var(--bg);
  border-radius: 6px;
  padding: 10px 12px;
}
.mail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mail-actions a.btn { color: var(--ink); text-decoration: none; }
.copied { color: var(--ok); font-size: 12px; font-weight: 600; }
.cl { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); }
.cl.ouverte { background: var(--open-soft); color: var(--open); }
.cl.change { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.cloison-row td, tr.cloison-row th { background: var(--bg); }

/* ---------- Utilisateur, connexion, comptes ---------- */
.userbox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.who { display: flex; flex-direction: column; line-height: 1.2; font-weight: 600; }
.who small { color: var(--muted); font-weight: 400; font-size: 12px; }
.account-actions { display: flex; gap: 6px; }
.btn.small { padding: 4px 8px; font-size: 12.5px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.notice.ok { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); }
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: var(--ok); }

.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 48px 16px;
  background: transparent;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--orange);
  border-radius: 10px;
  padding: 24px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}
.auth-logo {
  display: block;
  width: min(260px, 80%);
  height: auto;
  margin: 2px auto 4px;
  /* Fond blanc du logo : discret en thème clair, plaque blanche en thème sombre. */
  background: #ffffff;
  border-radius: 8px;
  padding: 8px 10px;
}
.auth-card h1 { margin: 0; font-family: var(--font-display); font-size: 15px; color: var(--muted); font-weight: 600; }
.auth-card h2 { margin: 0; font-family: var(--font-display); font-size: 24px; text-wrap: balance; }
.auth-card .why { margin: 0; color: var(--muted); }
.auth-card a { color: var(--accent); }
.auth-card .field input { padding: 9px 10px; font-size: 15px; }
.auth-card .btn.primary { padding: 10px; font-size: 15px; }
.hint { margin: 0; color: var(--muted); font-size: 12.5px; }

.account-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; margin-bottom: 14px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-left: auto; }
table.comptes { min-width: 720px; }
table.comptes td, table.comptes th { font-size: 13px; vertical-align: middle; }
table.comptes code { font-family: var(--font-mono); font-size: 12.5px; }
.row-actions { white-space: nowrap; text-align: right; }
.crees { margin-bottom: 16px; padding-bottom: 12px; }
.crees .why, .crees .mail-actions { padding-inline: 14px; }
.crees .why { margin: 10px 0; }
.crees .scroll-x { margin-inline: 14px; margin-bottom: 10px; }

/* ---------- Import Excel ---------- */
.import-panel { margin-bottom: 16px; }
.import-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; padding: 12px 14px; }
.import-form .hint { flex-basis: 100%; }
.import-result { margin: 0 14px 14px; padding: 10px 12px; border-radius: 6px; background: var(--warn-soft); }
.import-result.done { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); }
.import-result ul { margin: 6px 0; padding-left: 18px; display: grid; gap: 2px; max-height: none; overflow: visible; }
.import-result li { display: list-item; padding: 0; }
.import-result .why { margin: 4px 0 0; color: var(--ink); }

/* ---------- Heures des formateurs ---------- */
.heures-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 18px; margin-bottom: 8px; }
.heures-bar .summary { padding: 0 0 6px; }
.heures-bar #dl-tableau { margin-left: auto; }
table.heures td.num, table.heures th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.heures tfoot th { background: var(--surface-2); }
table.heures select { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 2px 4px; }
.linklike { border: 0; background: none; padding: 0; font-weight: 600; text-align: left; color: var(--ink); }
.linklike:hover { color: var(--accent); }
.h-detail > td { background: var(--bg); padding: 6px 10px 10px; }
table.seances { width: 100%; border-collapse: collapse; }
table.seances th, table.seances td { border: 0; border-bottom: 1px solid var(--line); padding: 4px 6px; font-size: 12.5px; text-align: left; }
table.seances tr.prevue td { color: var(--muted); }
.variables { margin-top: 18px; }
.seuil { color: var(--muted); font-size: 11.5px; }

@media (max-width: 860px) {
  .week { grid-template-columns: 1fr; }
  .week .head, .week .slotname { display: none; }
  .week .cell { grid-column: auto; grid-row: auto; order: var(--ord); border-left: 0; border-top: 0; border-bottom: 1px solid var(--line); }
  .week .cell::before {
    content: attr(data-label);
    font-size: 12px; font-weight: 700; color: var(--muted);
    text-transform: capitalize;
  }
  .filters { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.week .slotname.first { border-top: 0; }

/* ---------- Écran TV (lien dans l'onglet Salles) ---------- */
.tv-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; margin-bottom: 14px; }
.tv-panel a.btn { text-decoration: none; }
.tv-lien { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.tv-lien code { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }

/* ---------- Assistant IA ---------- */
.ia-panel { margin-bottom: 16px; }
.ia-pad { padding: 12px 14px; display: grid; gap: 10px; }
.ia-pad h3 { margin: 6px 0 0; font-size: 15px; }
.ia-pad ul { margin: 0; padding-left: 20px; }
tr.a-revoir td { background: var(--warn-soft); }
.ia-form { display: grid; gap: 8px; }
.ia-form textarea { width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink); resize: vertical; }
.ia-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ia-fil { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; }
.ia-msg { max-width: 88%; padding: 9px 13px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ia-msg.user { align-self: flex-end; background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.ia-msg.assistant { align-self: flex-start; background: var(--surface-2); }
.ia-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ia-table th, .ia-table td { padding: 6px 10px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.ia-table tr.ia-ko td { color: var(--muted); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }

/* ---------- Droits des administrateurs ---------- */
details.droits summary { cursor: pointer; font-size: 12.5px; white-space: nowrap; }
details.droits label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; margin-top: 4px; white-space: nowrap; }

/* ---------- Disponibilités ---------- */
.dispo-grille td, .dispo-grille th { text-align: center; }
.dispo-grille tbody th { text-align: left; white-space: nowrap; }
.dispo-grille input[type=checkbox] { width: 20px; height: 20px; }
.dispo-grille td.dispo-oui { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); font-weight: 700; }
.liste-absences, .liste-alertes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.liste-absences li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.liste-alertes li { display: grid; grid-template-columns: 140px 1fr; gap: 10px; padding: 6px 8px; border-radius: 6px; }
.liste-alertes li.nouvelle { background: var(--warn-soft); }
.liste-alertes .quand { color: var(--muted); font-size: 12.5px; }
.liste-alertes .msg { white-space: pre-wrap; }
@media (max-width: 640px) { .liste-alertes li { grid-template-columns: 1fr; } }

/* ---------- Brouillon de planning ---------- */
.br-diplomes { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.br-diplomes legend { font-size: 12.5px; color: var(--muted); padding: 0 4px; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.br-table td { vertical-align: top; }
.br-table tr.br-jour th { text-align: left; background: var(--surface-2); }
.br-table tr.br-revoir td { background: color-mix(in srgb, var(--crit) 6%, var(--surface)); }
.br-notes { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: var(--crit); }
.br-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; padding: 14px; }
.br-form .wide { grid-column: 1 / -1; }
.br-form input, .br-form select { width: 100%; }

/* ---------- Salle en gras, couleur des matières ---------- */
.course .salle-h { font-family: var(--font-body); font-size: 12px; font-weight: 800; color: var(--ink); margin-left: 4px; }
.course.mc { background: color-mix(in srgb, var(--mc) 24%, var(--surface)); border-left: 4px solid var(--mc); }
.mc-input { width: 26px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; vertical-align: middle; cursor: pointer; }
.filtre-comptes { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 12px 0; }
.filtre-comptes .field { margin: 0; }
.filtre-comptes input[type=search] { min-width: 220px; }
.fc-compte { font-size: 13px; color: var(--muted, #666); margin-left: auto; }

/* ---------- Vues jour et mois du planning ---------- */
/* Barre de navigation : flèches, période, « aujourd'hui », jour / semaine / mois */
.weeknav { flex-wrap: wrap; row-gap: 8px; }
.weeknav #prev, .weeknav #next { width: 36px; height: 36px; padding: 0; border-radius: 999px; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; }
.weeknav #today { height: 36px; padding: 0 14px; border-radius: 999px; font-weight: 600; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.weeknav #today:hover { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.seg { display: inline-flex; margin-left: 8px; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.seg[hidden] { display: none; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button:hover { color: var(--ink, inherit); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgb(0 0 0 / 12%); }
.seg button[hidden] { display: none; }
.week.jour { grid-template-columns: 92px minmax(0, 1fr); }
.week.jour .cell { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; align-content: start; }
table.mois { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); }
table.mois th { text-transform: capitalize; padding: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
table.mois td { vertical-align: top; border: 1px solid var(--line); padding: 4px; height: 92px; }
table.mois td.hors { background: var(--surface-2); opacity: .55; }
table.mois td.today .mois-j { color: var(--accent); font-weight: 700; }
.mois-j { background: none; border: 0; padding: 0 2px; font-size: 12px; color: var(--muted); cursor: pointer; display: block; margin-bottom: 2px; }
.mini { --h: 200; display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--mc, hsl(var(--h) 55% 45%)); background: hsl(var(--h) var(--chip-s) var(--chip-l));
  border-radius: 4px; padding: 2px 4px; margin-bottom: 2px; font-size: 11px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: inherit; }
.mini.has-crit { outline: 2px solid var(--crit, #c0392b); }
.mini.has-warn { outline: 1px dashed var(--warn); }
@media (max-width: 720px) { table.mois td { height: auto; } .mini { white-space: normal; } }

/* ---------- Alertes : actions ---------- */
.alert { grid-template-columns: auto 1fr; }
.alert .alert-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.summary .periode { display: inline-flex; gap: 6px; }
.alertes-ignorees { margin-top: 16px; }
.alertes-ignorees summary { cursor: pointer; color: var(--muted); }
.tv-url { min-width: 280px; max-width: 100%; font-family: ui-monospace, monospace; font-size: 12px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: inherit; }

/* ---------- Disponibilités : trois états ---------- */
.dispo-cell { width: 30px; height: 26px; border-radius: 5px; border: 1px solid var(--line); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; padding: 0; background: var(--surface); color: var(--muted); }
span.dispo-cell { cursor: default; width: 24px; height: 20px; font-size: 12px; vertical-align: middle; }
.dispo-cell.n-oui { background: color-mix(in srgb, var(--ok) 20%, var(--surface)); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--surface)); }
.dispo-cell.n-eviter { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--surface)); }
.dispo-cell.n-non { background: var(--crit-soft); color: var(--crit); border-color: color-mix(in srgb, var(--crit) 45%, var(--surface)); }
.legende-dispo { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.sugg-impossible { font-size: 12px; color: var(--muted); padding: 4px 8px; border: 1px dashed var(--line); border-radius: 6px; }
a.btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }
.ia-prompt { display: grid; gap: 8px; margin-top: 8px; }
.ia-prompt textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: inherit; }

/* ---------- Disponibilités de l'année ---------- */
table.dispo-annee th, table.dispo-annee td { padding: 2px 3px; text-align: center; }
table.dispo-annee tbody th { text-align: left; white-space: nowrap; font-weight: 500; font-size: 12px; color: var(--muted); }
table.dispo-annee tr.mois-sep th { text-align: left; background: var(--surface-2); color: inherit; font-weight: 700; padding: 6px 8px; }
.dispo-cell.herite { opacity: .45; border-style: dashed; }
.dispo-cell.choisi { box-shadow: inset 0 0 0 1px currentColor; }
.dispo-cell.modifie { outline: 2px solid var(--accent); outline-offset: 1px; }
.dispo-cell.n-ferie { background: var(--surface-2); color: var(--muted); border-style: dotted; }
.dispo-cell.abs { text-decoration: line-through; }

/* ---------- Salles : une salle seule ---------- */
.salle-choix { margin-bottom: 8px; }
.lien-salle { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-decoration: underline dotted; }
table.salle-seule td { vertical-align: top; }
table.salle-seule td.hors { background: var(--surface-2); }
.libre { display: block; text-align: center; font-size: 12px; font-weight: 600; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-radius: 4px; padding: 3px 0; }
.occ-via { display: block; text-align: center; font-size: 11.5px; color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; padding: 3px 2px; }
.occ .occ-sub { display: block; font-weight: 400; font-size: 11px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.salle-seule { table-layout: fixed; width: 100%; min-width: 760px; }
table.salle-seule thead tr:first-child th:first-child { width: 78px; }
table.salle-seule td { min-width: 0; }
table.salle-seule .occ { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.ia-autre > summary { cursor: pointer; color: var(--muted); }
details.ia-autre > summary h2 { display: inline; font-size: inherit; }
details.panel.ia-autre > summary { padding: 12px 16px; }
details.ia-autre > summary h2 { border: 0; padding: 0; margin: 0; }

/* Historique des modifications */
table.journal td { vertical-align: top; }
.journal-diff { margin: 0; padding-left: 16px; font-size: 13px; }
.journal-diff del { color: var(--crit); }
.journal-diff ins { color: var(--ok); text-decoration: none; }

/* ---------- Sections repliables (Disponibilités) ---------- */
details.repli > summary { cursor: pointer; list-style: none; }
details.repli > summary::-webkit-details-marker { display: none; }
details.repli > summary h2::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform .15s; }
details.repli[open] > summary h2::before { transform: rotate(90deg); }
details.repli:not([open]) > summary h2 { border-bottom: 0; }
@media (prefers-reduced-motion: reduce) { details.repli > summary h2::before { transition: none; } }
details.repli > summary h2 { justify-content: flex-start; }
details.repli > summary h2 span { margin-left: auto; }

/* Œil des champs mot de passe */
.mdp-oeil { position: relative; display: block; }
.mdp-oeil input { width: 100%; padding-right: 40px; box-sizing: border-box; }
.mdp-oeil .oeil {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  border: 0; background: none; padding: 4px 6px; color: var(--muted); cursor: pointer; line-height: 0; border-radius: 4px;
}
.mdp-oeil .oeil:hover, .mdp-oeil .oeil[aria-pressed=true] { color: var(--ink); }
.mdp-oeil .oeil:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Salles : taux par espace, vue mois ---------- */
.taux-espaces { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin: 0 0 12px; }
.taux-espace { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: baseline; }
.taux-espace .nom { font-size: 13px; font-weight: 600; }
.taux-espace strong { font-variant-numeric: tabular-nums; }
.taux-espace .jauge-taux { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.taux-espace .jauge-taux span { display: block; height: 100%; background: var(--accent); }
.taux-espace .sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.taux-espace.vide strong { color: var(--muted); font-weight: 500; }
table.rooms tr.espace-sep th { text-align: left; background: var(--surface-2); font-weight: 700; padding: 5px 10px; position: static; }
table.rooms tr.espace-sep th span { color: var(--muted); font-weight: 500; margin-left: 6px; font-variant-numeric: tabular-nums; }
table.rooms-mois { min-width: 0; }
table.rooms-mois thead th { padding: 4px 2px; font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; }
table.rooms-mois .dj-nom { display: block; font-weight: 400; color: var(--muted); font-size: 10px; }
table.rooms-mois td.m-cell { padding: 2px; cursor: pointer; vertical-align: middle; min-width: 22px; }
table.rooms-mois td.m-cell:hover { background: var(--surface-2); }
.dj { display: block; height: 10px; border-radius: 2px; margin: 1px 0; }
.legende-mois .dj { display: inline-block; width: 14px; vertical-align: middle; margin: 0 2px 0 8px; }
.dj.dj-occ { background: hsl(var(--h) 55% 50%); }
.dj.dj-occ.has-crit { outline: 2px solid var(--crit); outline-offset: -1px; }
.dj.libre { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); }
.dj.via { background: repeating-linear-gradient(135deg, var(--muted) 0 2px, transparent 2px 4px); opacity: .6; }
.dj.bloque { background: transparent; }

/* ---------- Fiche d'un cours, sélection multiple ---------- */
.br-form .cc-cours, .br-form .cc-location { display: contents; }
.br-form .cc-cours[hidden], .br-form .cc-location[hidden] { display: none; }
.seg-radio { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.seg-radio label { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; text-transform: none; letter-spacing: 0; }
.br-form input[name="matiereNouvelle"] { margin-top: 6px; }
.outils-planning { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; margin: 0 0 10px; }
.selection-barre { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border: 2px solid var(--accent); border-radius: 8px; padding: 8px 12px; }
.selection-barre .field { margin: 0; }
.course.sel, .mini.sel { outline: 3px solid var(--accent); outline-offset: -1px; position: relative; }
.course.sel::after { content: "✓"; position: absolute; top: 2px; right: 4px; font-weight: 700; color: var(--accent); }
.grp-eff { width: 3.5em; padding: 1px 4px; font: inherit; font-size: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: inherit; }
li.renommer .form-renommer { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
li.renommer .form-renommer input { flex: 1; min-width: 160px; padding: 3px 6px; font: inherit; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: inherit; }
.br-form .seg-radio label, .br-form .field label.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; font-weight: 500; text-transform: none; letter-spacing: 0; color: inherit; margin: 4px 0 0; }
.br-form .seg-radio input, .br-form label.check input { width: auto; }

/* ---------- Jours fériés et congés ---------- */
.week .head.ferme, .week .cell.ferme, table.mois td.ferme, table.rooms td.ferme, table.rooms th.ferme {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 8px 16px);
  color: var(--muted);
}
.ferme-lib { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
.week .cell.ferme .empty-slot.ferme-lib { text-align: center; padding-top: 12px; }
table.rooms-mois td.m-cell.ferme .dj.libre { background: transparent; }
.conge-form { padding: 4px 14px 10px; }
.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); }
.btn.danger:hover:not(:disabled) { background: var(--crit-soft); }
.occ.sel { outline: 3px solid var(--accent); outline-offset: -1px; }
.selection-barre { display: grid; gap: 8px; }
.selection-barre .sel-entete { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.selection-barre .sel-fin { margin-left: auto; display: inline-flex; gap: 6px; }
.selection-barre .sel-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.selection-barre .sel-groupe { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: end; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px 8px; margin: 0; }
.selection-barre .sel-groupe legend { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 4px; }
.selection-barre .sel-danger { border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); }
.selection-barre .sel-danger legend { color: var(--crit); }

/* ---------- Filtre à choix multiple (diplômes, intervenants, salles) ---------- */
.multi-filtre { position: relative; }
.multi-filtre > summary { list-style: none; cursor: pointer; min-width: 220px; max-width: 360px; padding: 7px 30px 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.multi-filtre > summary::-webkit-details-marker { display: none; }
.multi-filtre > summary::after { content: "▾"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.multi-filtre .multi-liste { position: absolute; right: 0; z-index: 20; margin-top: 4px; width: min(340px, 90vw); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 8px; display: grid; gap: 6px; }
.multi-filtre #filtre-multi-options { max-height: 300px; overflow-y: auto; display: grid; }
.multi-filtre .multi-opt { display: flex; gap: 8px; align-items: center; padding: 3px 4px; border-radius: 4px; font-size: 14px; text-transform: none; letter-spacing: 0; color: inherit; font-weight: 400; cursor: pointer; }
.multi-filtre .multi-opt:hover { background: var(--surface-2); }
.multi-filtre .multi-opt input { width: auto; }
.multi-filtre .multi-opt[hidden] { display: none; }
.multi-filtre .multi-actions { display: flex; gap: 6px; justify-content: flex-end; }
#filtre-multi-recherche { width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: var(--surface); color: inherit; }
