.calendar-nav {
  display: flex;
  align-items: center;
  gap: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
}
.calendar-nav button {
  border: 0;
  background: #edf5f3;
  color: var(--green);
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 19px;
  cursor: pointer;
}
.calendar-nav strong {
  min-width: 145px;
  text-align: center;
  text-transform: capitalize;
  font-size: 13px;
}
.calendar-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
}

#calendar > .page-head { overflow: visible !important; z-index: 2; }
#calendar > .page-head::after { display: none; }
#calendar .calendar-nav { gap: 4px; padding: 4px; flex: 0 0 auto; }
#calendar .calendar-month-trigger {
  width: 150px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 8px !important;
  font-size: 13px !important;
}
#calendar .calendar-month-popover {
  width: 272px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  left: auto;
  right: 0;
  transform: none;
  padding: 12px;
  border-radius: 8px;
}
#calendar .calendar-month-popover[hidden] { display: none !important; }
#calendar .calendar-month-popover-head strong { min-width: 0; }
#calendar .calendar-month-grid { gap: 4px; }
#calendar .calendar-month-grid button {
  width: 100%;
  height: 36px;
  min-height: 36px !important;
  padding: 0;
  border-radius: 6px !important;
}
.calendar-filters label {
  margin: 0;
  width: 220px;
}
.calendar-filters .btn {
  margin-left: auto;
}
.calendar-shell {
  padding: 0;
  overflow: visible;
  /* Keep hovered days and tooltips below the sticky section header. */
  position: relative;
  isolation: isolate;
  z-index: 0;
}
.calendar-weekdays,
.calendar-grid {
  display: grid;
  /* Content must not set a different minimum width for each weekday. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  position: relative;
}
.calendar-weekdays {
  background: #f0f6f4;
  border-bottom: 1px solid #dfe8e6;
}
.calendar-weekdays span {
  text-align: center;
  padding: 11px;
  color: #627572;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.calendar-day {
  min-width: 0;
  min-height: 120px;
  border-right: 1px solid #e8eeec;
  border-bottom: 1px solid #e8eeec;
  padding: 8px;
  position: relative;
}
.calendar-day:nth-child(7n) {
  border-right: 0;
}
#calendarGrid .calendar-day:nth-child(7n) {
  background: #edf0f2;
}
.year-days > i.is-rest-day {
  background: #edf0f2 !important;
  color: #78838c !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
.calendar-day.outside {
  background: #fafcfc;
}
.calendar-day.outside .day-number {
  color: #b9c3c1;
}
.calendar-day.today {
  background: #f1faf7;
}
.day-number {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  font-size: 10px;
  font-weight: 700;
}
.today .day-number {
  background: var(--green);
  color: #fff;
  border-radius: 50%;
}
.absence-stack {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.calendar-person {
  flex: 0 0 30px;
  position: relative;
  width: 30px;
  height: 30px;
  border: 2px solid #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand-600);
  font-size: 8px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px #17332f25;
}
.calendar-person:hover {
  transform: translateY(-2px);
  z-index: 30;
}
.calendar-person.birthday {
  background: #9b6fbd;
  border-color: #fff;
}
.birthday-badge {
  position: absolute;
  bottom: -5px;
  right: -6px;
  font-size: 11px;
  font-style: normal;
  line-height: 1;
}
.person-tooltip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 37px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-radius: 7px;
  padding: 7px 9px;
  width: max-content;
  max-width: min(260px, 36vw);
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 9px;
  font-weight: 500;
  box-shadow: 0 8px 20px #17332f33;
  z-index: 80;
}
.calendar-person:hover .person-tooltip {
  display: block;
}
.calendar-day.tooltip-right .person-tooltip {
  left: 0;
  transform: translateX(0);
}
.calendar-day.tooltip-left .person-tooltip {
  left: auto;
  right: 0;
  transform: translateX(0);
}
.calendar-day:hover {
  z-index: 20;
}
.absence-count {
  font-size: 8px;
  color: var(--muted);
  margin-top: 5px;
}
.calendar-empty {
  grid-column: 1/-1;
  padding: 60px;
  text-align: center;
  color: var(--muted);
}
.calendar-shell.no-absence::after{content:"Aucune absence approuvée pour les filtres sélectionnés";display:block;text-align:center;color:var(--muted);font-size:11px;padding:12px;background:#f8fbfa}
@media (max-width: 760px) {
  .calendar-filters {
    align-items: stretch;
    flex-direction: column;
  }
  .calendar-filters label {
    width: 100%;
  }
  .calendar-filters .btn {
    margin-left: 0;
  }
  .calendar-shell {
    overflow: auto;
  }
  .calendar-weekdays,
  .calendar-grid {
    min-width: 760px;
  }
  .calendar-day {
    min-height: 105px;
  }
}

/* Bascule Mois / Année (admin) */
.calendar-view-toggle { display:inline-flex; padding:4px; border:1px solid var(--border, #dce6ed); border-radius:12px; background:#fff; gap:4px; }
.calendar-view-toggle[hidden], .calendar-year-grid[hidden], .calendar-grid[hidden], .calendar-weekdays[hidden] { display:none !important; }
.calendar-view-toggle button { border:0; background:transparent; padding:8px 16px; border-radius:9px; font-weight:700; font-size:12px; color:#5c6f7c; cursor:pointer; }
.calendar-view-toggle button.active { background:var(--brand-700, #007bc6); color:#fff; }
.calendar-shell.year-mode::after { display:none; }
.calendar-year-grid { padding:18px; }
.year-legend { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-bottom:16px; font-size:12px; color:#5c6f7c; }
.year-legend span { display:inline-flex; align-items:center; gap:6px; }
.year-legend i { width:14px; height:14px; border-radius:4px; display:inline-block; }
.year-legend small { margin-left:auto; }
.year-months { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:16px; }
.year-month { padding:12px; border:1px solid var(--border, #dce6ed); border-radius:14px; background:#fff; }
.year-month-head { display:flex; justify-content:space-between; align-items:baseline; gap:8px; width:100%; margin-bottom:8px; padding:0; border:0; background:transparent; cursor:pointer; text-align:left; }
.year-month-head b { font-size:14px; color:#17233b; }
.year-month-head small { font-size:11px; color:#5c6f7c; }
.year-month-head:hover b { color:var(--brand-700, #007bc6); }
.year-weekdays, .year-days { display:grid; grid-template-columns:repeat(7,1fr); gap:3px; }
.year-weekdays span { text-align:center; font-size:10px; font-weight:700; color:#8293a0; }
.year-day { aspect-ratio:1; display:grid; place-items:center; border:0; border-radius:6px; background:#f4f7f9; color:#35495a; font-size:10px; cursor:pointer; padding:0; }
.year-day.empty { background:transparent; cursor:default; }
.year-day.rest { color:#a3b0b8; }
.level-1 { background:#d7ecf8 !important; }
.level-2 { background:#8cc6e8 !important; color:#06334f; }
.level-3 { background:#1f84c4 !important; color:#fff; }
.year-day.holiday, .year-legend i.holiday { background:#fde7c8 !important; color:#8a5b0c; }
.year-day.today { outline:2px solid #e7a324; outline-offset:-2px; font-weight:800; }
.year-day:hover { outline:2px solid var(--brand-700, #007bc6); outline-offset:-2px; }
@media (max-width:640px) { .year-legend small { margin-left:0; flex-basis:100%; } }

/* Détail d'un jour en vue annuelle */
#calendarDayModal { width:min(620px,calc(100vw - 32px)); }
#calendarDayModal .modal-card { padding:24px; }
.calendar-day-summary { margin:4px 0 0; color:#5c6f7c; font-size:13px; }
.calendar-day-detail:empty { display:none; }
.calendar-day-detail[hidden] { display:none !important; }
.calendar-day-detail-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.calendar-day-detail-head b { display:block; font-size:15px; color:#17233b; }
.calendar-day-detail-head small { color:#5c6f7c; font-size:12px; }
.calendar-day-detail ul { list-style:none; margin:0; max-height:60vh; overflow:auto; padding:0; display:grid; gap:8px; }
.calendar-day-detail li { display:grid; grid-template-columns:34px minmax(0,1fr) minmax(0,1.2fr); gap:12px; align-items:center; padding:9px 12px; border-radius:11px; background:#fff; border:1px solid #e3edf2; }
.calendar-day-detail li .calendar-person { position:static; width:34px; height:34px; margin:0; }
.calendar-day-detail li b { display:block; font-size:13px; color:#17233b; }
.calendar-day-detail li small { display:block; font-size:11px; color:#5c6f7c; }
.year-day.selected { outline:2px solid #17233b !important; outline-offset:-2px; font-weight:800; }
@media (max-width:640px) { .calendar-day-detail li { grid-template-columns:34px 1fr; } .calendar-day-detail li > div:last-child { grid-column:2; } }
