/*
 * Bureau — entête cours + compteurs : source canonique unique.
 * Géométrie commune Historique / Pointage / Réservation.
 * Les 5 compteurs gardent les mêmes abscisses dans tous les modes.
 * Sans priorité forcée.
 */
@keyframes desktopCourseModeBlink{
  0%,100%{opacity:1}
  50%{opacity:.25}
}

@media (min-width:1051px){
  .desktop-course-header-v325:not(.desktop-calendar-header){
    display:grid;
    grid-template-columns:24px minmax(300px,1fr) 122px 260px 284px 118px;
    column-gap:6px;
    align-items:center;
    min-height:42px;
    padding:5px 14px;
    background:#fffdfa;
  }

  .desktop-course-header-v325:not(.desktop-calendar-header)>.desktop-tree-chevron{grid-column:1;grid-row:1}
  .desktop-course-header-v325:not(.desktop-calendar-header)>.desktop-course-primary{grid-column:2;grid-row:1}
  .desktop-course-header-v325:not(.desktop-calendar-header)>.desktop-course-mode-badge{grid-column:3;grid-row:1}
  .desktop-course-header-v325:not(.desktop-calendar-header)>.desktop-pointage-adds{grid-column:4;grid-row:1}
  .desktop-course-header-v325:not(.desktop-calendar-header)>.desktop-course-aligned-stats{grid-column:5;grid-row:1}
  .desktop-course-header-v325:not(.desktop-calendar-header)>.desktop-course-action{grid-column:6;grid-row:1}

  .desktop-course-header-v325>.desktop-tree-chevron{
    position:static;
    width:24px;
    height:32px;
    margin:0;
    padding:0;
    border:0;
    background:transparent;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    justify-self:center;
    align-self:center;
    font-size:18px;
    line-height:1;
    color:var(--muted);
    cursor:pointer;
    transform:rotate(-90deg);
    transition:transform .15s;
    visibility:visible;
    opacity:1;
  }
  .desktop-course-node.open>.desktop-course-header-v325>.desktop-tree-chevron{transform:rotate(0deg)}

  .desktop-course-primary{
    min-width:0;
    display:flex;
    align-items:baseline;
    gap:12px;
    white-space:nowrap;
    overflow:hidden;
  }
  .desktop-course-primary .desktop-course-date{
    flex:0 0 auto;
    font-size:15px;
    line-height:1.2;
    font-weight:900;
    color:var(--ink);
    white-space:nowrap;
  }
  .desktop-course-primary .desktop-course-title{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:14px;
    font-weight:700;
    color:var(--ink);
  }
  .desktop-course-meta{
    flex:0 0 auto;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:12px;
    font-weight:650;
    color:var(--muted);
  }

  .desktop-course-mode-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    justify-self:center;
    align-self:center;
    height:22px;
    margin:0;
    padding:0 8px;
    border-radius:7px;
    font-size:11px;
    line-height:1;
    font-weight:850;
    white-space:nowrap;
    flex:0 0 auto;
    filter:none;
  }
  .desktop-course-mode-badge.pointage{
    background:#2f6fb2;
    color:#fff;
    animation:desktopCourseModeBlink 1.15s ease-in-out infinite;
  }
  .desktop-course-mode-badge.booking{
    background:#2f7d3e;
    color:#fff;
    animation:none;
    opacity:1;
  }

  .desktop-course-header-v325>.desktop-pointage-adds{
    width:260px;
    min-width:0;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    justify-self:start;
    gap:8px;
    overflow:visible;
  }
  .desktop-pointage-add{
    flex:0 0 32px;
    width:32px;
    height:32px;
    min-width:32px;
    margin:0;
    padding:0;
    border:1px solid;
    border-radius:8px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    box-shadow:none;
  }
  .desktop-pointage-add-icon{
    width:23px;
    height:23px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
  }
  .desktop-pointage-add-icon svg{
    display:block;
    width:23px;
    height:23px;
  }
  .desktop-pointage-add.dropin{
    border-color:#b9d1ea;
    background:#e8f2fb;
    color:#377fc4;
  }
  .desktop-pointage-add.dropin:hover{background:#dcecf9}
  .desktop-pointage-add.manual{
    border-color:#d4c3e8;
    background:#f0e9f8;
    color:#8c63c7;
  }
  .desktop-pointage-add.manual:hover{background:#e8ddf4}

  .desktop-course-header-v325>.desktop-course-aligned-stats{
    width:284px;
    min-width:284px;
    margin:0;
    display:grid;
    grid-template-columns:repeat(5,52px);
    gap:6px;
    align-items:center;
    justify-content:end;
    justify-self:stretch;
  }
  .desktop-course-header-v325>.desktop-course-aligned-stats>span{
    width:52px;
    height:30px;
    min-height:30px;
    box-sizing:border-box;
    margin:0;
    padding:0 2px;
    border:0;
    border-radius:0;
    background:transparent;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:3px;
    overflow:visible;
  }
  .desktop-course-header-v325>.desktop-course-aligned-stats>span.placeholder{visibility:hidden}
  .desktop-course-header-v325>.desktop-course-aligned-stats strong{
    font-size:15px;
    line-height:1;
    font-weight:900;
    font-variant-numeric:tabular-nums;
    color:currentColor;
  }
  .desktop-counter-icon{
    width:21px;
    height:21px;
    flex:0 0 21px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
  }
  .desktop-counter-icon svg{
    display:block;
    width:21px;
    height:21px;
    fill:none;
    stroke:currentColor;
    stroke-width:2.6;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  .desktop-course-aligned-stats .reserved{color:#2f79bd}
  .desktop-course-aligned-stats .waiting{color:#c47b18}
  .desktop-course-aligned-stats .present{color:#2f7438}
  .desktop-course-aligned-stats .excused{color:#b87404}
  .desktop-course-aligned-stats .paid{color:#a13d3d}

  .desktop-course-header-v325>.desktop-course-action{
    width:118px;
    height:30px;
    margin:0;
    padding:0 12px;
    border:1px solid #bfcfbf;
    border-radius:8px;
    background:#edf6ee;
    color:#2f7438;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    justify-self:stretch;
    align-self:center;
    font-size:12px;
    font-weight:850;
    cursor:pointer;
    white-space:nowrap;
    visibility:visible;
  }
  .desktop-course-header-v325>.desktop-course-action:hover{background:#e2f1e4}
  .desktop-course-header-v325>.desktop-course-action:disabled{opacity:.48;cursor:not-allowed}

  /* Tous les cours/prestations non annulés gardent un bandeau neutre.
     Les états métier restent portés par les mnémoniques, compteurs et actions. */
  .desktop-course-node.desktop-course-closed>.desktop-course-header-v325.desktop-course-row,
  .desktop-course-node.desktop-course-closed.open>.desktop-course-header-v325.desktop-course-row,
  .desktop-course-node.desktop-course-deficit>.desktop-course-header-v325.desktop-course-row,
  .desktop-course-node.desktop-course-deficit.open>.desktop-course-header-v325.desktop-course-row,
  .desktop-course-node:not(.desktop-course-cancelled)>.desktop-course-header-v325.desktop-course-row{
    background:#fffdfa;
  }
  .desktop-course-node.desktop-course-cancelled>.desktop-course-header-v325,
  .desktop-course-node.desktop-course-cancelled.open>.desktop-course-header-v325{background:#e7e7e7}

  /* Synthèse semaine : le chevron est un bouton transparent, pas un bouton navigateur. */
  .desktop-week-summary-row>.desktop-week-toggle{
    position:static;
    width:24px;
    height:32px;
    margin:0;
    padding:0;
    border:0;
    border-radius:0;
    background:transparent;
    color:var(--muted);
    display:inline-flex;
    align-items:center;
    justify-content:center;
    justify-self:center;
    align-self:center;
    font-size:18px;
    line-height:1;
    cursor:pointer;
    transform:rotate(-90deg);
    transition:transform .15s;
    box-shadow:none;
  }
  .desktop-week-summary.open .desktop-week-summary-row>.desktop-week-toggle{transform:rotate(0deg)}

  /* Prestations calendrier : même identité visuelle, géométrie propre conservée. */
  .desktop-course-header-v325.desktop-calendar-header.no-adds{
    display:grid;
    grid-template-columns:24px minmax(0,1fr) 122px 260px 284px 118px;
    grid-template-areas:"chev primary mode action action action";
    column-gap:6px;
    align-items:center;
    min-height:42px;
    padding:5px 14px;
    background:#fffdfa;
  }
  .desktop-calendar-header>.desktop-tree-chevron{grid-area:chev}
  .desktop-calendar-header>.desktop-course-primary{grid-area:primary;min-width:0}
  .desktop-calendar-header>.desktop-course-mode-badge{grid-area:mode}
  .desktop-calendar-header>.desktop-calendar-actions{
    grid-area:action;
    min-width:0;
    width:100%;
    display:flex;
    align-items:center;
    justify-content:flex-end;
    justify-self:stretch;
    gap:10px;
  }
  .desktop-calendar-header>.desktop-calendar-actions button{flex:0 0 auto;white-space:nowrap}
  .desktop-calendar-actions>.desktop-course-action{
    width:auto;
    min-width:118px;
    height:30px;
    margin:0;
    padding:0 10px;
    border:1px solid #bfcfbf;
    border-radius:8px;
    background:#edf6ee;
    color:#2f7438;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    box-shadow:none;
    font-size:12px;
    line-height:1;
    font-weight:850;
    cursor:pointer;
    white-space:nowrap;
  }
  .desktop-calendar-actions>.desktop-course-action:hover{background:#e2f1e4}
  .desktop-calendar-actions>.desktop-course-action:disabled{opacity:.48;cursor:not-allowed}
  .desktop-calendar-actions>.desktop-calendar-action.no-invoice{min-width:160px}
  .desktop-calendar-actions>.desktop-calendar-action.cancel{
    border-color:#ddb2b2;
    background:var(--red-soft);
    color:var(--red-text);
  }
  .desktop-calendar-header .desktop-course-meta{font-weight:750}
}

/* Surbooking Bureau: anchored immediately after reservation/waitlist counters.
   Slots 3-5 are placeholders in booking mode, so this remains in the stats region. */
@media (min-width:1051px){
 .desktop-course-header-v325>.desktop-course-aligned-stats{position:relative}
 .desktop-course-aligned-stats>.desktop-overbooking-control{
   position:absolute;left:116px;top:50%;transform:translateY(-50%);
   display:flex;align-items:center;gap:2px;height:30px;padding:2px;
   border:1px solid #c7beb1;border-radius:16px;background:#f8f5ef;
   z-index:2;white-space:nowrap;
 }
 .desktop-overbooking-control>button{
   width:23px;height:23px;border:0;border-radius:50%;background:#e8e1d7;
   color:#333;font-size:18px;line-height:1;cursor:pointer;
 }
 .desktop-overbooking-control>button:disabled{opacity:.35;cursor:default}
 .desktop-overbooking-current{display:flex;align-items:center;gap:3px;min-width:40px;justify-content:center;color:#282828}
 .desktop-overbooking-current strong{font-size:12px;font-variant-numeric:tabular-nums}
 .desktop-overbooking-current svg{width:15px;height:15px;fill:none;stroke:#1d1d1d;stroke-width:1.9;stroke-linecap:round}
}

/* Pendant la réconciliation, le chiffre est optimiste et le sablier visible. */
@media (min-width:1051px){
 .desktop-overbooking-control.is-syncing{opacity:.78}
 .desktop-overbooking-control.is-syncing .desktop-overbooking-current::after{
   content:"";width:12px;height:12px;flex:0 0 12px;
   border:2px solid #b6aba0;border-top-color:#292929;border-radius:50%;
   animation:desktop-overbooking-spin .75s linear infinite;
 }
}
@keyframes desktop-overbooking-spin{to{transform:rotate(360deg)}}
