:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --ink: #16212b;
  --ink-2: #4a5b69;
  --ink-3: #7a8a97;
  --line: #dbe2e8;
  --brand: #0e7490;
  --brand-ink: #ffffff;
  --brand-soft: #d9f0f6;
  --ok: #15803d;
  --ok-soft: #dcf5e4;
  --warn: #b45309;
  --warn-soft: #fdecc8;
  --bad: #b91c1c;
  --bad-soft: #fde1e1;
  --shadow: 0 1px 2px rgba(16, 33, 43, .06), 0 4px 14px rgba(16, 33, 43, .06);
  --radius: 12px;
  --tab-h: 62px;
  --head-h: 54px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f171d; --surface: #17222a; --surface-2: #1e2c36; --ink: #e8eef2; --ink-2: #aebcc6; --ink-3: #7f909c; --line: #2b3b47;
  --brand: #38bdf8; --brand-ink: #06222f; --brand-soft: #123546;
  --ok: #4ade80; --ok-soft: #12361f; --warn: #fbbf24; --warn-soft: #3b2e0e; --bad: #f87171; --bad-soft: #3e1717;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f171d; --surface: #17222a; --surface-2: #1e2c36; --ink: #e8eef2; --ink-2: #aebcc6; --ink-3: #7f909c; --line: #2b3b47;
    --brand: #38bdf8; --brand-ink: #06222f; --brand-soft: #123546;
    --ok: #4ade80; --ok-soft: #12361f; --warn: #fbbf24; --warn-soft: #3b2e0e; --bad: #f87171; --bad-soft: #3e1717;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--brand); }
