/* Écran prénom → planning de la semaine (5 salles en colonnes) + panneau de réservation ; back-office en cartes. */
:root {
  --bg: #F2F5F6;
  --surface: #FFFFFF;
  --ink: #142128;
  --muted: #586970;
  --line: #D8E0E3;
  --accent: #1D5E86;
  --accent-soft: #E0ECF4;
  --on-accent: #FFFFFF;
  --other: #ECE9F6;
  --other-ink: #463B78;
  --other-line: #C9C1EA;
  --lock: #E9ECEE;
  --lock-ink: #46555B;
  --lock-stripe: #CBD3D7;
  --draft: #FFF4D6;
  --draft-line: #D9A520;
  --ok: #1E7449;
  --ok-soft: #E2F2E9;
  --no: #B0261E;
  --no-soft: #FBE7E5;
  --now: #D3480F;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --hour: 46px;
  --hours: 13;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E161A; --surface: #162127; --ink: #E5EDF0; --muted: #98A9B0; --line: #2A3940;
    --accent: #72B4DF; --accent-soft: #1B3446; --on-accent: #0E161A;
    --other: #27233D; --other-ink: #CFC6F4; --other-line: #463F6B;
    --lock: #1F2A2F; --lock-ink: #AEBCC2; --lock-stripe: #33434A;
    --draft: #3A3014; --draft-line: #E0B23C;
    --ok: #6CCB98; --ok-soft: #163226; --no: #F28E86; --no-soft: #3B1C1A; --now: #FF8B4D;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
.wrap {
  max-width: 1280px; margin: 0 auto;
  padding-top: max(20px, env(safe-area-inset-top, 0px));
  padding-bottom: max(40px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 16px;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.stack { display: grid; gap: 12px; width: 100%; }
.stack16 { display: grid; gap: 16px; }
.start { justify-self: start; }
.loading { color: var(--muted); margin: 0; }

header.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
.brand h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 4vw, 34px); letter-spacing: -0.02em; line-height: 1.1; margin: 0; text-wrap: balance; }
.brand p { margin: 4px 0 0; color: var(--muted); }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.who b { color: var(--ink); font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.linkbtn { border: 0; background: none; color: var(--accent); padding: 2px 4px; font-size: 13.5px; text-decoration: underline; text-underline-offset: 2px; }
.gate .linkbtn { padding: 0; }
.muted { color: var(--muted); font-size: 14px; }

.gate { justify-self: center; width: 100%; max-width: 440px; margin-top: 5vh; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; display: grid; gap: 12px; justify-items: start; }
.gate h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.gate p { margin: 0; }
.lock-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.inline { display: flex; gap: 8px; width: 100%; }
.inline input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; }
.err { color: var(--no); background: var(--no-soft); border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 100%; margin: 0; }

.layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 920px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 14px 16px 10px; }
.panel-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 19px; margin: 0; letter-spacing: -0.01em; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }
.sw.other { background: var(--other); border-color: var(--other-line); }
.sw.mine { background: var(--accent); border-color: var(--accent); }
.sw.lock { background: var(--lock); background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--lock-stripe) 3px 4px); }

