/* Suivi d'habitudes */
.o-suivi-habitudes { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.o-suivi-habitudes .invisible, .o-suivi-habitudes-impression .invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.o-suivi-habitudes h2 { margin: 0; font-size: 1.15rem; }
.o-suivi-habitudes-volet summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; padding: 4px 0; }
.o-suivi-habitudes-volet summary span { color: var(--texte-2); font-weight: 400; }
.o-suivi-habitudes-liste { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.o-suivi-habitudes-ligne {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(150px, 210px) auto; gap: 8px 10px; align-items: end;
  padding: 8px 10px; border: 1px solid var(--bord); border-left: 5px solid var(--c); border-radius: var(--rayon-petit); background: var(--surface);
}
.o-suivi-habitudes-ligne label { display: flex; flex-direction: column; gap: 3px; font-size: .82rem; color: var(--texte-2); min-width: 0; }
.o-suivi-habitudes-ligne input[type="text"], .o-suivi-habitudes-ligne select { width: 100%; min-height: 38px; font-size: 1rem; }
.o-suivi-habitudes-ligne input[type="color"] { width: 48px; height: 38px; padding: 2px; border: 1px solid var(--bord); border-radius: var(--rayon-petit); background: var(--surface); cursor: pointer; }
.o-suivi-habitudes-ordre { display: flex; gap: 4px; }
.o-suivi-habitudes-ordre .btn { min-width: 38px; padding: 4px 8px; }
.o-suivi-habitudes-ajout { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.o-suivi-habitudes-idees { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.o-suivi-habitudes-idees > span { display: contents; }
.o-suivi-habitudes-idees .btn { font-size: .85rem; min-height: 32px; padding: 2px 10px; }

.o-suivi-habitudes-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.o-suivi-habitudes-nav h2 { min-width: 11ch; text-align: center; }
.o-suivi-habitudes-nav [data-prec], .o-suivi-habitudes-nav [data-suiv] { font-size: 1.3rem; min-width: 42px; line-height: 1; }
.o-suivi-habitudes-aide { margin: 6px 0 8px; font-size: .88rem; color: var(--texte-2); }
.o-suivi-habitudes-defil { position: relative; overflow-x: auto; max-width: 100%; border: 1px solid var(--bord); border-radius: var(--rayon-petit); overscroll-behavior-x: contain; }
.o-suivi-habitudes-vide { margin: 0; padding: 18px; color: var(--texte-2); text-align: center; }
.o-suivi-habitudes-grille { border-collapse: separate; border-spacing: 0; font-size: .85rem; min-width: max-content; }
.o-suivi-habitudes-grille th, .o-suivi-habitudes-grille td { padding: 2px; text-align: center; border-bottom: 1px solid var(--bord); background: var(--surface); }
.o-suivi-habitudes-grille tbody tr:last-child > * { border-bottom: 0; }
.o-suivi-habitudes-grille thead th { font-weight: 400; color: var(--texte-2); line-height: 1.15; padding: 4px 1px; }
.o-suivi-habitudes-grille thead th b { display: block; color: var(--texte); font-weight: 600; }
.o-suivi-habitudes-grille .we { background: var(--surface-2); }
.o-suivi-habitudes-grille .deb { border-left: 2px solid var(--bord); }
.o-suivi-habitudes-grille thead th.auj { background: var(--marque); color: var(--sur-marque); border-radius: 6px 6px 0 0; }
.o-suivi-habitudes-grille thead th.auj b { color: var(--sur-marque); }
.o-suivi-habitudes-grille .nom {
  position: sticky; left: 0; z-index: 1; text-align: left; padding: 4px 8px; max-width: 170px; min-width: 120px;
  border-right: 1px solid var(--bord); background: var(--surface);
}
.o-suivi-habitudes-grille tbody .nom { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center; }
.o-suivi-habitudes-grille tbody .nom i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); grid-row: span 2; }
.o-suivi-habitudes-grille tbody .nom span { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-suivi-habitudes-grille tbody .nom small { color: var(--texte-2); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.o-suivi-habitudes-grille input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; display: block; margin: 0 auto; width: 24px; height: 24px; cursor: pointer;
  border: 2px solid color-mix(in srgb, var(--c) 55%, var(--bord)); border-radius: 6px; background: var(--surface);
}
.o-suivi-habitudes-grille td.futur input:not(:checked) { opacity: .5; }
.o-suivi-habitudes-grille input[type="checkbox"]:checked {
  border-color: var(--c); background: var(--c) center / 72% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.o-suivi-habitudes-grille tr.clair input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.o-suivi-habitudes-grille input[type="checkbox"]:focus-visible { outline: 3px solid var(--marque); outline-offset: 1px; }
.o-suivi-habitudes-grille .stat { padding: 2px 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.o-suivi-habitudes-grille thead .stat { color: var(--texte); font-weight: 600; }
.o-suivi-habitudes-grille .stat.mois { border-right: 2px solid var(--bord); }
.o-suivi-habitudes-grille td.mois strong { display: block; }
.o-suivi-habitudes-grille td.mois small { color: var(--texte-2); }
.o-suivi-habitudes-res-titre { margin: 14px 0 4px; font-size: 1rem; }
.o-suivi-habitudes-resume { margin: 0; padding-left: 1.2em; }
.o-suivi-habitudes-annonce { display: block; min-height: 1.4em; margin-top: 6px; font-size: .9rem; color: var(--texte-2); }

.o-suivi-habitudes-export { border-top: 1px solid var(--bord); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.o-suivi-habitudes-boutons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.o-suivi-habitudes-fichier { position: relative; cursor: pointer; }
.o-suivi-habitudes-fichier input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.o-suivi-habitudes-fichier:focus-within { outline: 3px solid var(--marque); outline-offset: 2px; }
.o-suivi-habitudes-alerte { margin: 0; padding: 8px 12px; border-radius: var(--rayon-petit); background: var(--erreur-fond); color: var(--erreur-texte); }
.o-suivi-habitudes .tirage-astuce { margin: 0; }
.o-suivi-habitudes-impression { display: none; }

@media (max-width: 640px) {
  .o-suivi-habitudes-ligne { grid-template-columns: minmax(0, 1fr) auto; }
  .o-suivi-habitudes-ligne .o-suivi-habitudes-nom { grid-column: 1 / -1; }
  .o-suivi-habitudes-ordre { grid-column: 1 / -1; justify-content: flex-end; }
  .o-suivi-habitudes-grille .nom { min-width: 96px; max-width: 120px; }
}
@media (prefers-reduced-motion: reduce) { .o-suivi-habitudes * { transition: none !important; } }

@media print {
  html[data-osh-imprime] body *:not([data-osh-garde]):not(.o-suivi-habitudes-impression):not(.o-suivi-habitudes-impression *) { display: none !important; }
  html[data-osh-imprime], html[data-osh-imprime] body, html[data-osh-imprime] [data-osh-garde] {
    display: block !important; margin: 0 !important; padding: 0 !important; border: 0 !important; background: #fff !important;
    box-shadow: none !important; width: auto !important; max-width: none !important; min-height: 0 !important; height: auto !important;
    position: static !important; overflow: visible !important; color: #000 !important;
  }
  .o-suivi-habitudes .o-suivi-habitudes-impression { display: block !important; color: #000; font-family: var(--police); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .o-suivi-habitudes-impression .entete { display: flex; justify-content: space-between; align-items: baseline; gap: 6mm; height: 11mm; overflow: hidden; }
  .o-suivi-habitudes-impression .entete h2 { margin: 0; font-size: 18pt; color: #000; }
  .o-suivi-habitudes-impression .entete span { font-size: 14pt; font-weight: 600; color: #000; }
  .o-suivi-habitudes-impression .feuille { width: 100%; border-collapse: collapse; table-layout: fixed; border: .4mm solid #333; background: #fff; color: #000; }
  .o-suivi-habitudes-impression .feuille th, .o-suivi-habitudes-impression .feuille td {
    border: .2mm solid #999; padding: 0; height: var(--ligne); text-align: center; vertical-align: middle; line-height: 1; overflow: hidden;
  }
  .o-suivi-habitudes-impression .feuille thead th { height: 9mm; background: #f0f0f0; font-size: 7pt; font-weight: 400; }
  .o-suivi-habitudes-impression .feuille thead th b { display: block; font-size: 8.5pt; font-weight: 700; }
  .o-suivi-habitudes-impression .feuille .we { background: #f3f3f3; }
  .o-suivi-habitudes-impression .feuille thead .we { background: #e2e2e2; }
  .o-suivi-habitudes-impression .feuille .deb { border-left: .5mm solid #333; }
  .o-suivi-habitudes-impression .feuille th.nom { width: 42mm; text-align: left; padding: 0 1.5mm; font-size: 9.5pt; line-height: 1.1; }
  .o-suivi-habitudes-impression.portrait .feuille th.nom { width: 34mm; font-size: 8.5pt; }
  .o-suivi-habitudes-impression .feuille th.nom i { display: inline-block; width: 2.6mm; height: 2.6mm; border-radius: 50%; background: var(--c); margin-right: 1.2mm; vertical-align: middle; }
  .o-suivi-habitudes-impression .feuille th.nom small { display: block; margin-top: .6mm; font-size: 6.5pt; font-weight: 400; color: #444; }
  .o-suivi-habitudes-impression .feuille .total { width: 13mm; font-size: 8.5pt; }
  .o-suivi-habitudes-impression.portrait .feuille .total { width: 11mm; font-size: 7.5pt; }
  .o-suivi-habitudes-impression .boite {
    display: inline-block; width: min(4.4mm, calc(var(--ligne) - 1.2mm)); height: min(4.4mm, calc(var(--ligne) - 1.2mm));
    border: .3mm solid var(--c, #555); border-radius: .8mm; background: #fff; vertical-align: middle; position: relative;
  }
  .o-suivi-habitudes-impression.portrait .boite { width: min(3.6mm, calc(var(--ligne) - 1.2mm)); height: min(3.6mm, calc(var(--ligne) - 1.2mm)); }
  .o-suivi-habitudes-impression tr.libre .boite { border-color: #888; }
  .o-suivi-habitudes-impression .boite.oui { background: var(--c); }
  .o-suivi-habitudes-impression .boite.oui::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 7pt; font-weight: 700; line-height: 1; }
  .o-suivi-habitudes-impression tr.clair .boite.oui::after { color: #000; }
}
