/* Module B : horaire (administration). Grille par employé, grille chronologique par jour
   (reprise de l'outil « Horaire et masse salariale ») et fenêtre de quart. */

/* ---------- Barre d'outils et commandes ---------- */
.sch-toolbar{margin-bottom:14px}
.sch-count{display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:var(--stripe);font-size:11.5px;font-weight:600}
.sch-seg{display:inline-flex;flex-wrap:wrap;gap:2px;padding:2px;border:1px solid var(--line-strong);border-radius:9px;background:var(--surface)}
.sch-seg button{border:0;background:transparent;font-weight:600;font-size:13px;padding:5px 11px;border-radius:7px;cursor:pointer;color:var(--muted);min-height:30px;white-space:nowrap}
.sch-seg button:hover{color:var(--ink);background:var(--sunk)}
.sch-seg button[aria-pressed="true"]{background:var(--accent-soft);color:var(--accent)}
.sch-state{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin-bottom:12px}
.sch-busy{position:fixed;right:16px;bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:40;background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:999px;padding:6px 12px;font-size:12.5px;color:var(--muted)}
.sch-help{font-size:12.5px;color:var(--muted)}
.sch-help-touch{display:none}
/* Écran tactile sans souris : les barres ne se glissent pas au doigt (voir gantt.js). */
@media (hover:none) and (pointer:coarse){
  .sch-help-mouse{display:none}
  .sch-help-touch{display:inline}
}
.sch-note{margin:12px 0 0;max-width:80ch}
.sch-p{margin:0}
.sch-list{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:2px}
.sch-hint-empty{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}
.sch-empty-act{margin-top:12px;display:flex;justify-content:center}
.sch-daybar{margin-bottom:10px}

/* ---------- Alertes ---------- */
.sch-alerts{display:flex;flex-direction:column;gap:6px;margin-bottom:14px}
.sch-alert{border:0;font:inherit;font-size:13.5px;text-align:left;cursor:pointer;width:100%;align-items:center;color:var(--ink)}
.sch-alert:hover{box-shadow:inset 0 0 0 1px var(--line-strong)}
.sch-alert-ic{width:20px;height:20px;border-radius:50%;display:inline-grid;place-items:center;font-weight:700;font-size:12px;flex:none;background:var(--surface)}
.alert.bad .sch-alert-ic{color:var(--bad)}
.alert.warn .sch-alert-ic{color:var(--warn)}
.sch-more{align-self:flex-start}