.week { display: flex; align-items: center; gap: 8px; padding: 0 16px 8px; }
.week b { font-weight: 600; font-size: 14.5px; flex: 1; min-width: 0; }
.week .vac { font-size: 12px; color: var(--muted); font-weight: 500; }
.navbtn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink); }
.navbtn:disabled { opacity: 0.35; cursor: default; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; padding: 0 16px 12px; }
.day { display: grid; gap: 2px; justify-items: center; background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 6px 2px 7px; min-width: 0; }
.day .dw { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.day .dn { font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.day .occ { width: 70%; max-width: 40px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.day .occ i { display: block; height: 100%; background: var(--muted); }
.day.past { opacity: 0.45; }
.day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); opacity: 1; }
.day[aria-pressed="true"] .dw, .day[aria-pressed="true"] .dn { color: var(--on-accent); }
.day[aria-pressed="true"] .occ { background: color-mix(in srgb, var(--on-accent) 35%, transparent); }
.day[aria-pressed="true"] .occ i { background: var(--on-accent); }

.board-scroll { overflow-x: auto; border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; }
.board { min-width: 500px; display: grid; grid-template-columns: 48px repeat(var(--rooms), minmax(0, 1fr)); }
.corner { border-bottom: 1px solid var(--line); }
.room-h { padding: 10px 8px 8px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; font-weight: 600; font-size: 14px; }
.hours { position: relative; height: calc(var(--hour) * var(--hours)); }
.hours span { position: absolute; right: 8px; transform: translateY(-50%); font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col { position: relative; height: calc(var(--hour) * var(--hours)); border-left: 1px solid var(--line); background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); background-size: 100% var(--hour); cursor: cell; }
.col:hover { background-color: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.blk { position: absolute; left: 4px; right: 4px; border-radius: 6px; padding: 3px 6px; font-size: 12px; line-height: 1.3; overflow: hidden; border: 1px solid transparent; text-align: left; }
.blk b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk em { font-style: normal; font-family: var(--font-mono); font-size: 11px; opacity: 0.85; }
.blk.other { background: var(--other); color: var(--other-ink); border-color: var(--other-line); }
.blk.mine { background: var(--accent); color: var(--on-accent); }
.blk.lock { background: var(--lock); color: var(--lock-ink); border-color: var(--lock-stripe); background-image: repeating-linear-gradient(135deg, transparent 0 7px, var(--lock-stripe) 7px 8px); }
.blk.draft { background: var(--draft); color: var(--ink); border: 1.5px dashed var(--draft-line); pointer-events: none; z-index: 1; }
.blk.draft.clash { border-color: var(--no); background: var(--no-soft); }
.blk.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.blk.flash { animation: flash 1.6s ease-out 1; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 var(--accent); } 40% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.nowline { position: absolute; left: 0; right: 0; border-top: 2px solid var(--now); z-index: 2; pointer-events: none; }

.side { display: grid; }
@media (min-width: 921px) { .side { position: sticky; top: 16px; } }
.side-body { padding: 4px 16px 16px; display: grid; gap: 14px; }
.side-body p { margin: 0; }
.field { display: grid; gap: 5px; min-width: 0; }
.lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.field select, .field input[type="text"] { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%; min-width: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 420px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 13px; font-size: 14px; }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.dayline { font-weight: 600; font-size: 15.5px; }
.status { border-radius: 10px; padding: 10px 12px; font-size: 14px; display: grid; gap: 8px; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.no { background: var(--no-soft); color: var(--no); }
.status .alts { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--accent); background: var(--surface); color: var(--accent); border-radius: 999px; padding: 4px 11px; font-size: 13px; }
.chip:hover { background: var(--accent-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 9px 16px; font-weight: 600; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
.btn.danger { background: var(--no); color: var(--surface); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.detail { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14.5px; margin: 0; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.list > li > button { width: 100%; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; border: 0; background: transparent; padding: 7px 8px; border-radius: 8px; text-align: left; font-size: 14px; }
.list > li > button:hover { background: var(--bg); }
.list em { font-style: normal; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); flex: 0 0 auto; }

.admin { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 920px) { .admin { grid-template-columns: minmax(0, 1fr); } }
.admin .wide { grid-column: 1 / -1; }
.card-body { padding: 4px 16px 16px; display: grid; gap: 12px; }
.card-body > p { margin: 0; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rule { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.rule .what { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.rule .what b { font-weight: 600; }
.rule .what span { color: var(--muted); font-size: 13.5px; }
.rule .what .warn { color: var(--no); font-size: 13px; }
.ruleform { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 12px; }
.h3 { margin: 0; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 14px; }
.person button { border: 0; background: none; color: var(--muted); min-width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 14px; line-height: 1; padding: 0 5px; }
.person button:hover { background: var(--no-soft); color: var(--no); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.num { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.holidays { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.holidays li { display: flex; justify-content: space-between; gap: 10px; }
.holidays em { font-style: normal; color: var(--muted); font-family: var(--font-mono); font-size: 13px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); z-index: 20; box-shadow: 0 6px 20px color-mix(in srgb, var(--ink) 25%, transparent); }
@media (prefers-reduced-motion: reduce) { .blk.flash { animation: none; } }
