/* pafpayslip : jetons (spec §10) et composants. Une seule feuille, sur Bootstrap 5. */
:root {
  --encre: #1E2A3B;
  --papier: #F3F5F8;
  --surface: #FFFFFF;
  --trait: #D8DDE6;
  --fluo: #FFE14D;
  --present: #1E8C5A;
  --focus: #2F62C9;
  --muted: #5B6676;

  --bs-body-bg: var(--papier);
  --bs-body-color: var(--encre);
  --bs-border-color: var(--trait);
  --bs-font-sans-serif: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.5;
  --bs-link-color-rgb: 30, 42, 59;
  --bs-link-hover-color-rgb: 47, 98, 201;

  --fs-s: 14px; --fs-m: 16px; --fs-l: 20px; --fs-xl: 28px;
  --r-chip: 6px; --r-panel: 10px;
}

body { background: var(--papier); color: var(--encre); font-size: var(--fs-m); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
.tabnum, .balances, table.num { font-variant-numeric: tabular-nums; }

/* navigation */
.topnav {
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap;
  padding: .75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--trait);
}
.topnav .brand { font-weight: 600; text-decoration: none; color: var(--encre); }
.topnav ul { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.topnav ul a { text-decoration: none; color: var(--muted); padding: .25rem 0; }
.topnav ul a:hover { color: var(--encre); }
.topnav ul a[aria-current="page"] { color: var(--encre); box-shadow: inset 0 -2px 0 var(--encre); }
.topnav .who { margin-left: auto; display: flex; gap: 1rem; font-size: var(--fs-s); color: var(--muted); }
.topnav .who a { color: var(--muted); }
.badge-alerts { font-size: var(--fs-s); color: var(--muted); }
.badge-alerts b { display: inline-block; min-width: 1.5em; padding: 0 .4em; margin-left: .25em;
  border-radius: var(--r-chip); background: #C23B32; color: #fff; text-align: center; }

.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* pastille de type */
.chip {
  display: inline-block; padding: 0 .45em; border-radius: var(--r-chip);
  font-family: 'Barlow Semi Condensed', var(--bs-font-sans-serif); font-weight: 600;
  font-size: var(--fs-s); line-height: 1.6; border: 1px solid rgba(30, 42, 59, .12);
}

/* page Aujourd'hui */
.day-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.day-head h1 { font-size: var(--fs-xl); margin: 0; }
.day-head .step { text-decoration: none; font-size: var(--fs-l); color: var(--muted); padding: 0 .35rem; }
.day-head .back-today { font-size: var(--fs-s); margin-left: .5rem; }

.board { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface);
  border: 1px solid var(--trait); border-radius: var(--r-panel); }
.board .side { padding: 1.25rem 1.5rem 1.5rem; min-width: 0; }
.board .side.on { border-right: 1px solid var(--trait); }
.board h2 { font-size: var(--fs-l); display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.board h2 .count { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.board h2 .dot { width: .6em; height: .6em; border-radius: 50%; background: var(--present); }
.board h3 { font-size: var(--fs-m); margin: 1.1rem 0 .35rem; }
.board .names { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; }
.board .names li { white-space: nowrap; }
.board .note { color: var(--muted); font-size: var(--fs-s); }
.board .off-list { list-style: none; padding: 0; margin: 0; display: grid;
  grid-template-columns: minmax(7rem, max-content) 1fr; gap: .2rem 1rem; }
.board .off-list li { display: contents; }
.board .off-list .chip { justify-self: start; margin-right: .25rem; }
.board .empty, .board .legend { color: var(--muted); font-size: var(--fs-s); margin-top: 1rem; }

/* surlignage TT : l'élément signature */
.tt {
  background-image: linear-gradient(transparent 48%, var(--kind-TT-bg, var(--fluo)) 48%,
                    var(--kind-TT-bg, var(--fluo)) 92%, transparent 92%);
  background-repeat: no-repeat; background-size: 100% 100%;
  padding: 0 .12em; margin: 0 -.12em;
  animation: tt-draw 600ms cubic-bezier(.2, .7, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 40ms);
  border-radius: 2px 4px 3px 2px;
}
.tt-static { animation: none; }
@keyframes tt-draw { from { background-size: 0 100%; } to { background-size: 100% 100%; } }
@media (prefers-reduced-motion: reduce) { .tt { animation: none; } }

@media (max-width: 767.98px) {
  .page { padding: 1rem; }
  .day-head h1 { font-size: 22px; }
  .day-head .back-today { flex-basis: 100%; margin-left: 0; }
  .topnav { gap: .75rem 1.25rem; padding: .75rem 1rem; }
  .topnav .who { margin-left: 0; }
  .board { grid-template-columns: 1fr; }
  .board .side.on { border-right: 0; border-bottom: 1px solid var(--trait); }
}

/* Mon planning : calendrier peint */
.painter { position: relative; }
.pl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pl-title { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.pl-title h1 { font-size: var(--fs-xl); margin: 0; min-width: 9ch; }
.pl-title .step { background: none; border: 0; font-size: var(--fs-l); color: var(--muted); padding: 0 .35rem; }
.who-select { width: auto; margin-left: .75rem; }
.who-name { margin-left: .75rem; color: var(--muted); }
.lock-banner { margin: 0; font-size: var(--fs-s); color: var(--muted); }
.lock-banner.is-locked { color: #C23B32; }
.pl-label { color: var(--muted); font-size: var(--fs-s); margin-right: .25rem; }

.balances { display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap; margin: 0 0 1rem; font-variant-numeric: tabular-nums; }
.balances .bal { display: flex; gap: .4rem; align-items: baseline; }
.balances dt { font-weight: 600; }
.balances .bal dt { font-weight: 400; color: var(--muted); }
.balances dd { margin: 0; font-size: var(--fs-l); font-weight: 600; }
.balances .bal.neg dd { color: #C23B32; }

.palette { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.brush, .pill {
  border: 1px solid var(--trait); background: var(--b-bg, var(--surface)); color: var(--b-fg, var(--encre));
  border-radius: var(--r-chip); padding: .2rem .6rem; font-size: var(--fs-s); line-height: 1.4;
}
.brush[aria-pressed="true"], .pill[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--encre); }
.brush-ot, .brush-erase, .pill-ot, .pill-erase { background: var(--surface); color: var(--encre); border-style: dashed; }
.periods { display: flex; gap: 1rem; border: 0; padding: 0; margin: 0 0 .5rem; font-size: var(--fs-s); }
.periods input { margin-right: .25rem; }
.pl-msg { min-height: 1.6rem; color: #C23B32; font-size: var(--fs-s); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .25rem; }
.force-box { display: inline-flex; gap: .4rem; }
.force-box input { width: 16rem; }

.cal { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r-panel); overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head span { padding: .4rem .6rem; font-size: var(--fs-s); color: var(--muted); border-bottom: 1px solid var(--trait); }
.cal-grid { user-select: none; -webkit-user-select: none; }
.cal-grid .pad { border-right: 1px solid var(--trait); border-bottom: 1px solid var(--trait); background: var(--papier); }
.day {
  position: relative; min-height: 76px; padding: .35rem .5rem; text-align: left;
  border: 0; border-right: 1px solid var(--trait); border-bottom: 1px solid var(--trait);
  background: var(--surface); color: var(--encre); font: inherit; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; touch-action: manipulation;
}
.day:nth-child(7n) { border-right: 0; }
.day .num { font-size: var(--fs-s); font-variant-numeric: tabular-nums; }
.day .tag { position: absolute; top: .35rem; right: .5rem; font-size: 12px; color: var(--muted); }
.day .code { align-self: center; font-family: 'Barlow Semi Condensed', var(--bs-font-sans-serif); font-weight: 600; font-size: var(--fs-m); }
.day .ot { font-size: 12px; font-variant-numeric: tabular-nums; align-self: flex-end; }
.day.off { background: repeating-linear-gradient(135deg, #EEF1F5 0 6px, var(--surface) 6px 12px); }
.day.holiday { background: repeating-linear-gradient(45deg, #E4E8EF 0 2px, var(--surface) 2px 7px); }
.day.today .num { display: inline-block; background: var(--encre); color: #fff; border-radius: var(--r-chip); padding: 0 .35rem; align-self: flex-start; }
.day.filled { background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); color: var(--fg, var(--encre)); }
.day.split .code { display: flex; width: 100%; justify-content: space-between; font-size: var(--fs-s); }
.day.split .half-b { align-self: flex-end; }
.day.locked { cursor: default; }
.day.locked::after { content: ''; position: absolute; inset: 0; background: rgba(243, 245, 248, .45); pointer-events: none; }
.day.inactive { opacity: .4; }
.day.has-comment .num::after { content: ' •'; color: var(--focus); }
.day.sel { outline: 2px solid var(--focus); outline-offset: -3px; }
.day:focus-visible { outline-offset: -3px; z-index: 1; }
.day.shake { animation: shake 360ms ease-in-out; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .day.shake { animation: none; outline: 2px solid #C23B32; outline-offset: -3px; } }
.pl-hint { font-size: var(--fs-s); color: var(--muted); margin-top: .6rem; }

.toast-undo { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 20;
  background: var(--encre); color: #fff; border-radius: var(--r-panel); padding: .6rem 1rem; display: flex; gap: 1rem; align-items: center; }
.toast-undo[hidden] { display: none; }
.toast-undo button { background: none; border: 0; color: var(--fluo); text-decoration: underline; padding: 0; }

.popover-ot, .popover-info { position: absolute; z-index: 15; width: 280px; background: var(--surface);
  border: 1px solid var(--trait); border-radius: var(--r-panel); padding: .75rem; box-shadow: 0 6px 24px rgba(30, 42, 59, .12); }
.popover-ot[hidden], .popover-info[hidden], .drawer[hidden] { display: none; }
.pop-title { font-weight: 600; margin-bottom: .5rem; }
.ot-stepper { display: flex; gap: .4rem; margin-bottom: .5rem; }
.ot-stepper input { width: 5.5rem; text-align: center; font-variant-numeric: tabular-nums; border: 1px solid var(--trait); border-radius: var(--r-chip); }
.ot-stepper button { width: 2.2rem; border: 1px solid var(--trait); background: var(--surface); border-radius: var(--r-chip); }
.ot-kind { display: flex; gap: 1rem; font-size: var(--fs-s); margin-bottom: .5rem; }
.pop-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .6rem; }
.info-history { font-size: var(--fs-s); padding-left: 1.1rem; margin: 0; max-height: 14rem; overflow: auto; }
.info-comment { font-size: var(--fs-s); }

.drawer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface);
  border-top: 1px solid var(--trait); border-radius: var(--r-panel) var(--r-panel) 0 0; padding: 1rem;
  box-shadow: 0 -8px 24px rgba(30, 42, 59, .12); animation: drawer-in 180ms ease-out; }
@keyframes drawer-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-brushes { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.drawer .pill { font-size: var(--fs-m); padding: .45rem .9rem; border-radius: 999px; }
.drawer-range { display: flex; gap: 1rem; flex-wrap: wrap; font-size: var(--fs-s); }
.drawer-range input { display: block; border: 1px solid var(--trait); border-radius: var(--r-chip); padding: .3rem .4rem; }
.sheet { position: fixed !important; left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto !important; border-radius: var(--r-panel) var(--r-panel) 0 0 !important; }

@media (max-width: 767.98px) {
  .pl-title h1 { font-size: 22px; }
  .day { min-height: 56px; padding: .25rem .3rem; }
  .day .code { font-size: var(--fs-s); }
  .day .tag { display: none; }
  .day.split .code { font-size: 11px; }
  .cal-head span { padding: .3rem; text-align: center; }
  .palette, .painter > .periods, .pl-hint { display: none; }
  .balances { gap: .9rem; }
}

/* Gestion */
.adm-tabs { display: flex; gap: 1.25rem; margin: -.25rem 0 1.25rem; border-bottom: 1px solid var(--trait); }
.adm-tabs a { text-decoration: none; color: var(--muted); padding: .4rem 0; }
.adm-tabs a[aria-current="page"] { color: var(--encre); box-shadow: inset 0 -2px 0 var(--encre); }
.adm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.adm-head h1 { font-size: var(--fs-xl); margin: 0; }
.adm-head h1 .sub { font-size: var(--fs-m); font-weight: 400; color: var(--muted); }
.adm-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.adm-grid > div { display: grid; gap: 1rem; }
@media (max-width: 860px) { .adm-grid { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r-panel); padding: 1.25rem; }
.panel h2 { font-size: var(--fs-l); margin-bottom: .75rem; }
.adm-scroll { overflow-x: auto; }
.adm-table { background: var(--surface); }
.adm-table tr.grp th { background: var(--papier); font-size: var(--fs-s); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 1rem; }
.adm-table tr.grp .n { font-weight: 400; margin-left: .35rem; }
.adm-table tr.left td { color: var(--muted); }
.adm-table td.neg { color: #C23B32; font-weight: 600; }
.adm-table td.zero { color: var(--muted); }
.adm-table tr.tot th, .adm-table tr.tot td { border-top: 2px solid var(--encre); font-weight: 600; }
.role { font-size: var(--fs-s); padding: 0 .4em; border-radius: var(--r-chip); background: var(--encre); color: #fff; }
.wk { display: inline-flex; gap: 2px; font-family: 'Barlow Semi Condensed', var(--bs-font-sans-serif); font-weight: 600; font-size: 13px; }
.wk span { min-width: 1.6em; text-align: center; border-radius: 4px; padding: 0 .15em; }
.wk .on { background: var(--encre); color: #fff; }
.wk .off { color: var(--muted); background: var(--papier); }
.days { display: flex; gap: .5rem 1rem; flex-wrap: wrap; }
.days label, .pick label { display: inline-flex; gap: .35rem; align-items: center; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .2rem 1rem; max-height: 14rem; overflow-y: auto; border: 1px solid var(--trait); border-radius: 6px; padding: .5rem .75rem; }
tr.future td { color: var(--muted); font-style: italic; }