/* ---------- Légende des postes ---------- */
.sch-legend{display:flex;flex-wrap:wrap;gap:6px 12px;font-size:12.5px}
.sch-leg{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.sch-leg i{width:12px;height:12px;border-radius:3px;background:var(--c);display:block}

/* ---------- Vue « Par employé » ---------- */
.sch-pg{--sch-plab:180px;--sch-col:132px;overflow-x:auto;border:1px solid var(--line);border-radius:12px;background:var(--surface);overscroll-behavior-x:contain}
.sch-pg:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sch-pg-inner{min-width:calc(var(--sch-plab) + 7 * var(--sch-col))}
.sch-pg-row{display:grid;grid-template-columns:var(--sch-plab) repeat(7,minmax(var(--sch-col),1fr))}
.sch-pg-row+.sch-pg-row{border-top:1px solid var(--line)}
.sch-pg-head{background:var(--sunk)}
.sch-pg-head+.sch-pg-row{border-top-color:var(--line-strong)}
.sch-pg-lab{position:sticky;left:0;z-index:2;background:var(--surface);padding:8px 10px;border-right:1px solid var(--line);display:flex;align-items:center;gap:9px;min-width:0}
.sch-pg-head .sch-pg-lab{background:var(--sunk);font-size:10.5px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.sch-pg-open .sch-pg-lab{background:var(--surface)}
.sch-pg-txt{display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-width:0}
.sch-pg-txt b{font-weight:600;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sch-pg-txt .sub{font-size:11.5px;color:var(--muted)}
.sch-pg-txt .sub.over{color:var(--warn);font-weight:600}
.sch-pg-dh{padding:8px 9px;border-left:1px solid var(--line);display:flex;flex-direction:column;gap:1px;min-width:0}
.sch-pg-dh b{font-family:var(--f-display);font-variation-settings:"wdth" 85;font-weight:700;font-size:14px;line-height:1.2}
.sch-pg-dh span{font-family:var(--f-num);font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sch-pg-dh.today{box-shadow:inset 0 -3px 0 var(--accent)}
.sch-pg-dh.today b{color:var(--accent)}
.sch-pg-dh.closed,.sch-pg-cell.closed{background:repeating-linear-gradient(135deg,var(--closed) 0 6px,var(--closed-line) 6px 7px)}
.sch-pg-cell{position:relative;border-left:1px solid var(--line);padding:5px;min-height:64px;display:flex;flex-direction:column;gap:4px;min-width:0}
.sch-pg-cell:not(.empty){padding-bottom:32px}
.sch-pg-cell.today:not(.closed){background:color-mix(in srgb,var(--accent-soft) 45%,var(--surface))}
.sch-pg-cell.addable{cursor:copy}
.sch-pg-cell.addable:not(.closed):hover{background:var(--sunk)}
.sch-add{position:absolute;right:5px;bottom:5px;width:24px;height:24px;border-radius:6px;border:1px solid var(--line-strong);background:var(--surface);color:var(--ink);cursor:pointer;font-size:15px;line-height:1;display:grid;place-items:center;opacity:0;transition:opacity .12s}
.sch-pg-cell:hover .sch-add,.sch-add:focus-visible{opacity:1}
.sch-add:hover{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
@media (hover:none){.sch-add{opacity:.7}}
.sch-open-ic{width:30px;height:30px;border-radius:50%;display:grid;place-items:center;font-weight:700;font-size:14px;background:var(--warn-soft);color:var(--warn);border:1px dashed var(--warn);flex:none}

/* Carte de quart */
.sch-card{appearance:none;border:0;margin:0;font:inherit;color:var(--ink);text-align:left;width:100%;min-width:0;cursor:pointer;border-radius:7px;padding:5px 7px 5px 10px;background:color-mix(in srgb,var(--c) 14%,var(--surface));box-shadow:inset 3px 0 0 var(--c);display:flex;flex-direction:column;gap:2px}
.sch-card:hover{background:color-mix(in srgb,var(--c) 24%,var(--surface))}
.sch-card.st-draft{background:var(--surface);outline:1px dashed var(--line-strong);outline-offset:-1px}
.sch-card.st-draft:hover{background:var(--sunk)}
.sch-card.conflict{outline:2px solid var(--bad);outline-offset:-2px}
.sch-card:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.sch-card-top{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:0}
.sch-card-t{font-size:12px;font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sch-card-p{font-size:11.5px;color:var(--muted);display:flex;align-items:center;gap:5px;min-width:0}
.sch-card-pn{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sch-dot{width:7px;height:7px;border-radius:50%;background:var(--c);flex:none}
.sch-card-w{font-size:11px;font-weight:700;color:var(--bad)}
.sch-card.missing:not(.conflict) .sch-card-w{color:var(--warn)}
.sch-st,.sch-bst{border-radius:50%;display:inline-grid;place-items:center;font-family:var(--f-body);font-weight:700;line-height:1;flex:none}
.sch-st{width:18px;height:18px;font-size:11px}
.sch-st.draft{background:var(--sunk);color:var(--muted)}
.sch-st.pending{background:var(--info-soft);color:var(--info)}
.sch-st.changed{background:var(--info);color:var(--surface)}
.sch-st.ok{background:var(--ok-soft);color:var(--ok)}
.sch-st.bad{background:var(--bad);color:var(--surface)}
.sch-st.open{background:var(--warn-soft);color:var(--warn)}

/* Indisponibilité dans une case */
.sch-unav{border-radius:6px;padding:4px 7px;font-size:11.5px;line-height:1.3;color:var(--ink);border:1px dashed var(--bad);background:repeating-linear-gradient(135deg,var(--bad-soft) 0 6px,var(--surface) 6px 10px);display:flex;flex-direction:column;min-width:0}
.sch-unav b{color:var(--bad);font-size:11px;font-weight:700}
.sch-unav-n{color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
button.sch-unav{appearance:none;margin:0;font-family:inherit;text-align:left;width:100%;cursor:pointer}
button.sch-unav:hover{border-style:solid}
button.sch-unav:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.sch-pg-unav{appearance:none;border:0;background:none;margin:0;padding:2px 0;min-height:24px;display:inline-flex;align-items:center;font:inherit;font-size:11.5px;font-weight:600;color:var(--accent);text-decoration:underline;text-underline-offset:2px;cursor:pointer;text-align:left}
.sch-pg-unav:hover{color:var(--ink)}
.sch-pg-unav:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:3px}

/* Fenêtre « Indisponibilités de … » (saisie par l'administration) */
.sch-un-form{display:flex;flex-direction:column;gap:12px}
.sch-un-fs{border:0;margin:0;padding:0;min-width:0}
.sch-un-fs legend{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);padding:0;margin-bottom:2px}
.sch-un-opts{display:flex;flex-wrap:wrap;gap:2px 18px}
.sch-un-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.sch-un-rule{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px;padding:10px 0}
.sch-un-rule+.sch-un-rule{border-top:1px solid var(--line)}
.sch-un-txt{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1 1 220px}
.sch-un-txt b{font-weight:600}
.sch-un-txt .muted{font-size:12.5px}
.sch-un-conf ul{margin:4px 0;padding-left:18px}

/* ---------- Vue « Par jour » (grille chronologique) ---------- */
.sch-gantt{--sch-lab:180px;overflow-x:auto;border:1px solid var(--line);border-radius:12px;background:var(--surface);position:relative;overscroll-behavior-x:contain}
.sch-g-inner{min-width:760px}
.sch-day+.sch-day{border-top:2px solid var(--line-strong)}
.sch-row{display:grid;grid-template-columns:var(--sch-lab) minmax(0,1fr);min-height:38px}
.sch-row+.sch-row{border-top:1px solid var(--line)}
.sch-lab{padding:6px 10px;border-right:1px solid var(--line);min-width:0;display:flex;align-items:center;gap:8px}
.sch-lab .dot{width:10px;height:10px;border-radius:3px;background:var(--c);flex:none}
.sch-lab .txt{display:flex;flex-direction:column;min-width:0}
.sch-lab .nm{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sch-lab .pos{font-weight:500;color:var(--muted)}
.sch-lab .sub{font-family:var(--f-num);font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sch-track{position:relative;min-width:0;background-image:linear-gradient(to right,var(--line) 1px,transparent 1px);background-size:calc(100% / var(--nh)) 100%}
.sch-track.addable{cursor:copy}
.sch-cz{position:absolute;top:0;bottom:0;background:repeating-linear-gradient(135deg,var(--closed) 0 6px,var(--closed-line) 6px 7px);pointer-events:none}
.sch-head{background:var(--sunk);min-height:58px}
.sch-head .sch-lab{justify-content:space-between}
.sch-dn{display:flex;flex-direction:column;min-width:0}
.sch-dn b{font-family:var(--f-display);font-variation-settings:"wdth" 82;font-weight:700;font-size:15px;line-height:1.15}
.sch-dn .dd{font-weight:500;color:var(--muted)}
.sch-dn .sub{font-family:var(--f-num);font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sch-gadd{width:28px;height:28px;border-radius:7px;border:1px solid var(--line-strong);background:var(--surface);color:var(--ink);cursor:pointer;font-size:17px;line-height:1;flex:none}
.sch-gadd:hover{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.sch-tick{position:absolute;top:50%;transform:translate(5px,-50%);font-family:var(--f-num);font-size:11px;color:var(--muted);white-space:nowrap;pointer-events:none}
.sch-bar{position:absolute;top:5px;bottom:5px;margin:0;border:0;border-radius:6px;background:var(--c);color:var(--on-e);display:flex;align-items:center;gap:6px;padding:0 11px;font:500 11.5px var(--f-num);white-space:nowrap;overflow:hidden;cursor:grab;touch-action:manipulation;user-select:none;-webkit-user-select:none;min-width:6px;text-align:left}
.sch-bar .sch-hl,.sch-bar .sch-hr{position:absolute;top:0;bottom:0;width:9px;cursor:ew-resize}
.sch-bar .sch-hl{left:0}
.sch-bar .sch-hr{right:0}
.sch-bar:hover .sch-hl,.sch-bar:hover .sch-hr{background:var(--stripe)}
.sch-bar.draft{background:color-mix(in srgb,var(--c) 22%,var(--surface));color:var(--ink);box-shadow:inset 0 0 0 2px var(--c)}
.sch-bar.conflict{outline:2px solid var(--bad);outline-offset:1px;background-image:repeating-linear-gradient(135deg,transparent 0 6px,var(--stripe) 6px 10px)}
.sch-bar.dragging{cursor:grabbing;box-shadow:var(--shadow);z-index:3}
.sch-bar:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.sch-bst{width:16px;height:16px;font-size:10px;background:var(--stripe)}
.sch-bar.draft .sch-bst{background:var(--sunk)}
.sch-bst.bad{background:var(--bad);color:var(--on-bad)}
.sch-t{overflow:hidden;text-overflow:ellipsis}
.sch-emptyrow .sch-hint{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;color:var(--muted);pointer-events:none}
.sch-unrow{min-height:30px}
.sch-unrow .sch-lab .sub{color:var(--bad)}
.sch-unbar{position:absolute;top:6px;bottom:6px;border-radius:6px;border:1px dashed var(--bad);background:repeating-linear-gradient(135deg,var(--bad-soft) 0 6px,transparent 6px 10px);color:var(--bad);font-size:11px;font-weight:600;display:flex;align-items:center;padding:0 8px;white-space:nowrap;overflow:hidden;pointer-events:none;min-width:4px}
.sch-cov{min-height:26px}
.sch-cov .sch-lab{font-size:10.5px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;color:var(--muted);justify-content:space-between}
.sch-cov .gap{color:var(--bad);text-transform:none;letter-spacing:0;font-family:var(--f-num)}
.sch-cells{display:grid;grid-template-columns:repeat(var(--ns),minmax(0,1fr));background:none}
.sch-cell{font-family:var(--f-num);font-size:10.5px;display:flex;align-items:center;justify-content:center;border-right:1px solid var(--surface);min-height:26px;min-width:0;overflow:hidden}
.sch-cell.x{background:repeating-linear-gradient(135deg,var(--closed) 0 6px,var(--closed-line) 6px 7px)}
.sch-cell.z{background:var(--bad-soft);color:var(--bad);font-weight:600}
.sch-cell.o1{background:var(--ok-soft);color:var(--ok)}
.sch-cell.o2{background:var(--ok-mid);color:var(--ink)}
.sch-cell.o3{background:var(--ok);color:var(--surface);font-weight:600}

/* Mise en évidence après un clic sur une alerte */
.sch-flash{animation:sch-flash 1.8s ease}
@keyframes sch-flash{0%,55%{box-shadow:inset 0 0 0 2px var(--accent);background-color:var(--accent-soft)}100%{box-shadow:inset 0 0 0 0 transparent}}

/* ---------- Fenêtre de quart ---------- */
.sch-form{display:flex;flex-direction:column;gap:14px}
.sch-pubinfo{display:flex;flex-direction:column;gap:8px;padding:10px 12px;border-radius:10px;background:var(--sunk)}
.sch-publine{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px}
.sch-when{display:grid;grid-template-columns:minmax(0,1.4fr) repeat(3,minmax(0,1fr));gap:12px}
.sch-summary{font-size:13px;background:var(--sunk);border-radius:8px;padding:9px 11px;display:flex;flex-wrap:wrap;gap:4px 14px;align-items:baseline}
.sch-summary span{font-family:var(--f-num);font-variant-numeric:tabular-nums}
.sch-summary .warn{font-family:var(--f-body);color:var(--warn);font-weight:600}
.sch-summary.bad{background:var(--bad-soft);color:var(--bad);font-weight:600}
.sch-two{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));gap:14px;align-items:start}
.sch-col{display:flex;flex-direction:column;gap:8px;min-width:0}
.sch-possk{display:flex;flex-direction:column;gap:5px}
.sch-people-fs,.sch-dup{border:1px solid var(--line);border-radius:10px;padding:8px 12px 12px;margin:0;min-width:0}
.sch-people-fs legend,.sch-dup legend{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);padding:0 4px}
.sch-people{display:flex;flex-direction:column;gap:3px;max-height:320px;overflow:auto;padding:2px;overscroll-behavior:contain}
.sch-people-h{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin:10px 0 2px 2px}
.sch-people-empty{padding:4px 2px}
.sch-person{display:grid;grid-template-columns:auto auto minmax(0,1fr);gap:10px;align-items:center;padding:7px 9px;border-radius:9px;border:1px solid transparent;cursor:pointer}
.sch-person:hover{background:var(--sunk)}
.sch-person.sel{border-color:var(--accent);background:var(--accent-soft)}
.sch-person input{width:18px;height:18px;margin:0;accent-color:var(--accent)}
.sch-person-txt{display:flex;flex-direction:column;gap:2px;min-width:0}
.sch-person-txt .nm{font-weight:600}
.sch-person-txt .meta{font-size:12px;color:var(--muted)}
.sch-reasons{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}
.sch-reason{font-size:11.5px;font-weight:600;padding:2px 8px;border-radius:999px;background:var(--warn-soft);color:var(--warn)}
.sch-reason.unav,.sch-reason.busy,.sch-reason.off{background:var(--bad-soft);color:var(--bad)}
.sch-resolve{border:1px solid var(--bad);border-radius:10px;padding:12px;display:flex;flex-direction:column;gap:10px}
.sch-resolve h4{margin:0;font-family:var(--f-display);font-variation-settings:"wdth" 88;font-weight:700;font-size:15px}
.sch-choices{display:flex;flex-direction:column;gap:2px}
.sch-dup{display:flex;flex-direction:column;gap:8px}
.sch-dup-row{display:grid;grid-template-columns:130px minmax(0,1fr);gap:8px;align-items:center}
.sch-dup-lab{font-size:12.5px;color:var(--muted)}
.sch-days{display:flex;flex-wrap:wrap;gap:6px}
.sch-daybox{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border:1px solid var(--line-strong);border-radius:999px;font-size:12.5px;cursor:pointer;min-height:30px;white-space:nowrap}
.sch-daybox input{margin:0;accent-color:var(--accent)}
.sch-daybox.on{border-color:var(--accent);background:var(--accent-soft);color:var(--accent)}
.sch-daybox.off{opacity:.5;cursor:not-allowed}

/* ---------- Petits écrans ---------- */
@media (max-width:640px){
  .sch-pg{--sch-plab:128px;--sch-col:124px}
  .sch-pg-lab .avatar{display:none}
  .sch-gantt{--sch-lab:120px}
  .sch-when{grid-template-columns:1fr 1fr}
  .sch-dup-row{grid-template-columns:1fr}
  .sch-help{display:none}
}
@media print{
  .sch-pg,.sch-gantt{overflow:visible;border:0}
  .sch-add,.sch-gadd,.sch-alerts,.sch-seg{display:none!important}
}
