form,.form-grid>*,.planning-toolbar,.planning-date-row>*{min-width:0;max-width:100%}
.planning-toolbar{margin:0 0 20px}.planning-modes{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;padding:4px;border:1px solid var(--line);background:#e9edf2;border-radius:14px}.planning-modes a{display:flex;align-items:center;justify-content:center;min-height:44px;padding:6px 3px;font-size:.85rem;font-weight:700;text-decoration:none;color:var(--muted);border-radius:10px}.planning-modes a[aria-current]{color:var(--accent);background:white;box-shadow:0 2px 5px #1824330c}.planning-period{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:8px;align-items:center;margin-top:16px}.planning-period h2{font-size:1rem;text-align:center;margin:0;line-height:1.4}.planning-period a{text-decoration:none;display:grid;place-items:center;background:white;border:1px solid var(--line);font-size:1.6rem;color:var(--accent)}.planning-date-row{display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin-top:4px}.planning-date-row form{flex:1 1 240px}.planning-date-row>a{flex:0 1 auto}.date-jump{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}.date-jump input{margin:0}.date-jump button{min-width:0;padding:10px 12px}.calendar-intro{display:flex;justify-content:space-between;gap:8px;align-items:center;flex-wrap:wrap;margin-top:18px}.calendar-intro p{margin:0}.calendar-horizontal-controls{display:flex;gap:10px;align-items:center;font-size:.75rem;color:var(--muted)}.calendar-horizontal-controls button{background:white;border:1px solid var(--line);color:var(--accent);font-size:1.5rem}.calendar-scroll{--calendar-day-width:min(280px,calc(100vw - 90px));height:min(72dvh,820px);min-height:280px;max-width:100%;min-width:0;overflow:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scroll-padding-left:44px;border:1px solid var(--line);border-radius:16px;background:white;margin:12px 0;scrollbar-width:thin;-webkit-overflow-scrolling:touch;isolation:isolate}.calendar-scroll:focus-visible{outline:3px solid #245fa9;outline-offset:3px}.calendar-grid{display:grid;grid-template-columns:44px repeat(var(--calendar-days,1),minmax(0,1fr));width:100%;min-width:calc(44px + var(--calendar-days,1)*var(--calendar-day-width))}.calendar-day{scroll-snap-align:start;scroll-snap-stop:always;min-width:0;border-left:1px solid var(--line);background:white}.calendar-day.is-today{background:#fffafa}.calendar-day-heading,.calendar-corner{position:sticky;top:0;height:62px;z-index:3;background:#fafbfd;border-bottom:1px solid var(--line)}.calendar-day-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px}.calendar-day-heading a{text-decoration:none;line-height:1.25;color:inherit}.calendar-day-heading a span{display:block;text-transform:capitalize;color:var(--muted);font-size:.72rem}.calendar-day-heading a strong{display:block;font-size:.95rem}.calendar-day.is-today .calendar-day-heading{background:#fff0f2}.calendar-day.is-today .calendar-day-heading a{color:var(--accent)}.calendar-count{font-size:.65rem;color:var(--muted);text-align:right}.calendar-hours{position:sticky;left:0;z-index:4;background:#fafbfd;min-width:0}.calendar-corner{font-size:.6rem;display:grid;place-items:center;color:var(--muted);z-index:5}.calendar-hour-track,.calendar-track{height:1440px;position:relative;margin-bottom:44px}.calendar-hour,.calendar-end{position:absolute;left:0;right:0;text-align:center;font-size:.6rem;line-height:1;color:var(--muted);transform:translateY(3px)}.calendar-hour[data-hour="0"]{transform:translateY(3px)}.calendar-end{top:1440px}.calendar-track{background:repeating-linear-gradient(to bottom,var(--line) 0,var(--line) 1px,transparent 1px,transparent 30px,#e9edf2 30px,#e9edf2 31px,transparent 31px,transparent 60px)}.calendar-empty{position:absolute;top:470px;left:10px;right:10px;font-size:.75rem;color:var(--muted);text-align:center;padding:12px 6px;background:#ffffffed;border-radius:10px;pointer-events:none}.calendar-event{position:absolute;display:flex;flex-direction:column;align-items:stretch;text-align:left;gap:2px;min-height:44px;max-width:100%;border:1px solid #edbec6;border-left:3px solid var(--accent);border-radius:8px;background:#fff0f3;color:#651421;padding:5px 7px;font-size:.72rem;line-height:1.25;overflow:hidden;overflow-wrap:anywhere;box-shadow:0 2px 4px #20273508}.calendar-event strong{font-size:.8rem}.calendar-event-time{font-size:.68rem;font-weight:700;white-space:nowrap}.calendar-event-people{font-size:.65rem}.calendar-event:hover{filter:brightness(.97)}.calendar-event:focus-visible{outline:3px solid #245fa9;outline-offset:1px;z-index:2}.calendar-event.event-in_progress{border-color:#90bbd8;border-left-color:#17669a;background:#eaf5fc;color:#154f75}.calendar-event.event-work_done{border-color:#9cc7b1;border-left-color:#207550;background:#edf7f0;color:#205e3d}.calendar-legend{display:flex;gap:14px;flex-wrap:wrap;font-size:.72rem;color:var(--muted)}.calendar-legend span{display:flex;align-items:center;gap:5px}.calendar-legend i{display:block;width:9px;height:9px;border-radius:3px}.legend-planned{background:var(--accent)}.legend-progress{background:#17669a}.legend-done{background:#207550}.planning-notice{padding:16px;border:1px solid var(--line);border-radius:14px;background:white}.mission-details-list{padding-left:18px}.mission-details-list li{padding:6px 0}.planning-create{margin-top:20px}
@media(min-width:900px){.calendar-scroll{--calendar-day-width:260px}.planning-date-row form{max-width:420px}.calendar-intro{margin-top:24px}}
@media(max-width:350px){.planning-modes a{font-size:.76rem}.date-jump{grid-template-columns:minmax(0,1fr)}.date-jump button{width:100%}.calendar-day-heading{padding:8px}.calendar-count{font-size:.6rem}}

.calendar-scroll.is-dragging{scroll-snap-type:none}.calendar-horizontal-controls [data-calendar-visible]{min-width:130px;text-align:center}.calendar-scroll[aria-busy=true]{cursor:progress}@media(max-width:767px),(pointer:coarse) and (max-width:1024px){.calendar-scroll{touch-action:pan-y pinch-zoom}}

/* Les vues de synthèse affichent toute la période dans la largeur disponible. */
.planning-page{padding-top:14px}.planning-page>.eyebrow{margin:0;font-size:.65rem}.planning-page>h1{font-size:1.35rem;margin:4px 0 12px}.planning-page .planning-toolbar{margin-bottom:8px}.planning-page .planning-period{margin-top:10px}.planning-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:start;margin-top:10px}.planning-tools>a{flex:1 1 110px;font-size:.8rem;min-height:44px}.planning-date-picker{flex:1 1 150px;min-width:0}.planning-date-picker summary{display:flex;align-items:center;justify-content:center;min-height:44px;list-style:none;font-size:.8rem;color:var(--muted);background:white;border:1px solid var(--line);border-radius:12px;padding:8px}.planning-date-picker summary::-webkit-details-marker{display:none}.planning-date-picker[open]{flex-basis:100%;order:2}.planning-date-picker form{background:white;border:1px solid var(--line);padding:0 14px 14px;border-radius:12px;margin-top:8px}.planning-page .calendar-intro{margin-top:8px;gap:4px}.calendar-overview{scroll-snap-type:none;scroll-padding-left:0}.calendar-overview .calendar-grid{min-width:0}.calendar-overview .calendar-day{scroll-snap-align:none}.calendar-overview .calendar-day-heading{padding:4px;gap:1px;flex-direction:column;justify-content:center}.calendar-overview .calendar-day-heading>a{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:44px;width:100%;gap:2px}.calendar-overview .calendar-day-heading a strong{font-size:1.1rem;line-height:1}.calendar-overview .calendar-count{font-size:.6rem;line-height:1;position:absolute;right:4px;top:5px}.calendar-overview .calendar-day-heading a span{font-size:.7rem}.calendar-overview .calendar-event strong,.calendar-overview .calendar-event-title,.calendar-overview .calendar-event-people{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.calendar-overview .calendar-event{padding:5px 3px;border-radius:6px}.calendar-overview .calendar-event strong{font-size:.73rem}.calendar-overview .calendar-event-time{font-size:.62rem;overflow:hidden;text-overflow:ellipsis}.calendar-overview .is-weekend{background:#f4f5f8}.calendar-overview .is-weekend .calendar-day-heading{background:#edeff4}.calendar-overview .is-today .calendar-day-heading{background:#fff0f2}.calendar-overview .is-today{background:#fffafa}.calendar-week .calendar-event{padding:4px 2px;border-left-width:2px;border-radius:4px}.calendar-week .calendar-empty{display:none}.calendar-week .calendar-event strong{font-size:.65rem}.calendar-week .calendar-event-title,.calendar-week .calendar-event-people{display:none}.calendar-week .calendar-event-time{font-size:.6rem}.calendar-week .calendar-event-end{display:none}.calendar-week .calendar-day-heading a span{font-size:.65rem}.calendar-week .calendar-day-heading a strong{font-size:.95rem}.calendar-week .calendar-count{font-size:.5rem;right:2px;top:3px;color:var(--muted)}.calendar-open-day{margin-top:10px}.calendar-open-day>label{font-size:.75rem;color:var(--muted);margin-top:10px}.calendar-now{position:absolute;left:0;right:0;height:2px;background:var(--accent);z-index:2;pointer-events:none}.calendar-now::before{content:'';position:absolute;left:0;top:-2px;width:6px;height:6px;border-radius:50%;background:var(--accent)}.calendar-now[hidden]{display:none}
@media(min-width:700px){.calendar-overview .calendar-day-heading{flex-direction:row;padding:8px}.calendar-overview .calendar-day-heading>a{align-items:start}.calendar-week .calendar-event strong{font-size:.75rem}.calendar-week .calendar-event-time{font-size:.68rem}.calendar-week .calendar-event-title{display:block;font-size:.7rem}.calendar-week .calendar-event-end{display:inline}.calendar-week .calendar-day-heading a strong{font-size:1.1rem}.calendar-week .calendar-day-heading a span{font-size:.75rem}.calendar-week .calendar-count{font-size:.65rem;top:8px;right:6px}.planning-tools{max-width:440px}}

@media(max-width:699px){.calendar-week .calendar-count{display:none}}

/* Compact, single navigation above the calendar. */
.planning-page .planning-toolbar-compact { margin:0 0 12px; display:grid; gap:12px; }
.planning-heading-row { display:flex; align-items:center; justify-content:space-between; }
.planning-heading-kicker { display:block; font-size:11px; letter-spacing:.1em; font-weight:800; color:var(--accent); margin-bottom:4px; }
.planning-period-picker { position:relative; }
.planning-period-picker > summary { display:flex; align-items:center; gap:9px; width:fit-content; max-width:100%; list-style:none; font-size:clamp(19px,5vw,25px); line-height:1.25; font-weight:800; color:var(--text,#202938); cursor:pointer; }
.planning-period-picker > summary::-webkit-details-marker { display:none; }
.planning-period-picker > summary span { font-size:14px; color:var(--muted); }
.planning-period-picker form { display:grid; gap:8px; margin-top:12px; padding:12px; border:1px solid var(--line); border-radius:12px; background:white; }
.planning-period-picker label { font-size:12px; color:var(--muted); }
.planning-toolbar-compact .planning-modes { margin:0; }
.planning-compact-controls { display:grid; grid-template-columns:48px minmax(0,1fr) 48px; align-items:center; gap:10px; }
.planning-compact-controls > .icon-button { display:grid; place-items:center; width:48px; min-height:44px; padding:0; background:white; border:1px solid var(--line); border-radius:12px; color:var(--accent); font-size:27px; }
.planning-today { display:grid; place-items:center; text-align:center; min-height:44px; padding:8px 12px; border-radius:12px; background:white; border:1px solid var(--line); color:var(--text,#202938); text-decoration:none; font-size:14px; font-weight:700; }
.planning-page .calendar-scroll { margin-top:4px; }

.planning-simple-title{margin:0 0 2px;font-size:1.25rem;line-height:1.25;font-weight:800;color:var(--text,#202938)}

/* Smartphone month overview: seven compact columns and selected-day missions. */
.month-view{max-width:100%;padding:0 0 16px;touch-action:pan-y}
.month-name{font-size:1.12rem;text-transform:capitalize;margin:6px 0 12px;font-weight:800;color:var(--text,#202938)}
.month-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px}
.month-weekday{text-align:center;font-size:12px;color:var(--muted);font-weight:700;padding:7px 0}
.month-cell{display:flex;flex-direction:column;align-items:center;justify-content:space-between;gap:3px;min-width:0;min-height:58px;padding:7px 1px 5px;border:1px solid var(--line);border-radius:9px;background:white;color:var(--text,#202938);font:inherit;font-size:13px;font-weight:650;cursor:pointer}
.month-cell small{display:block;max-width:100%;padding:2px 3px;border-radius:4px;background:#e9edf2;color:#45556b;font-size:9px;white-space:nowrap}
.month-cell.is-outside{opacity:.4}
.month-cell.is-selected{border:2px solid #d34b69;background:#fff0f3;color:#ad1433}
.month-cell.is-selected small{background:#d34b69;color:white}
.month-cell.is-today:not(.is-selected)>span:first-child{text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px}
.month-details{margin-top:16px;border-top:1px solid var(--line);padding-top:14px}
.month-detail-heading{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:12px;color:var(--text,#202938)}
.month-detail-heading span,.month-empty{color:var(--muted);font-size:13px}
.month-mission{display:flex;flex-direction:column;align-items:flex-start;gap:4px;width:100%;padding:12px 14px;margin-bottom:9px;text-align:left;border:1px solid #cbd9d0;border-left:4px solid #448f72;border-radius:11px;background:#edf6f0;color:#356e52;font:inherit;cursor:pointer}
.month-mission span{font-weight:750}.month-mission small{font-size:12px}
.month-mission.event-in_progress{border-left-color:#4c9bc8;background:#eaf4fa;color:#2d688c}
.month-mission.event-planned{border-left-color:#b66a7d;background:#f9edf0;color:#86475b}
:root[data-theme="dark"] .month-cell{background:#1b2535;color:#edf3fc;border-color:#354258}
:root[data-theme="dark"] .month-cell small{background:#354258;color:#e5edf8}
:root[data-theme="dark"] .month-cell.is-selected{background:#442937;border-color:#f37a95;color:#ffb2c2}
:root[data-theme="dark"] .month-cell.is-selected small{background:#d34b69;color:white}
:root[data-theme="dark"] .month-mission{background:#203e35;color:#d8f9e6;border-color:#458b71}
:root[data-theme="dark"] .month-mission.event-planned{background:#50303e;color:#ffe4ea;border-color:#9a5269}
:root[data-theme="dark"] .month-mission.event-in_progress{background:#203e57;color:#d9f0ff;border-color:#427ca3}
@media(min-width:768px){.month-view{max-width:640px}}

/* iOS Safari: supprimer le filet de contenu qui traverse l'entête sticky du planning. */
.calendar-scroll .calendar-day-heading,
.calendar-scroll .calendar-corner{
  position:sticky;
  top:0;
  box-sizing:border-box;
  overflow:hidden;
  background-clip:border-box;
  -webkit-backface-visibility:hidden;
  backface-visibility:hidden;
  transform:translateZ(0);
  box-shadow:0 -3px 0 0 var(--calendar-header-bg,#fafbfd);
}
.calendar-scroll .calendar-day-heading{z-index:12;background:var(--calendar-header-bg,#fafbfd)}
.calendar-scroll .calendar-corner{z-index:14;background:var(--calendar-header-bg,#fafbfd)}
.calendar-scroll .calendar-day.is-today .calendar-day-heading{--calendar-header-bg:#fff0f2}
.calendar-scroll .calendar-day:not(.is-today) .calendar-day-heading{--calendar-header-bg:#fafbfd}
.calendar-scroll .calendar-day-heading::before,
.calendar-scroll .calendar-corner::before{
  content:"";position:absolute;inset:0;z-index:-1;
  background:var(--calendar-header-bg,#fafbfd);
  pointer-events:none;
}
:root[data-theme="dark"] .calendar-scroll .calendar-day-heading,
:root[data-theme="dark"] .calendar-scroll .calendar-corner{--calendar-header-bg:#263449}
:root[data-theme="dark"] .calendar-scroll .calendar-day.is-today .calendar-day-heading{--calendar-header-bg:#362e3d}

/* Slim view selector: retain comfortable touch targets while reducing visual height. */
.planning-page .planning-toolbar-compact{gap:0;margin-bottom:10px}
.planning-page .planning-toolbar-compact .planning-modes{padding:3px;gap:3px;border-radius:12px}
.planning-page .planning-toolbar-compact .planning-modes a{min-height:40px;padding:5px 2px;border-radius:9px;font-size:clamp(.75rem,3.3vw,.9rem);line-height:1.15;white-space:nowrap}

/* iPhone: the timeline scrolls inside a viewport, leaving the state legend visible. */
@media (max-width:767px) {
  .planning-page .calendar-scroll:not(.calendar-overview) {
    height:clamp(350px,calc(100dvh - 455px),550px);
    min-height:0;
    overflow-x:auto;
    overflow-y:auto;
    margin:8px 0 10px;
    scrollbar-width:none;
    -ms-overflow-style:none;
  }
  .planning-page .calendar-scroll:not(.calendar-overview)::-webkit-scrollbar {display:none;width:0;height:0}
  .planning-page .calendar-overview {
    height:clamp(350px,calc(100dvh - 455px),550px);
    min-height:0;
    overflow-y:auto;
    scrollbar-width:none;
    -ms-overflow-style:none;
    margin:8px 0 10px;
  }
  .planning-page .calendar-overview::-webkit-scrollbar {display:none;width:0;height:0}
  .planning-page .calendar-legend {margin-top:8px}
}

/* Compact 40px/hour grid; all event coordinates use the same 2/3 scale. */
.planning-page .calendar-hour-track,.planning-page .calendar-track{height:960px;margin-bottom:30px}
.planning-page .calendar-end{top:960px}
.planning-page .calendar-track{background:repeating-linear-gradient(to bottom,var(--line) 0,var(--line) 1px,transparent 1px,transparent 20px,#e9edf2 20px,#e9edf2 21px,transparent 21px,transparent 40px)}
.planning-page .calendar-empty{top:315px}
/* The original state legend stays below the scrollable timeline. */
.planning-page .planning-create{display:none;margin:0}
.planning-page .planning-create[open]{display:block;position:fixed;z-index:80;left:50%;top:50%;transform:translate(-50%,-50%);width:min(94vw,540px);max-height:80dvh;overflow:auto;padding:18px;box-shadow:0 0 0 100vmax #0009,0 12px 45px #0007;border-radius:18px}
.planning-page .planning-create>summary{list-style:none;pointer-events:none;font-size:1.15rem;font-weight:750;margin:0 42px 12px 0}
.planning-page .planning-create>summary::-webkit-details-marker{display:none}
.planning-page .planning-create-close{position:absolute;right:12px;top:10px;width:40px;height:40px;border:1px solid var(--line);border-radius:10px;background:var(--surface,#263449);color:var(--text,#fff)}

/* Consistent vertical spacing: view selector -> calendar matches tabs -> selector. */
.planning-page .planning-toolbar-compact{margin-bottom:0}
.planning-page .calendar-scroll{margin-top:20px}
@media(max-width:767px){
  .planning-page .calendar-scroll:not(.calendar-overview),
  .planning-page .calendar-overview{margin-top:20px}
}

/* Align hour labels exactly on hourly grid separators (40px per hour). */
.planning-page .calendar-hour{transform:translateY(-50%);line-height:1;z-index:1}
.planning-page .calendar-hour[data-hour="0"]{transform:translateY(0)}
.planning-page .calendar-end{transform:translateY(-50%)}
.planning-page .calendar-legend{margin-top:20px}
@media(max-width:767px){
  .planning-page .calendar-scroll:not(.calendar-overview),
  .planning-page .calendar-overview{margin-bottom:0}
  .planning-page .calendar-legend{margin-top:20px}
}

/* Exact shared timeline origin: hour gutter and day columns must have identical headers. */
.planning-page .calendar-scroll:not(.calendar-overview) .calendar-corner,
.planning-page .calendar-scroll:not(.calendar-overview) .calendar-day-heading{
  height:62px;min-height:62px;max-height:62px;
  box-sizing:border-box;margin:0;
}
.planning-page .calendar-scroll:not(.calendar-overview) .calendar-hour-track,
.planning-page .calendar-scroll:not(.calendar-overview) .calendar-track{
  height:960px;box-sizing:border-box;padding:0;border-top:0;margin-top:0;
}
.planning-page .calendar-scroll:not(.calendar-overview) .calendar-hour{
  position:absolute;top:0;display:flex;align-items:center;justify-content:center;
  height:20px;line-height:20px;margin-top:-10px;transform:none!important;
  padding:0;box-sizing:border-box;
}
.planning-page .calendar-scroll:not(.calendar-overview) .calendar-hour[data-hour="0"]{margin-top:0}
.planning-page .calendar-scroll:not(.calendar-overview) .calendar-end{
  height:20px;line-height:20px;margin-top:-10px;transform:none!important;
}

/* Single exact hourly reference: labels and grid lines both every 40px. */
.planning-page .calendar-scroll:not(.calendar-overview) .calendar-track{
 background:repeating-linear-gradient(to bottom,var(--line) 0,var(--line) 1px,transparent 1px,transparent 40px)!important;
}
.planning-page .calendar-scroll:not(.calendar-overview) .calendar-hour{
 height:20px;line-height:20px;margin-top:-10px;transform:none!important;
}
@media(max-width:767px){
 body:has(.planning-page){overflow-y:hidden!important;overscroll-behavior-y:none}
 .planning-page:has(.calendar-scroll){
   height:calc(100dvh - var(--orgasav-header-height,120px) - var(--orgasav-footer-height,112px) - env(safe-area-inset-bottom));
   max-height:calc(100dvh - var(--orgasav-header-height,120px) - var(--orgasav-footer-height,112px) - env(safe-area-inset-bottom));
   min-height:0;overflow:hidden;display:flex;flex-direction:column;padding-bottom:0;
 }
 .planning-page:has(.calendar-scroll) .calendar-scroll:not(.calendar-overview),
 .planning-page:has(.calendar-scroll) .calendar-overview{
   flex:1 1 0;min-height:0;height:auto;max-height:none;overflow-y:auto;overscroll-behavior-y:contain;
 }
 .planning-page:has(.calendar-scroll) .calendar-legend{flex:0 0 auto;margin-top:20px;margin-bottom:6px}
 .planning-page:has(.calendar-scroll) .planning-view-switch,
 .planning-page:has(.calendar-scroll) .planning-toolbar-compact,
 .planning-page:has(.calendar-scroll) .eyebrow,
 .planning-page:has(.calendar-scroll) .page-title-row{flex-shrink:0}
}

/* Safari iOS: holding the empty calendar must not select text or show callouts. */
.planning-page .calendar-scroll,
.planning-page .calendar-scroll .calendar-grid,
.planning-page .calendar-scroll .calendar-track,
.planning-page .calendar-scroll .calendar-hours,
.planning-page .calendar-scroll .calendar-day-heading{
 -webkit-user-select:none!important;user-select:none!important;
 -webkit-touch-callout:none!important;
}
.planning-page .calendar-scroll .calendar-track{touch-action:pan-y pan-x}

/* Compact action in each day header, to the right of the mission count. */
.planning-page .calendar-day-heading .calendar-plan-button{
 flex:0 0 auto;min-width:0;min-height:36px;padding:6px 10px;
 border:1px solid #ef6680;border-radius:10px;background:#ad0825;
 color:#fff;font-size:clamp(.7rem,2.8vw,.86rem);font-weight:700;
 white-space:nowrap;cursor:pointer;
}
.planning-page .calendar-day-heading{gap:5px}
.planning-page .calendar-day-heading .calendar-count{margin-left:auto}

/* The assignment modal follows its content rather than stretching to viewport height. */
.planning-page .planning-create[open]{height:fit-content!important;min-height:0!important;max-height:min(80dvh,800px);box-sizing:border-box;overscroll-behavior:contain}
.planning-page .planning-create form[hidden]{display:none!important}
.planning-page .planning-assigned-actions{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.planning-page .planning-assigned-actions p{flex-basis:100%;margin:0 0 6px}
.planning-page .planning-assigned-actions button{flex:1 1 160px;min-width:0}

/* iPhone modal: keep the entire panel between the header and the fixed footer.
   The panel must size to its contents; only its contents may scroll. */
@media (max-width:767px){
 .planning-page .planning-create[open]{
  position:fixed!important;
  top:calc(var(--orgasav-header-height,120px) + 8px)!important;
  bottom:auto!important;
  left:12px!important;right:12px!important;
  transform:none!important;
  width:auto!important;
  height:auto!important;min-height:0!important;
  max-height:calc(100dvh - var(--orgasav-header-height,120px) - var(--orgasav-footer-height,112px) - env(safe-area-inset-bottom) - 24px)!important;
  overflow-y:auto!important;overflow-x:hidden!important;
  padding:18px!important;margin:0!important;
  -webkit-overflow-scrolling:touch;
 }
 .planning-page .planning-create[open] #new-intervention{
  display:block;height:auto!important;min-height:0!important;max-height:none!important;
  padding-bottom:0!important;margin-bottom:0!important;
 }
 .planning-page .planning-create[open] #new-intervention[hidden]{display:none!important}
 .planning-page .planning-create[open] #new-intervention>button[type=submit]{margin-bottom:0!important}
}

/* Modal viewport bounds come from measured header/footer rectangles in view.js. */
@media(max-width:767px){
 .planning-page .planning-create[open]{
  top:var(--assignment-top,140px)!important;
  max-height:var(--assignment-max-height,calc(100dvh - 270px))!important;
  height:fit-content!important;
  overflow-y:auto!important;
  overscroll-behavior-y:contain;
  padding:18px 18px 26px!important;
  scroll-padding-bottom:26px;
  -webkit-overflow-scrolling:touch;
 }
 .planning-page .planning-create[open] #new-intervention{padding-bottom:12px!important}
 .planning-page .planning-create[open] .planning-assigned-actions{padding-bottom:12px!important}
}

/* Three planning modes on landscape tablet and desktop; no fixed screen widths for layout. */
@media (min-width:768px) and (orientation:landscape){.planning-modes{grid-template-columns:repeat(3,minmax(0,1fr))}}

/* Landscape tablet/desktop: switch intervention/absence beside the heading.
   This recovers a full row of vertical space for the calendar. */
@media (min-width:768px) and (orientation:landscape){
  .planning-page:has(> .planning-view-switch){
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    column-gap:clamp(.75rem,2vw,1.5rem);
    align-content:start;
  }
  .planning-page:has(> .planning-view-switch)> .eyebrow{grid-column:1/-1}
  .planning-page:has(> .planning-view-switch)> .page-title-row{
    grid-column:1;grid-row:2;min-width:0;align-self:center;margin-bottom:0;
  }
  .planning-page:has(> .planning-view-switch)> .planning-view-switch{
    grid-column:2;grid-row:2;display:flex;flex-wrap:nowrap;
    align-items:center;gap:clamp(.4rem,1vw,.75rem);margin:0;align-self:center;
  }
  .planning-page:has(> .planning-view-switch)> .planning-view-switch a{
    white-space:nowrap;width:auto;min-width:0;
  }
  .planning-page:has(> .planning-view-switch)> :not(.eyebrow):not(.page-title-row):not(.planning-view-switch){
    grid-column:1/-1;min-width:0;
  }
}

/* Nested trips are actual tracked activity, never an editable planned mission. */
.planning-page .calendar-event.event-side-trip,
.planning-page .month-mission.event-side-trip{
  background:#e7f2ff!important;
  border:2px solid #3279b9!important;
  color:#173c60!important;
  box-shadow:inset .25rem 0 #3279b9;
}
.planning-page .calendar-event.event-side-trip .calendar-event-title,
.planning-page .month-mission.event-side-trip small{color:#173c60!important}
.planning-page .calendar-legend .legend-side-trip{background:#3279b9;border:1px solid #173c60}
@media(prefers-color-scheme:dark){
 .planning-page .calendar-event.event-side-trip,
 .planning-page .month-mission.event-side-trip{background:#17334e!important;color:#e6f3ff!important}
 .planning-page .calendar-event.event-side-trip .calendar-event-title,
 .planning-page .month-mission.event-side-trip small{color:#e6f3ff!important}
}

.planning-page .calendar-event.event-side-trip:disabled,
.planning-page .month-mission.event-side-trip:disabled{opacity:1!important;cursor:default}

/* A tracked side trip is an overlay INSIDE its assigned intervention, never a new lane. */
.calendar-event .calendar-nested-trip{
 position:absolute;left:1px;right:1px;z-index:1;display:flex;flex-direction:column;
 justify-content:flex-start;gap:1px;min-height:0;overflow:hidden;box-sizing:border-box;
 border:1px solid #3279b9;border-left:3px solid #3279b9;border-radius:4px;
 padding:2px 4px;background:#d4eaff;color:#173c60;
 font-size:.64rem;line-height:1.15;text-align:left;pointer-events:none;
}
.calendar-event .nested-trip-time{font-size:.62rem;font-weight:800}
.calendar-event .nested-trip-title{font-size:.64rem;font-weight:700;overflow:hidden;text-overflow:ellipsis}
.calendar-event .nested-trip-person{font-size:.58rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.calendar-week .calendar-event .calendar-nested-trip{padding:1px 2px;border-left-width:2px}
.calendar-week .calendar-event .nested-trip-title,.calendar-week .calendar-event .nested-trip-person{display:none}
:root[data-theme="dark"] .calendar-event .calendar-nested-trip{background:#214e75;color:#f1f8ff;border-color:#64a9e3}

/* Compact travel markers: preserve chronological position, not text in tiny intervals. */
.calendar-event .calendar-nested-trip{
 min-height:0!important;padding:0!important;border:0!important;border-left:3px solid #89c8ff!important;
 border-radius:2px!important;background:#3279b9!important;box-shadow:0 0 0 1px #0f2945;
 opacity:.92;pointer-events:none;
}

/* Employee identity stripe, independent of the intervention status fill. */
.calendar-event[data-staff-colors],.month-mission[data-staff-colors]{border-left-color:transparent!important}
.month-mission[data-staff-colors]{position:relative}
.calendar-event[data-staff-colors]::before,.month-mission[data-staff-colors]::before{
 content:'';position:absolute;left:0;top:0;bottom:0;width:4px;
 background:var(--staff-stripes,#64748b);pointer-events:none;border-radius:4px 0 0 4px
}
.member-planning-color{margin:14px 0;padding:12px;border:1px solid var(--line);border-radius:12px}
.member-color-controls{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.member-color-controls select{flex:1 1 130px;min-width:0}
.member-color-controls button{flex:1 1 170px}

.member-color-palette{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin:10px 0}
.member-color-choice{position:relative;display:grid;place-items:center;min-height:44px;cursor:pointer}
.member-color-choice input{position:absolute;opacity:0;width:100%;height:100%;margin:0;cursor:pointer}
.member-color-choice span{display:block;width:34px;height:34px;border-radius:50%;background:var(--staff-choice);border:2px solid #fff;box-shadow:0 0 0 1px #718096}
.member-color-choice input:checked+span{box-shadow:0 0 0 3px var(--staff-choice),0 0 0 5px #fff}
.member-color-choice input:focus-visible+span{outline:3px solid #fff;outline-offset:4px}
.staff-color-0{--staff-choice:#E11D48}.staff-color-1{--staff-choice:#F97316}
.staff-color-2{--staff-choice:#EAB308}.staff-color-3{--staff-choice:#16A34A}
.staff-color-4{--staff-choice:#0D9488}.staff-color-5{--staff-choice:#0284C7}
.staff-color-6{--staff-choice:#2563EB}.staff-color-7{--staff-choice:#7C3AED}
.staff-color-8{--staff-choice:#DB2777}.staff-color-9{--staff-choice:#64748B}

/* Planning controls live in the title row; keep the calendar as the sole flexible region. */
.planning-page .page-title-row{display:flex;align-items:center;justify-content:space-between;gap:12px;position:relative;z-index:5}
.planning-page .page-title-row h1{min-width:0;margin:0}
.planning-page .planning-options{position:relative;flex:0 0 auto;margin:0}
.planning-page .planning-options>summary{list-style:none;display:grid;place-items:center;width:44px;height:44px;border:1px solid var(--line);border-radius:12px;background:var(--surface-2,#26364d);color:inherit;font-size:1.65rem;cursor:pointer;touch-action:manipulation}
.planning-page .planning-options>summary::-webkit-details-marker{display:none}
.planning-page .planning-options[open]>summary{outline:2px solid #b30d2d;outline-offset:2px}
/* Valeurs claires par défaut ; le thème sombre fournit ses propres couleurs. */
.planning-page .planning-options-panel{position:absolute;right:0;top:calc(100% + 10px);z-index:120;width:min(340px,calc(100vw - 40px));max-height:min(65dvh,550px);overflow:auto;padding:14px;background:var(--surface,#fff);color:var(--text,#202735);border:1px solid var(--line);border-radius:16px;box-shadow:0 14px 40px #0006}
.planning-page .planning-options-types,.planning-page .planning-options-views{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.planning-page .planning-options-views{grid-template-columns:repeat(4,minmax(0,1fr))}
.planning-page .planning-options-panel a{display:grid;place-items:center;min-height:42px;padding:8px 4px;border-radius:10px;border:1px solid var(--line);color:inherit;text-decoration:none;text-align:center;font-size:.83rem;font-weight:650}
.planning-page .planning-options-panel a[aria-current="page"]{background:#b30d2d;color:white;border-color:#b30d2d}
.planning-page .planning-options-label{font-size:.82rem;font-weight:700;margin:14px 0 8px}
.planning-page .planning-options-legend{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;font-size:.78rem}
.planning-page .planning-options-legend span{display:flex;align-items:center;gap:6px}
.planning-page .planning-options-legend i{display:inline-block;flex:0 0 12px;width:12px;height:12px;border-radius:4px}
.planning-page>.calendar-legend,.planning-page>.planning-toolbar,.planning-page>.planning-view-switch{display:none!important}
.planning-page:has(.calendar-scroll) .calendar-legend{display:none!important}
.planning-page:has(.calendar-scroll){min-height:0}
.planning-page:has(.calendar-scroll) .calendar-scroll{flex:1 1 0;min-height:0}
@media(max-width:767px){
 .planning-page:has(.calendar-scroll){padding-bottom:12px!important}
 .planning-page .page-title-row{margin-bottom:12px}
}
@media (min-width:768px) and (orientation:landscape){
 .planning-page:has(> .planning-view-switch){display:flex;flex-direction:column}
 .planning-page:has(> .planning-view-switch)>*{grid-column:auto;grid-row:auto}
}

/* L’icône sans cadre hérite de la couleur du texte pour rester lisible dans les deux thèmes. */
.planning-page .planning-options>summary{width:46px;height:46px;padding:5px;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;outline:none!important;color:inherit;font-size:inherit}
.planning-page .planning-options>summary svg{width:34px;height:34px;display:block}
.planning-page .planning-options[open]>summary{outline:none!important}
.planning-page .planning-options>summary:focus-visible{outline:2px solid #b30d2d!important;outline-offset:2px!important;border-radius:8px!important}
/* The status swatch previously depended on the removed footer legend. */
.planning-page .planning-options-legend .legend-side-trip{background:#3279b9;border:1px solid #173c60}
.planning-page .planning-options-legend .legend-planned{background:#b30d2d}
.planning-page .planning-options-legend .legend-progress{background:#17669a}
.planning-page .planning-options-legend .legend-done{background:#207550}

/* Further halve the calendar's top and bottom breathing room. */
.planning-page .page-title-row{margin-bottom:3px}
.planning-page .calendar-scroll{margin-top:5px}
.planning-page .calendar-overview{margin-top:5px}
@media(max-width:767px){
  .planning-page:has(.calendar-scroll){padding-bottom:3px!important}
  .planning-page .page-title-row{margin-bottom:3px}
}

/* iOS-inspired quarter-hour picker; inherits OrgaSAV's selected light/dark theme. */
.planning-page input[data-quarter-time]{cursor:pointer;caret-color:transparent;touch-action:manipulation}
.quarter-picker-backdrop{position:fixed;inset:0;z-index:10050;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(0,0,0,.58);box-sizing:border-box}
.quarter-picker{--qp-bg:#f1f2f6;--qp-fg:#171b25;--qp-muted:#737986;--qp-highlight:rgba(130,135,150,.18);--qp-rule:rgba(85,95,110,.16);position:relative;width:min(100%,350px);padding:16px 12px 14px;border-radius:30px;background:var(--qp-bg);color:var(--qp-fg);box-shadow:0 18px 60px rgba(0,0,0,.28);box-sizing:border-box}
:root[data-theme="dark"] .quarter-picker{--qp-bg:#292a2e;--qp-fg:#f8f8fa;--qp-muted:#98999f;--qp-highlight:rgba(145,148,160,.20);--qp-rule:rgba(255,255,255,.10)}
.quarter-picker-heading{text-align:center;font-weight:650;font-size:16px;margin:2px 0 8px}
.quarter-picker-wheels{height:240px;display:flex;justify-content:center;gap:4px;position:relative;overflow:hidden;mask-image:linear-gradient(to bottom,transparent 0%,black 23%,black 77%,transparent 100%);-webkit-mask-image:linear-gradient(to bottom,transparent 0%,black 23%,black 77%,transparent 100%)}
.quarter-picker-highlight{position:absolute;z-index:0;pointer-events:none;left:5px;right:5px;top:96px;height:48px;border-radius:13px;background:var(--qp-highlight);border-top:1px solid var(--qp-rule);border-bottom:1px solid var(--qp-rule)}
.quarter-wheel{position:relative;z-index:1;width:86px;height:240px;overflow-y:auto;scroll-snap-type:y mandatory;overscroll-behavior:contain;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.quarter-wheel::-webkit-scrollbar{display:none}
.quarter-wheel-pad{height:96px;flex:none;scroll-snap-align:none}
.quarter-wheel-item{display:flex;align-items:center;justify-content:center;width:100%;height:48px;min-height:48px;padding:0;border:0;background:transparent!important;color:var(--qp-muted)!important;font-size:27px;font-weight:400;line-height:1;scroll-snap-align:center;scroll-snap-stop:always;box-shadow:none!important;border-radius:0!important}
.quarter-wheel-item[aria-selected="true"]{color:var(--qp-fg)!important;font-weight:500}
.quarter-picker-actions{display:flex;align-items:center;justify-content:space-between;margin-top:10px;padding:0 6px}
.quarter-picker-actions button{font-family:inherit;border:0;cursor:pointer}
.quarter-picker-actions [data-quarter-reset]{padding:12px 16px;border-radius:28px;color:var(--qp-fg);background:var(--qp-highlight);font-size:17px}
.quarter-picker-actions [data-quarter-confirm]{width:52px;height:52px;border-radius:50%;background:#0a84ff;color:white;font-size:32px;line-height:1}
@media(max-height:560px){.quarter-picker-wheels,.quarter-wheel{height:192px}.quarter-wheel-pad{height:72px}.quarter-picker-highlight{top:72px}}

/* Native dialog top layer prevents the planning form and fixed footer covering the picker. */
dialog.quarter-picker-backdrop{position:fixed!important;inset:0!important;top:0!important;left:0!important;right:0!important;bottom:0!important;margin:0!important;width:100vw!important;max-width:none!important;height:100dvh!important;max-height:none!important;padding:16px!important;border:0!important;border-radius:0!important;overflow:hidden!important;box-sizing:border-box!important;display:flex;align-items:center;justify-content:center;background:transparent!important;color:inherit}
dialog.quarter-picker-backdrop:not([open]){display:none!important}
dialog.quarter-picker-backdrop::backdrop{background:rgba(0,0,0,.62)}
dialog.quarter-picker-backdrop .quarter-picker{flex:0 1 350px;max-width:calc(100vw - 32px)}

/* iPhone polish: remove the browser's rectangular dialog frame and focus ring.
   Only the rounded picker card should be visible above the dimmed form. */
html body dialog.quarter-picker-backdrop[open]{
  position:fixed!important;inset:0!important;display:flex!important;
  align-items:center!important;justify-content:center!important;
  width:100%!important;height:100dvh!important;max-width:none!important;max-height:none!important;
  margin:0!important;padding:20px!important;box-sizing:border-box!important;
  border:0!important;outline:0!important;outline-offset:0!important;
  border-radius:0!important;background:transparent!important;background-color:transparent!important;
  box-shadow:none!important;filter:none!important;overflow:hidden!important;
  -webkit-appearance:none!important;appearance:none!important;
}
html body dialog.quarter-picker-backdrop[open]::backdrop{background:rgba(0,0,0,.64)!important}
html body dialog.quarter-picker-backdrop[open]>.quarter-picker{
  flex:0 1 320px!important;width:min(320px,calc(100vw - 40px))!important;
  max-width:100%!important;margin:0 auto!important;
  padding:18px 14px 16px!important;border:0!important;outline:0!important;
  border-radius:28px!important;background:var(--qp-bg)!important;
  box-shadow:0 14px 42px #0005!important;
}
html body dialog.quarter-picker-backdrop[open] .quarter-picker-heading{margin:0 0 10px!important}
html body dialog.quarter-picker-backdrop[open] .quarter-picker-actions{gap:12px}
html body dialog.quarter-picker-backdrop[open] .quarter-picker-actions [data-quarter-reset]{flex:1 1 auto;min-width:0}
html body dialog.quarter-picker-backdrop[open] .quarter-picker-actions [data-quarter-confirm]{flex:0 0 52px}


/* Read-only technician key, using the same stripes as intervention cards. */
.planning-options-staff i[data-staff-colors]{background:var(--staff-stripes,#64748B)}
.planning-options-staff span{min-width:0;overflow-wrap:anywhere}

.calendar-event.event-to_continue,.month-mission.event-to_continue{background:#fff5df;color:#76511b;border:2px dashed #b7791f}
:root[data-theme="dark"] .calendar-event.event-to_continue,:root[data-theme="dark"] .month-mission.event-to_continue{background:#48391f;color:#ffe2a2;border-color:#bd914c}
