/* PSC Gestion — Feuilles de pointage : écran de préparation et feuille A4, charte PSC
   (bleu du logo #0009E4, lavandes de ses ombres, encre #0C0E3D, Exo 2 et Public Sans). */
.app-pointage { --pt-blue: #0009E4; --pt-ink: #0C0E3D; --pt-muted: #4A4E7D; --pt-line: #D3D5F0; --pt-lav: #DFDCFB; --pt-lav2: #A19AEE; --pt-bg: #F2F3FC;
  --pt-crit: #B3261E; --pt-crit-soft: #FBE3E0; --pt-warn: #7A5200; --pt-warn-soft: #FAEAC4;
  display: block; min-height: calc(100vh - 48px); background: var(--bg, var(--pt-bg)); color: var(--ink, var(--pt-ink)); font-family: 'Public Sans', system-ui, sans-serif; }
.pt-band { background: var(--pt-blue); color: #fff; }
.pt-band-in { max-width: 1180px; margin: 0 auto; padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.pt-band h1 { font-family: 'Exo 2', 'Public Sans', sans-serif; font-size: 22px; font-weight: 700; margin: 0; }
.pt-band p { margin: 2px 0 0; color: #D0D1FB; font-size: 13.5px; }
.pt-logo { background: #fff; border-radius: 8px; padding: 5px 9px; display: inline-flex; flex: none; }
.pt-logo img { height: 46px; width: auto; display: block; }
.pt-main { max-width: 1180px; margin: 0 auto; padding: 20px 20px 56px; display: flex; flex-direction: column; gap: 18px; }
.pt-panel { background: var(--surface, #fff); border: 1px solid var(--line, var(--pt-line)); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pt-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.pt-f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted, var(--pt-muted)); }
.pt-f input, .pt-f select { font: inherit; font-size: 14px; font-weight: 400; color: var(--ink, var(--pt-ink)); background: var(--surface, #fff); border: 1px solid var(--line, var(--pt-line)); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.pt-grow { flex: 1 1 220px; }
.pt-sel { align-items: center; }
.pt-hint { color: var(--muted, var(--pt-muted)); font-size: 13px; }
.pt-btn { font: inherit; font-weight: 600; border: 1px solid var(--line, var(--pt-line)); background: var(--surface, #fff); color: var(--ink, var(--pt-ink)); border-radius: 8px; padding: 9px 16px; cursor: pointer; }
.pt-btn:hover { border-color: var(--pt-blue); }
.pt-btn.sm { padding: 5px 10px; font-size: 13px; }
.pt-btn.accent { background: var(--pt-blue); border-color: var(--pt-blue); color: #fff; }
.pt-btn:disabled { opacity: .55; cursor: default; }
.pt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px 12px; max-height: 300px; overflow: auto; border: 1px solid var(--line, var(--pt-line)); border-radius: 8px; padding: 8px; }
.pt-item { display: flex; gap: 8px; align-items: flex-start; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.pt-item:hover { background: var(--accent-soft, var(--pt-lav)); }
.pt-item input { margin-top: 3px; accent-color: var(--pt-blue); }
.pt-item small { display: block; color: var(--muted, var(--pt-muted)); font-size: 12px; }
.pt-item.pt-sansmz small { color: var(--pt-warn); }
/* état de l'édition en arrière-plan, sur la carte du salarié */
.pt-etat { display: block; font-style: normal; font-size: 12px; font-weight: 600; margin-top: 2px; }
.pt-etat.cours { color: var(--pt-blue); }
.pt-etat.pret { color: #1E7B3A; }
.pt-etat.err { color: var(--pt-crit); }
.pt-item.pt-lock { background: var(--accent-soft, var(--pt-lav)); }
.pt-item.pt-lock:has(input:disabled) { cursor: not-allowed; opacity: .75; }
.pt-maj { display: inline-flex; gap: 6px; align-items: center; }
/* comptes MOZAIK : bouton des cartes, fenêtres de liaison */
.pt-mz-lien { display: inline-block; margin-top: 4px; padding: 2px 8px; border: 1px solid var(--pt-blue); border-radius: 6px; background: #fff; color: var(--pt-blue); font: 600 12px 'Public Sans', sans-serif; cursor: pointer; }
.pt-mz-lien:hover { background: var(--pt-blue); color: #fff; }
.pt-mz-lien.lie { border-color: transparent; background: none; color: #1E7B3A; padding: 0; font-weight: 600; }
.pt-mz-lien.lie:hover { color: var(--pt-blue); background: none; text-decoration: underline; }
.pt-mz { width: min(560px, 96vw); max-height: 86vh; padding: 0; border: 0; border-radius: 12px; background: var(--surface, #fff); color: var(--ink, var(--pt-ink)); box-shadow: 0 20px 60px rgba(6,8,58,.35); font-family: 'Public Sans', system-ui, sans-serif; }
.pt-mz.large { width: min(820px, 96vw); }
.pt-mz[open] { display: flex; flex-direction: column; }
.pt-mz::backdrop { background: rgba(6,8,58,.55); }
.pt-mz-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px 8px; }
.pt-mz-h h2 { margin: 0; font: 700 18px 'Exo 2', 'Public Sans', sans-serif; }
.pt-mz-q { padding: 10px 16px 4px; }
.pt-mz-q input { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; border: 1px solid var(--line, var(--pt-line)); border-radius: 8px; padding: 8px 10px; }
.pt-mz-l { overflow-y: auto; padding: 4px 16px 14px; min-height: 80px; }
.pt-mz-l h4 { margin: 14px 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, var(--pt-muted)); }
.pt-mz-i { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--line, var(--pt-line)); border-radius: 8px; margin-bottom: 5px; font-size: 13.5px; }
label.pt-mz-i { justify-content: flex-start; cursor: pointer; }
label.pt-mz-i input { accent-color: var(--pt-blue); }
.pt-mz-i.actuel { border-color: #1E7B3A; background: #EEF8F1; }
.pt-mz-i.pris { border-color: var(--pt-warn-soft); background: #FFFBF2; }
.pt-mz-i em { font-style: normal; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--pt-lav); color: #1F23A8; }
.pt-mz-i em.ok { background: #DBF0E2; color: #1C6A3A; }
.pt-mz-i em.ko { background: var(--pt-warn-soft); color: var(--pt-warn); }
.pt-mz-i small { color: var(--muted, var(--pt-muted)); }
.pt-mz-f { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line, var(--pt-line)); }
.pt-err { margin: 6px 16px; color: var(--pt-crit); font-size: 13px; }

/* ── Fenêtre des feuilles : en-tête fixe (période, imprimer, fermer), pages A4 qui défilent ── */
.pt-dlg { width: min(calc(210mm + 64px), 96vw); height: 94vh; max-height: 94vh; padding: 0; border: 0; border-radius: 12px; background: var(--surface, #fff);
  color: var(--ink, var(--pt-ink)); box-shadow: 0 20px 60px rgba(6,8,58,.35); overflow: hidden; font-family: 'Public Sans', system-ui, sans-serif; }
.pt-dlg[open] { display: flex; flex-direction: column; }
.pt-dlg::backdrop { background: rgba(6,8,58,.55); }
.pt-dlg-h { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line, var(--pt-line)); }
.pt-dlg-h h2 { font-family: 'Exo 2', 'Public Sans', sans-serif; font-size: 18px; font-weight: 700; margin: 0; }
.pt-dlg-h p { margin: 2px 0 0; }
.pt-dlg-b { flex: 1; overflow: auto; background: var(--bg, var(--pt-bg)); padding: 24px 0; }

/* ── Feuille A4 (aperçu à l'écran, identique à l'impression) ── */
.pt-sheets { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.pt-page { width: 210mm; min-height: 297mm; box-sizing: border-box; padding: 8mm 9mm 7mm; background: #fff; color: var(--pt-ink); box-shadow: 0 6px 24px rgba(6,8,58,.16);
  font-family: 'Public Sans', Arial, sans-serif; font-size: 7.6pt; line-height: 1.25; display: flex; flex-direction: column; gap: 2.3mm;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pt-top { display: grid; grid-template-columns: auto 1fr auto; gap: 4mm; align-items: center; border-bottom: 1.2mm solid var(--pt-blue); padding-bottom: 2.5mm; }
.pt-top .pt-logo { padding: 0; box-shadow: -1.5mm 1.5mm 0 var(--pt-lav2), -3mm 3mm 0 var(--pt-lav); margin: 0 0 3mm 3mm; border: 1px solid var(--pt-line); }
.pt-top .pt-logo img { height: 11mm; }
.pt-titre h2 { font-family: 'Exo 2', 'Public Sans', sans-serif; font-weight: 800; font-size: 14pt; margin: 0; color: var(--pt-ink); }
.pt-titre p { margin: .5mm 0 0; font-size: 10pt; font-weight: 700; color: var(--pt-blue); }
.pt-pg { font-weight: 700; color: var(--pt-muted); align-self: start; }
.pt-id { display: grid; grid-template-columns: 1fr 52mm; gap: 4mm; }
.pt-id dl { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 1mm 3mm; margin: 0; align-content: start; }
.pt-id dt { color: var(--pt-muted); font-weight: 600; }
.pt-id dd { margin: 0; }
.pt-pres { display: grid; grid-template-columns: 1fr auto; gap: .8mm 3mm; background: var(--pt-bg); border-left: 1mm solid var(--pt-blue); padding: 2mm 3mm; border-radius: 1mm; }
.pt-pres b { grid-column: 1 / -1; font-family: 'Exo 2', sans-serif; color: var(--pt-blue); }
.pt-pres strong { text-align: right; }
.pt-alerte { margin: 0; padding: 1.5mm 2.5mm; background: var(--pt-warn-soft); color: var(--pt-warn); border-radius: 1mm; font-weight: 600; }
.pt-blocs { display: grid; grid-template-columns: 1fr 62mm; gap: 4mm; align-items: start; }
.pt-t { width: 100%; border-collapse: collapse; }
.pt-t th { background: var(--pt-blue); color: #fff; font-weight: 700; text-align: left; padding: .7mm 1.6mm; border: .2mm solid var(--pt-blue); }
.pt-t td { padding: .45mm 1.6mm; border: .2mm solid var(--pt-line); }
.pt-t td:last-child, .pt-cpt td:nth-child(3), .pt-abst td:nth-child(n+4) { text-align: right; }
.pt-cpt td b, .pt-abst td b { color: var(--pt-blue); margin-right: 1.5mm; }
.pt-tot td { font-weight: 700; background: var(--pt-lav); }
.pt-vide { color: var(--pt-muted); text-align: center !important; }
.pt-jours { font-size: 6.9pt; line-height: 1.2; }
.pt-jours sup { font-size: 5.5pt; line-height: 0; vertical-align: .9mm; }
.pt-jours th { text-align: center; padding: .5mm 1mm; }
.pt-jours thead tr:last-child th { background: #2A30E9; }
.pt-jours td { padding: .2mm 1mm; text-align: center; white-space: nowrap; }
.pt-jours td.pt-d { text-align: left; font-weight: 600; }
.pt-jours td.pt-h { text-align: left; max-width: 34mm; overflow: hidden; text-overflow: ellipsis; color: var(--pt-muted); }
.pt-jours td:nth-child(n+10):not(:last-child) { text-align: right; }
.pt-jours td.pt-abs { font-weight: 700; color: var(--pt-blue); }
.pt-jours td.pt-ev { text-align: left; white-space: normal; }
.pt-jours tr.pt-we td { background: #F7F7FD; }
.pt-jours tr.pt-fe td { background: #FFF6E5; }
.pt-jours tr.pt-sem td { background: var(--pt-lav); font-weight: 700; text-align: right; }
.pt-jours tr.pt-per td { background: var(--pt-ink); color: #fff; font-weight: 700; text-align: right; }
.pt-neg { color: var(--pt-crit); }
.pt-c { font-style: normal; color: var(--pt-blue); margin-left: .6mm; }
.pt-b { display: inline-block; border-radius: .8mm; padding: 0 1mm; margin-right: .6mm; background: var(--pt-bg); font-weight: 700; font-size: 6.4pt; }
.pt-b.fer { background: #FFE7B8; color: var(--pt-warn); }
.pt-b.ano { background: var(--pt-crit-soft); color: var(--pt-crit); }
.pt-leg { margin: 0; color: var(--pt-muted); display: flex; flex-wrap: wrap; gap: 1mm 3mm; align-items: center; }
.pt-leg b { color: var(--pt-ink); }
.pt-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; margin-top: auto; }
.pt-sign div { border: .3mm solid var(--pt-line); border-top: 1mm solid var(--pt-blue); border-radius: 1mm; height: 17mm; padding: 1.2mm 2.5mm; }
.pt-sign b { font-family: 'Exo 2', sans-serif; font-size: 9pt; }
.pt-foot { display: flex; justify-content: space-between; gap: 4mm; border-top: .3mm solid var(--pt-line); padding-top: 1.5mm; color: var(--pt-muted); font-size: 7pt; }
.pt-foot b { color: var(--pt-ink); }

/* ── Impression : seulement les feuilles, une par page A4 ── */
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff !important; }
  body > *:not(#app-pointage) { display: none !important; }
  #app-pointage { display: block !important; min-height: 0; background: #fff; }
  #app-pointage .pt-band, #app-pointage .pt-panel, #app-pointage .pt-main { display: none !important; }
  /* la fenêtre (ouverte ou non) s'imprime comme une page ordinaire, sans son en-tête */
  #app-pointage .pt-dlg { display: block !important; position: static; width: auto; height: auto; max-width: none; max-height: none; overflow: visible;
    margin: 0; border: 0; border-radius: 0; box-shadow: none; background: #fff; inset: auto; transform: none; }
  #app-pointage .pt-dlg::backdrop { display: none; }
  #app-pointage .pt-dlg-h { display: none !important; }
  #app-pointage .pt-dlg-b { overflow: visible; padding: 0; background: #fff; }
  #app-pointage .pt-main { padding: 0; max-width: none; gap: 0; }
  #app-pointage .pt-sheets { display: block; }
  .pt-page { box-shadow: none; margin: 0; min-height: 297mm; height: auto; overflow: visible; break-after: page; page-break-after: always; }
  .pt-jours tr, .pt-sign, .pt-foot { break-inside: avoid; page-break-inside: avoid; }
  .pt-page:last-child { break-after: auto; page-break-after: auto; }
}

/* ── Modifications manuelles des heures ── */
.pt-jours td.pt-man, .pt-manu td.pt-man { background: #FFE9C7 !important; color: #6B3E00; font-weight: 700; }
.pt-m { display: inline-block; font-style: normal; font-weight: 800; font-size: 5.6pt; line-height: 1; color: #fff; background: #C25E00; border-radius: .6mm; padding: .2mm .5mm; margin-left: .6mm; vertical-align: .3mm; }
.pt-b.man { background: #FFE9C7; color: #6B3E00; }
.pt-manu { font-size: 6.6pt; line-height: 1.2; }
.pt-manu td { padding: .3mm 1.2mm; }
.pt-manu td:nth-child(-n+3), .pt-manu td:nth-child(n+5) { white-space: nowrap; }
.pt-manu td:nth-child(6) { text-align: left; }
.pt-avecman { gap: 1.8mm; }
.pt-avecman .pt-sign div { height: 13mm; }
.pt-manu th { background: #C25E00; border-color: #C25E00; }
.pt-manu small { color: var(--pt-muted); font-weight: 400; }
.pt-edit { margin-left: 1mm; border: 1px solid var(--pt-line); background: #fff; color: var(--pt-blue); border-radius: 1mm; font-size: 7pt; line-height: 1; padding: .3mm .8mm; cursor: pointer; }
.pt-edit:hover { background: var(--pt-blue); color: #fff; }
@media print { .pt-edit { display: none !important; } }

/* Modification directe des heures sur la feuille (écran seulement) */
@media screen {
  .pt-ed { cursor: pointer; }
  .pt-jours td.pt-ed:hover, .pt-manu td.pt-ed:hover { outline: .4mm solid var(--pt-blue); outline-offset: -.4mm; background: #EEF0FF; }
  .pt-jours td.pt-att { background: #FFF7C2 !important; color: #6B5600; font-weight: 700; }
  .pt-in { width: 100%; min-width: 15mm; box-sizing: border-box; font: inherit; font-size: 7pt; padding: 0 .4mm; border: .4mm solid var(--pt-blue); border-radius: .6mm; background: #fff; color: var(--pt-ink); }
  .pt-in-txt { min-width: 40mm; }
  .pt-manu .pt-edit { margin-left: 1.5mm; font-size: 6.2pt; padding: .3mm 1mm; white-space: nowrap; }
}