:where(svg[aria-hidden="true"]) { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.liste td svg { width: 18px; height: 18px; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ----- structure ----- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--head-h); display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.content { flex: 1; padding: 14px 14px calc(var(--tab-h) + 24px); max-width: 1500px; width: 100%; margin: 0 auto; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: var(--tab-h); display: flex;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a, .tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem;
  color: var(--ink-3); text-decoration: none; background: none; border: 0; cursor: pointer; position: relative; min-width: 0; padding: 4px 2px;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar .actif { color: var(--brand); font-weight: 600; }
.pastille {
  position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center;
}
@media (min-width: 900px) {
  #app { flex-direction: row; }
  .shell { display: flex; flex-direction: column; flex: 1; min-width: 0; }
  .tabbar {
    position: sticky; top: 0; height: 100vh; width: 220px; flex: none; flex-direction: column; justify-content: flex-start; border-top: 0; border-right: 1px solid var(--line);
    padding: 12px 10px; gap: 2px; align-self: flex-start;
    height: 100dvh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  }
  .tabbar a, .tabbar button { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: .95rem; padding: 10px 12px; border-radius: 10px; }
  .tabbar .actif { background: var(--brand-soft); }
  .tabbar .titre-menu { display: block; }
  .pastille { position: static; margin-left: auto; }
  .content { padding-bottom: 40px; }
  .mobile-seulement { display: none !important; }
}
@media (max-width: 899px) { .bureau-seulement { display: none !important; } .tabbar .titre-menu { display: none; } }

/* ----- composants ----- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.card + .card, .stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.icon-btn { width: 42px; height: 42px; padding: 0; position: relative; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
label.champ { display: block; margin-bottom: 12px; }
label.champ > span { display: block; font-size: .85rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=email], input[type=tel], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
textarea { min-height: 80px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.alert { padding: 10px 12px; border-radius: 10px; margin: 10px 0; background: var(--surface-2); }
.alert.bad { background: var(--bad-soft); color: var(--bad); } .alert.warn { background: var(--warn-soft); color: var(--warn); } .alert.ok { background: var(--ok-soft); color: var(--ok); }
.vide { text-align: center; color: var(--ink-3); padding: 28px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: .85rem; border: 1px solid transparent; cursor: pointer; }
.chip.actif { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 8px 12px; cursor: pointer; min-height: 40px; }
@media (max-width: 560px) { .seg button { padding: 8px 9px; font-size: .88rem; } }
.seg button.actif { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: tourne .8s linear infinite; display: inline-block; }
@keyframes tourne { to { transform: rotate(360deg); } }
.toast-zone { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + 14px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 92vw; pointer-events: auto; }
.toast.bad { background: var(--bad); color: #fff; }

/* ----- fenêtres ----- */
.voile { position: fixed; inset: 0; z-index: 60; background: rgba(8, 20, 28, .5); display: flex; align-items: flex-end; justify-content: center; }
.fenetre {
  background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.fenetre.large { max-width: 980px; }
.fenetre header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.fenetre header h2 { flex: 1; }
.fenetre .corps { padding: 16px; overflow: auto; flex: 1; }
.fenetre footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@media (min-width: 700px) { .voile { align-items: center; } .fenetre { border-radius: 18px; } }

/* ----- planning ----- */
.semaine-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.semaine-nav h1 { font-size: 1.1rem; min-width: 0; }
.barre-outils { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.couverture { overflow-x: auto; margin-bottom: 14px; }
.couverture table { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 560px; }
.couverture th { font-size: .75rem; color: var(--ink-3); font-weight: 600; text-align: center; padding: 2px; }
.couverture th.lib { text-align: left; white-space: nowrap; }
.couverture td { text-align: center; border-radius: 8px; padding: 6px 2px; font-weight: 700; font-size: .85rem; background: var(--surface-2); min-width: 44px; }
.couverture td.ok { background: var(--ok-soft); color: var(--ok); } .couverture td.bad { background: var(--bad-soft); color: var(--bad); cursor: pointer; }
.couverture td.sur { background: var(--warn-soft); color: var(--warn); } .couverture td.nul { background: transparent; color: var(--ink-3); font-weight: 400; }
.grille-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-height: calc(100vh - 220px); }
table.grille { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 860px; }
.grille th, .grille td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 3px; vertical-align: top; }
.grille thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); font-size: .8rem; padding: 6px 4px; }
.grille th.agent, .grille td.agent { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 150px; max-width: 190px; border-right: 2px solid var(--line); }
.grille thead th.agent { z-index: 4; background: var(--surface-2); }
.grille tr.groupe td { background: var(--surface-2); font-weight: 700; font-size: .8rem; padding: 4px 8px; position: sticky; left: 0; }
.grille td.jour { min-width: 104px; height: 52px; cursor: pointer; }
.grille td.jour:hover { background: var(--brand-soft); }
.grille td.we { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.grille th.aujourdhui { background: var(--brand); color: var(--brand-ink); }
.grille .ferie { color: var(--warn); font-size: .7rem; display: block; font-weight: 600; }
.agent .nom { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.agent .nom span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent .heures { font-size: .75rem; color: var(--ink-3); }
.agent .heures.sup { color: var(--warn); font-weight: 700; } .agent .heures.moins { color: var(--ink-3); }
.pilule {
  display: flex; align-items: center; gap: 4px; border-radius: 7px; padding: 3px 6px; font-size: .78rem; font-weight: 600; color: #fff; margin: 1px 0;
  border-left: 4px solid rgba(0,0,0,.25); line-height: 1.2; cursor: pointer; width: 100%; text-align: left; border-top: 0; border-right: 0; border-bottom: 0;
}
.pilule small { font-weight: 400; opacity: .92; font-size: .72rem; }
.pilule.alerte { outline: 2px solid var(--bad); outline-offset: 1px; }
.pilule.brouillon { opacity: .9; }
.absent { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 6px, var(--surface) 6px, var(--surface) 12px); border-radius: 7px; font-size: .72rem; color: var(--ink-2); padding: 3px 6px; margin: 1px 0; }
.absent.attente { outline: 1px dashed var(--warn); }
.nb-alertes { background: var(--bad); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 6px; font-weight: 700; }
.jours-onglets { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.jours-onglets button {
  flex: 1; min-width: 46px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 2px; cursor: pointer; text-align: center; line-height: 1.2;
}
.jours-onglets button b { display: block; font-size: 1.05rem; }
.jours-onglets button span { font-size: .72rem; color: var(--ink-3); text-transform: capitalize; }
.jours-onglets button.actif { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.jours-onglets button.actif span { color: inherit; }
.jours-onglets button.aujourdhui:not(.actif) { border-color: var(--brand); }
.bloc-service { margin-bottom: 14px; }
.bloc-service > header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 700; }
.ligne-agent { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; cursor: pointer; width: 100%; text-align: left; }
.ligne-agent.moi { border-color: var(--brand); background: var(--brand-soft); }
.mini-fn { font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; color: #fff; }
.manque-ligne { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--bad); color: var(--bad); border-radius: 10px; margin-bottom: 6px; background: var(--bad-soft); cursor: pointer; width: 100%; text-align: left; }

/* ----- mon planning ----- */
.jour-carte { display: flex; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.jour-carte.aujourdhui { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.jour-carte .date { width: 52px; text-align: center; flex: none; }
.jour-carte .date b { display: block; font-size: 1.4rem; line-height: 1; }
.jour-carte .date span { font-size: .72rem; text-transform: uppercase; color: var(--ink-3); }
.jour-carte.repos { background: transparent; border-style: dashed; color: var(--ink-3); }
.jour-carte .garde { border-left: 5px solid var(--brand); padding: 4px 10px; margin-bottom: 6px; border-radius: 4px; background: var(--surface-2); }
.jour-carte .garde b { font-size: 1.02rem; }

/* ----- tableaux de gestion ----- */
table.liste { width: 100%; border-collapse: collapse; }
.liste th { text-align: left; font-size: .78rem; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.liste td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.liste tr.cliquable { cursor: pointer; } .liste tr.cliquable:hover { background: var(--surface-2); }
.liste .nombre { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.matrice { border-collapse: collapse; }
.matrice th, .matrice td { padding: 4px 6px; text-align: center; border: 1px solid var(--line); }
.matrice td input { width: 56px; min-height: 38px; text-align: center; padding: 4px; }
.matrice th { background: var(--surface-2); font-size: .78rem; }
.matrice td.lib { text-align: left; font-weight: 600; white-space: nowrap; background: var(--surface-2); }
.voeux-grille { border-collapse: collapse; width: 100%; }
.voeux-grille td, .voeux-grille th { border: 1px solid var(--line); padding: 2px; text-align: center; }
.voeux-grille button { width: 100%; min-height: 40px; border: 0; background: var(--surface); cursor: pointer; border-radius: 6px; font-size: .78rem; }
.voeux-grille button.non { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.voeux-grille button.pref { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); transition: width .4s; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.login-box { width: 100%; max-width: 390px; }
.login-box .logo { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; }
.notif { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif.nonlu { background: var(--brand-soft); }
.notif b { display: block; }
pre.code { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow: auto; font-size: .9rem; }
.code-affiche { font: 700 1.5rem/1 ui-monospace, Consolas, monospace; letter-spacing: .08em; padding: 14px; text-align: center; background: var(--surface-2); border-radius: 10px; user-select: all; }

/* ----- glisser-déposer ----- */
.fantome { position: fixed; z-index: 90; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: .85rem; box-shadow: var(--shadow); opacity: .92; }
.glisse-cible { outline: 3px solid var(--brand); outline-offset: -3px; background: var(--brand-soft) !important; }
.glisse-peint { background: var(--ok-soft) !important; outline: 2px dashed var(--ok); outline-offset: -2px; }
.glisse-origine { opacity: .35; }
.pilule.arme, td.arme { transform: scale(1.06); box-shadow: 0 4px 12px rgba(0,0,0,.35); position: relative; z-index: 5; }
.pilule.selectionne { outline: 3px solid var(--brand); outline-offset: 1px; }
.pilule.propose { border: 2px dashed rgba(255,255,255,.85); border-left-width: 4px; }
.pilule.propose.manuel { box-shadow: 0 0 0 2px var(--brand); }
.pilule.fixe { opacity: .55; cursor: default; }
.pilule { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.grille-wrap { user-select: none; -webkit-user-select: none; }
.barre-selection { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 14px); display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; box-shadow: var(--shadow); }
@media (min-width: 900px) { .barre-selection { bottom: 20px; } }

/* ----- feuille de vœux (comme resto) ----- */
.grille-voeux { border-collapse: collapse; user-select: none; -webkit-user-select: none; }
.grille-voeux th, .grille-voeux td { border: 1px solid var(--line); text-align: center; font-size: .72rem; }
.grille-voeux th { background: var(--surface-2); cursor: pointer; padding: 2px 5px; font-weight: 600; white-space: nowrap; }
.grille-voeux th:hover { background: var(--brand-soft); }
.grille-voeux td { min-width: 27px; height: 30px; cursor: pointer; background: var(--surface); touch-action: none; }
.grille-voeux td.indispo { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.grille-voeux td.prefere { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.grille-voeux .jc { display: none; }
@media (max-width: 700px) { .grille-voeux .jl { display: none; } .grille-voeux .jc { display: inline; } .grille-voeux td { min-width: 38px; height: 26px; } }
.pinceau.actif { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); font-weight: 700; }
.choix label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; cursor: pointer; background: var(--surface); }
.choix label.sel { border-color: var(--brand); background: var(--brand-soft); }
.choix input { margin-top: 4px; accent-color: var(--brand); }
.heure-voeu { display: flex; gap: 4px; align-items: center; }
.effacer-heure { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 36px; min-height: 44px; cursor: pointer; font-size: 1.1rem; }
.astuce-voeux { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: .9rem; }
.voeux-grille { border-collapse: collapse; width: 100%; }
.voeux-grille td, .voeux-grille th { border: 1px solid var(--line); padding: 2px; text-align: center; }
.voeux-grille button { width: 100%; min-height: 40px; border: 0; background: var(--surface); cursor: pointer; border-radius: 6px; font-size: .78rem; }
.voeux-grille button.non { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.voeux-grille button.pref { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
th.tri { cursor: pointer; user-select: none; white-space: nowrap; } th.tri:hover { color: var(--brand); }
th.tri .fleche { margin-left: 5px; font-size: .65rem; color: var(--ink-3); opacity: .6; } th.tri.actif .fleche { color: var(--brand); opacity: 1; font-size: .72rem; }
th.tri.nombre { text-align: right; }
/* impression de la feuille des vœux */
body.impr-voeux #app > *:not(.shell), body.impr-voeux .topbar, body.impr-voeux .tabbar, body.impr-voeux .barre-outils, body.impr-voeux .no-impr { display: none !important; }

/* ----- alertes (page Demandes) et anomalies du planning ----- */
.titre-section { margin: 22px 0 8px; font-size: 1.1rem; }
.alerte-bloc { border-left: 6px solid var(--line); }
.alerte-bloc.rouge { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad-soft) 55%, var(--surface)); }
.alerte-bloc.orange { border-left-color: var(--warn); }
.alerte-bloc.ok-bord { border-left-color: var(--ok); }
.grille td.jour.erreur { background: var(--bad-soft) !important; box-shadow: inset 0 0 0 2px var(--bad); }
.grille td.jour.conflit { background: var(--bad-soft) !important; box-shadow: inset 0 0 0 2px var(--bad); }
.grille th.manque { background: var(--bad) !important; color: #fff; }
.grille tr.agent-erreur td.agent .nom span:first-of-type { color: var(--bad); }
.pilule.alerte { outline: 3px solid var(--bad); outline-offset: 0; background-image: linear-gradient(rgba(185,28,28,.55), rgba(185,28,28,.55)); }
.pilule.alerte::after { content: '⚠'; margin-left: auto; font-size: .8rem; }
.verrou-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font-size: .7rem; padding: 1px 6px; cursor: pointer; margin-top: 3px; }
.verrou-btn.actif { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); font-weight: 700; }
.jours-onglets button.manque { border-color: var(--bad); }
.jours-onglets button.manque b { color: var(--bad); }
.jours-onglets button.manque.actif b { color: inherit; }

/* ----- connexion simplifiée (démonstration) ----- */
.login-large { width: 100%; max-width: 760px; }
.login-large .logo { width: 48px; height: 48px; margin: 0 auto 8px; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tuile-perso { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; text-align: center; min-height: 112px; }
.tuile-perso:hover, .tuile-perso:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.tuile-nom { font-weight: 600; font-size: .85rem; line-height: 1.15; }
.tuile-fn { font-size: .7rem; color: var(--ink-3); }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.05rem; }
.avatar.grand { width: 72px; height: 72px; font-size: 1.6rem; }
.pin-points { display: flex; justify-content: center; gap: 16px; margin: 10px 0 4px; }
.pin-points span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand); }
.pin-points span.plein { background: var(--brand); }
.pin-points.secoue { animation: secoue .35s; }
@keyframes secoue { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.clavier { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.clavier button { min-height: 62px; font-size: 1.5rem; font-weight: 600; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.clavier button:active { background: var(--brand-soft); }
.clavier .autre { color: var(--ink-3); font-size: 1.2rem; }

.scan-photo { text-align: center; padding: 14px 8px; background: var(--surface-2); border-radius: 12px; }
.gros-scan { width: 100%; min-height: 76px; font-size: 1.25rem; }
.scan-photo .scan-etat { position: static; background: none; color: var(--ink-2); padding: 8px 0 0; font-size: .9rem; }

/* ----- bon de remise imprimé ----- */
.feuille-bon { display: none; }
@media print {
  body.impr-bon #app, body.impr-bon .voile, body.impr-bon .toast-zone { display: none !important; }
  body.impr-bon .feuille-bon { display: block; font-size: 11pt; color: #000; background: #fff; }
  .feuille-bon table { width: 100%; border-collapse: collapse; margin-top: 8px; }
  .feuille-bon th, .feuille-bon td { border: 1px solid #000; padding: 4px 6px; text-align: left; }
}

@media print {
  body.impr-etiq #app, body.impr-etiq .voile, body.impr-etiq .toast-zone { display: none !important; }
  body.impr-etiq .feuille-etiquettes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm; }
  body.impr-etiq { background: #fff; color: #000; }
  .etiquette { border: 1px dashed #000; padding: 3mm; display: flex; gap: 3mm; align-items: center; break-inside: avoid; font-size: 9pt; }
  .etiq-qr svg { width: 24mm; height: 24mm; display: block; }
}

@media print {
  .topbar, .tabbar, .barre-outils, .semaine-nav button, .toast-zone, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .content { padding: 0; max-width: none; }
  .grille-wrap { max-height: none; overflow: visible; border: 0; }
  table.grille { min-width: 0; font-size: 9px; }
  .grille th.agent, .grille td.agent { position: static; }
  .pilule { color: #000 !important; background: #fff !important; border: 1px solid #000; border-left-width: 4px; }
  .grille thead th { position: static; }
}

/* photos des articles */
.photo-article { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; background: #fff; }
.photo-article.grande { width: auto; max-width: 100%; height: auto; max-height: 220px; cursor: zoom-in; }
.photo-article[hidden] { display: none; }

/* cadre de sélection à la souris */
.selection-rect { position: fixed; z-index: 80; pointer-events: none; border: 2px dashed var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); border-radius: 4px; }
.pilule.survol { outline: 2px dashed var(--brand); outline-offset: 1px; }
body.geste-sans-texte { user-select: none; -webkit-user-select: none; }

/* ---- boutons d'aide (?, urgence, assistance, remarque) ---- */
.fabs { position: fixed; z-index: 35; right: 12px; bottom: calc(var(--tab-h) + 12px); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.fab { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem; font-weight: 700; cursor: pointer; text-decoration: none; padding: 0; }
.fab[hidden] { display: none; }
.fab-aide { background: #b8860b; border-color: #b8860b; color: #fff; font-size: 1.25rem; }
.fab-urgence { background: #dc2626; border-color: #dc2626; color: #fff; font-size: 1.3rem; }
.fab-lanceur { display: none; background: var(--brand); border-color: var(--brand); color: #fff; font-size: 1.3rem; }
@media (min-width: 900px) { .fabs { bottom: 16px; } }
@media (max-width: 899px) {
  .fab-lanceur { display: inline-flex; }
  .fabs .fab:not(.fab-lanceur) { display: none; }
  body.fabs-ouverts .fabs .fab:not(.fab-lanceur):not([hidden]) { display: inline-flex; }
}
.urgence-numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.urgence-num { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2, var(--surface)); color: var(--ink); text-decoration: none; }
.urgence-num .n { font-size: 1.6rem; font-weight: 800; color: #dc2626; min-width: 52px; text-align: center; }
.urgence-infos { margin-top: 12px; display: grid; gap: 6px; padding: 10px 12px; border-left: 5px solid #dc2626; background: var(--surface-2, var(--surface)); border-radius: 8px; }
.urgence-consigne { border-bottom: 1px solid var(--line); padding: 6px 0; }
.urgence-consigne summary { cursor: pointer; font-weight: 600; }
.urgence-consigne p { margin: 6px 0 2px; line-height: 1.5; }

/* ---- mode entraînement ---- */
.bandeau-entrainement { background: #f59e0b; color: #1f1300; padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-size: .9rem; position: sticky; top: 0; z-index: 45; }
.bandeau-entrainement .btn { min-height: 32px; padding: 2px 10px; }
body.entrainement .topbar { box-shadow: 0 2px 0 #f59e0b; }

/* ---- bulles d'aide ---- */
.bulle-aide { position: fixed; z-index: 120; max-width: 300px; background: var(--ink); color: var(--bg); padding: 8px 11px; border-radius: 9px; font-size: .85rem; line-height: 1.35; box-shadow: var(--shadow); pointer-events: none; }

/* ---- visite guidée ---- */
.visite-calque { position: fixed; inset: 0; z-index: 110; }
.visite-voile { position: fixed; background: rgba(0, 0, 0, .55); }
.visite-trou { position: fixed; border: 3px solid #f59e0b; border-radius: 10px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); pointer-events: none; }
.visite-calque.sans-cible { background: rgba(0, 0, 0, .55); }
.visite-carte { position: fixed; width: min(360px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); z-index: 2; }
.visite-carte h3 { margin: 2px 0 6px; }
.visite-carte p { margin: 0 0 10px; line-height: 1.5; }
.visite-etape { font-size: .75rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.visite-boutons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- page d'aide ---- */
.aide-section { margin-bottom: 14px; scroll-margin-top: 70px; }
.aide-section:target { outline: 3px solid #f59e0b; outline-offset: 2px; }
.aide-sommaire { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.aide-gestes { margin: 0; padding-left: 22px; line-height: 1.6; }
.aide-faq { border-bottom: 1px solid var(--line); padding: 8px 0; }
.aide-faq summary { cursor: pointer; font-weight: 600; }
.aide-faq p { margin: 6px 0 2px; line-height: 1.5; }
mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---- fiche mémo imprimée ---- */
.feuille-memo { display: none; }
@media print {
  body.impr-memo > *:not(.feuille-memo) { display: none !important; }
  body.impr-memo .feuille-memo { display: block; color: #000; background: #fff; padding: 8mm; font-size: 11pt; }
  .feuille-memo h1 { font-size: 18pt; margin: 0 0 4mm; } .feuille-memo h2 { font-size: 13pt; margin: 4mm 0 1mm; } .feuille-memo ul { margin: 0; padding-left: 5mm; }
}

/* ---- procédures (aide-mémoire médical) ---- */
.proc-carte { padding: 0; }
.proc-carte > summary { cursor: pointer; padding: 12px 14px; list-style: none; }
.proc-carte > summary::-webkit-details-marker { display: none; }
.proc-corps { padding: 0 14px 14px; display: grid; gap: 10px; }
.proc-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.proc-bloc { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface-2, var(--surface)); }
.proc-bloc h4 { margin: 0 0 4px; font-size: .95rem; }
.proc-bloc ul { margin: 0; padding-left: 20px; line-height: 1.5; }
.proc-bloc li { margin: 3px 0; }
.proc-bloc.alerte { border-left: 5px solid #dc2626; }
.proc-bloc.as { border-left: 5px solid #0d9488; }
.proc-bloc.ide { border-left: 5px solid #7c3aed; }
.proc-bloc.appel { border-left: 5px solid #2563eb; }
.proc-bloc.vigilance { border-left: 5px solid #f59e0b; background: color-mix(in srgb, #f59e0b 10%, var(--surface)); }
.proc-bloc.etab { border-left: 5px solid var(--brand); }
.proc-med { font-weight: 600; }
.proc-med .badge { font-weight: 600; }

/* ---- statistiques ---- */
.stats-tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.stats-colonnes { display: flex; align-items: flex-end; gap: 4px; height: 170px; overflow-x: auto; padding-bottom: 2px; }
.stats-col { flex: 1 0 28px; max-width: 70px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; }
.stats-col-barre { width: 100%; flex: 1; display: flex; align-items: flex-end; }
.stats-col-barre > div { width: 100%; border-radius: 4px 4px 0 0; min-height: 2px; }
.stats-col-val, .stats-col-lib { white-space: nowrap; }

/* ---- événements, rappels, surveillance, check-lists ---- */
.ligne-soin { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.ligne-soin:first-child { border-top: 0; }
.releve-retard { background: color-mix(in srgb, #dc2626 10%, var(--surface)); }
.releve-fait { opacity: .7; }
.checklist-point { padding: 8px 0; border-top: 1px solid var(--line); }
.checklist-point.anomalie { background: color-mix(in srgb, #f59e0b 12%, var(--surface)); }

/* lien mentions légales (menu et connexion) */
.tabbar a.lien-legal { margin-top: auto; font-size: .8rem; opacity: .75; }
.lien-legal-connexion { display: block; text-align: center; margin-top: 10px; font-size: .8rem; }

/* impression générique : listes et tableaux lisibles sur papier */
.entete-impr { display: none; }
@media print {
  body:not([class*="impr-"]) .fabs, body:not([class*="impr-"]) .bandeau-entrainement, body:not([class*="impr-"]) .no-impr { display: none !important; }
  body:not([class*="impr-"]) .entete-impr { display: block; font-weight: 700; font-size: 12pt; margin-bottom: 6mm; }
  body:not([class*="impr-"]) .table-scroll { overflow: visible !important; }
  body:not([class*="impr-"]) table.liste { font-size: 9pt; }
  body:not([class*="impr-"]) .card { box-shadow: none; border: 0; padding: 0; }
  body:not([class*="impr-"]) .shell { display: block; }
}
