/* ============================================================
   Agenda partagé LFPL — styles (colonne droite + fenêtres).
   Réutilise les variables de charte définies dans accueil/index.php
   (--marine, --nuit, --voile, --line, --encre*, --or, --titre, --texte…).
   Chargé APRÈS le <style> d'index.php : les quelques surcharges de mise
   en page (.pf-shell / .pf-main) l'emportent volontairement.
   ============================================================ */

/* ── Disposition à deux colonnes ── */
.pf-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: start;
}
.pf-shell > .pf-main {
    max-width: none;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
}

/* ── Colonne agenda ── */
.agenda {
    position: sticky;
    top: 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--ombre);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 36px);
    margin-top: 34px;
}
.agenda-head { background: linear-gradient(160deg, var(--marine), var(--nuit)); color: #fff; padding: 18px 18px 16px; }
.agenda-head .row { display: flex; align-items: center; gap: 10px; }
.agenda-head .ic-cal { width: 40px; height: 40px; border-radius: 11px; flex: 0 0 auto; background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; }
.agenda-head .ic-cal svg { width: 22px; height: 22px; }
.agenda-head h2 { font-family: var(--titre); font-weight: 400; text-transform: uppercase; letter-spacing: .02em; font-size: 1.15rem; margin: 0; line-height: 1; }
.agenda-head .sub { margin: 3px 0 0; font-size: .76rem; color: rgba(255,255,255,.72); }

.btn-row { display: flex; gap: 9px; margin-top: 15px; }
.btn-add {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    background: var(--or); color: var(--nuit); border: 0; border-radius: 11px;
    padding: 12px 14px; font: 800 .92rem/1 var(--texte); letter-spacing: .01em; cursor: pointer;
    min-height: 46px; transition: filter .12s, transform .12s;
}
.btn-add:hover { filter: brightness(1.06); }
.btn-add:active { transform: translateY(1px); }
.btn-add svg { width: 18px; height: 18px; }
.btn-month {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: rgba(255,255,255,.10); color: #fff; border: 1px solid rgba(255,255,255,.28);
    border-radius: 11px; padding: 12px 14px; font: 700 .88rem/1 var(--texte); cursor: pointer;
    min-height: 46px; transition: background .12s;
}
.btn-month:hover { background: rgba(255,255,255,.20); }
.btn-month svg { width: 18px; height: 18px; }

.agenda .legend { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); background: #FAFBFD; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; color: var(--encre-2); }
.legend .lg i { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

.events { overflow-y: auto; padding: 6px 14px 16px; min-height: 120px; }
.day-group { margin-top: 12px; }
.day-label { font-size: .68rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--encre-3); margin: 6px 4px 8px; display: flex; align-items: center; gap: 8px; }
.day-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.event { position: relative; display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px 11px 14px; margin-bottom: 9px; overflow: hidden; }
.event::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--evc, var(--marine)); }
.event .date-box { flex: 0 0 auto; width: 46px; text-align: center; border-radius: 9px; background: var(--voile); padding: 6px 0; line-height: 1; }
.event .date-box .d { font-family: var(--titre); font-size: 1.3rem; color: var(--marine); display: block; }
.event .date-box .m { font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--encre-3); display: block; margin-top: 2px; }
.event .body { min-width: 0; flex: 1; }
.event .title { font-weight: 700; font-size: .92rem; color: var(--encre); margin: 0; overflow-wrap: break-word; }
.event .meta { margin: 3px 0 0; font-size: .76rem; color: var(--encre-3); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.event .chip { display: inline-flex; align-items: center; gap: 5px; font-size: .68rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; color: var(--evc); background: var(--evc-soft); text-transform: uppercase; letter-spacing: .03em; }
.event .chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--evc); }
.event .time { font-weight: 700; color: var(--encre-2); }
.event .del { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent; color: var(--encre-3); cursor: pointer; display: none; align-items: center; justify-content: center; }
.event .edit { position: absolute; top: 8px; right: 38px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent; color: var(--encre-3); cursor: pointer; display: none; align-items: center; justify-content: center; }
.event:hover .del, .event:focus-within .del, .event:hover .edit, .event:focus-within .edit { display: flex; }
.event .del:hover { background: #FBECEC; color: var(--rouge); }
.event .edit:hover { background: var(--voile); color: var(--marine); }
.event .del svg, .event .edit svg { width: 15px; height: 15px; }

/* Lien de téléchargement .ics (en-tête sombre) */
.ag-ics { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; color: #fff; font-size: .8rem; font-weight: 700; text-decoration: none; opacity: .92; }
.ag-ics:hover { opacity: 1; text-decoration: underline; }
.ag-ics svg { width: 15px; height: 15px; color: var(--or); flex: 0 0 auto; }

.ag-state { text-align: center; color: var(--encre-3); padding: 26px 16px; }
.ag-state svg { width: 34px; height: 34px; color: var(--trait); }
.ag-state p { margin: 10px 0 0; font-size: .86rem; }
.ag-state .ag-retry { margin-top: 12px; border: 1px solid var(--trait); background: #fff; color: var(--marine); font-weight: 700; border-radius: 9px; padding: 8px 14px; cursor: pointer; }
.ag-spinner { width: 30px; height: 30px; border: 3px solid var(--voile); border-top-color: var(--marine); border-radius: 50%; margin: 6px auto 0; animation: ag-spin .8s linear infinite; }
@keyframes ag-spin { to { transform: rotate(360deg); } }

/* ── Fenêtres modales ── */
.ag-overlay { position: fixed; inset: 0; background: rgba(16,23,45,.55); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity .18s; }
.ag-overlay.open { opacity: 1; pointer-events: auto; }
.ag-modal { background: #fff; border-radius: 18px; box-shadow: 0 26px 60px -28px rgba(16,28,51,.55); width: 100%; max-width: 440px; max-height: calc(100vh - 36px); overflow-y: auto; transform: translateY(8px) scale(.98); transition: transform .18s; }
.ag-overlay.open .ag-modal { transform: none; }
.ag-modal-wide { max-width: 760px; }
.ag-modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.ag-modal-head h2 { font-family: var(--titre); font-weight: 400; text-transform: uppercase; letter-spacing: .02em; color: var(--marine); font-size: 1.15rem; margin: 0; }
.ag-close { margin-left: auto; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--encre-2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ag-close:hover { background: #F4F7FB; }
.ag-close svg { width: 17px; height: 17px; }
.ag-modal-body { padding: 18px 20px 4px; }
.ag-field { margin-bottom: 16px; }
.ag-field > label { display: block; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--encre-2); margin-bottom: 7px; }
.ag-opt { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--encre-3); }
.ag-field input[type="text"], .ag-field input[type="time"] { width: 100%; padding: 11px 13px; font: inherit; font-size: .95rem; color: var(--encre); background: #fff; border: 1px solid var(--trait); border-radius: 10px; min-height: 46px; }
.ag-field input:focus { outline: none; border-color: var(--bleu-vif); box-shadow: 0 0 0 3px rgba(82,113,255,.25); }
.ag-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ag-hint { font-size: .74rem; color: var(--encre-3); margin: 6px 0 0; }
.ag-hint.warn { color: var(--ambre); font-weight: 700; }

.ag-cal { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #FAFBFD; }
.ag-cal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ag-mlabel { font-weight: 800; color: var(--marine); font-size: .95rem; text-transform: capitalize; }
.ag-cal-nav { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--marine); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ag-cal-nav:hover { background: var(--voile); }
.ag-cal-nav svg { width: 16px; height: 16px; }
.ag-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.ag-cal-grid .dow { text-align: center; font-size: .66rem; font-weight: 800; color: var(--encre-3); text-transform: uppercase; padding: 4px 0; }
.ag-cal-day { aspect-ratio: 1; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; color: var(--encre); display: flex; align-items: center; justify-content: center; position: relative; }
.ag-cal-day:hover:not(.void) { background: var(--voile); }
.ag-cal-day.void { cursor: default; color: transparent; }
.ag-cal-day.past { color: #C0C6CF; cursor: not-allowed; }
.ag-cal-day.today { box-shadow: inset 0 0 0 1.5px var(--trait); }
.ag-cal-day.sel { background: var(--marine); color: #fff; }
.ag-cal-day.sel:hover { background: var(--marine); }
.ag-cal-day.has-ev { font-weight: 800; }
.ag-cal-day .dots { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; gap: 2px; justify-content: center; pointer-events: none; }
.ag-cal-day .dots i { width: 4.5px; height: 4.5px; border-radius: 50%; }
.ag-cal-day.sel .dots i { box-shadow: 0 0 0 1px rgba(255,255,255,.7); }

.ag-daylist { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: #FAFBFD; padding: 8px 10px; }
.ag-daylist .dl-head { margin: 0 0 4px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ambre); }
.dl-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: .82rem; }
.dl-item + .dl-item { border-top: 1px dashed var(--line); }
.dl-item > i { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.dl-item .t { font-weight: 800; color: var(--encre-2); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.dl-item .n { color: var(--encre); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-item .tag { margin-left: auto; font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }

.ag-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ag-type-opt { position: relative; }
.ag-type-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.ag-type-opt label { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 11px; cursor: pointer; font-size: .84rem; font-weight: 700; color: var(--encre-2); transition: border-color .12s, background .12s; }
.ag-type-opt label .ag-sw { width: 16px; height: 16px; border-radius: 6px; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.ag-type-opt label:hover { background: #FAFBFD; }
.ag-type-opt input:checked + label { border-color: var(--oc); background: var(--oc-soft); color: var(--encre); }
.ag-type-opt input:checked + label::after { content: '✓'; margin-left: auto; color: var(--oc); font-weight: 900; }
.ag-type-opt input:focus-visible + label { outline: 3px solid var(--bleu-vif); outline-offset: 2px; }

.ag-mailrow { display: flex; gap: 11px; align-items: flex-start; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: #FAFBFD; cursor: pointer; }
.ag-mailrow:hover { background: #F4F7FB; }
.ag-mailrow input { margin: 1px 0 0; width: 18px; height: 18px; accent-color: var(--marine); flex: 0 0 auto; cursor: pointer; }
.ag-mr-txt { font-size: .86rem; font-weight: 700; color: var(--encre); display: flex; align-items: center; gap: 7px; }
.ag-mr-txt svg { width: 16px; height: 16px; color: var(--marine); flex: 0 0 auto; }
.ag-mr-sub { display: block; font-size: .74rem; font-weight: 500; color: var(--encre-3); margin-top: 3px; line-height: 1.4; }
.ag-mr-sub strong { color: var(--encre-2); }

.ag-err { color: var(--rouge); font-size: .78rem; font-weight: 700; margin: -8px 0 12px; }
.ag-modal-foot { display: flex; gap: 10px; padding: 8px 20px 20px; }
.ag-btn { flex: 1; border-radius: 11px; padding: 12px 16px; font: 800 .92rem/1.2 var(--texte); cursor: pointer; min-height: 46px; border: 1px solid var(--line); background: #fff; color: var(--encre-2); }
.ag-btn:hover { background: #F4F7FB; }
.ag-btn-primary { background: var(--marine); color: #fff; border-color: var(--marine); }
.ag-btn-primary:hover { background: var(--nuit); }
.ag-btn[disabled] { opacity: .6; cursor: progress; }

/* ── Vue mois ── */
.ag-mv-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #FAFBFD; flex-wrap: wrap; }
.ag-mv-month { font-family: var(--titre); font-weight: 400; text-transform: capitalize; color: var(--marine); font-size: 1.25rem; letter-spacing: .01em; }
.ag-mv-spacer { margin-left: auto; }
.ag-mv-today { border: 1px solid var(--trait); background: #fff; color: var(--marine); font-weight: 700; font-size: .82rem; border-radius: 9px; padding: 8px 12px; cursor: pointer; min-height: 40px; }
.ag-mv-today:hover { background: var(--voile); }
.ag-mv-body { padding: 14px 18px 20px; }
.ag-mv-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.ag-mv-dow span { text-align: center; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--encre-3); }
.ag-mv-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.ag-mv-cell { position: relative; min-height: 96px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer; overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.ag-mv-cell:hover:not(.void):not(.past) { border-color: var(--trait); box-shadow: var(--ombre); }
.ag-mv-cell.void { background: #F6F8FB; cursor: default; border-style: dashed; }
.ag-mv-cell.past { background: #FAFBFD; }
.ag-mv-cell .num { font-weight: 800; font-size: .82rem; color: var(--encre-2); align-self: flex-start; }
.ag-mv-cell.past .num { color: #B4BBC6; }
.ag-mv-cell.today .num { background: var(--marine); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.ag-mv-cell .add-hint { position: absolute; top: 6px; right: 6px; color: var(--trait); opacity: 0; font-size: 1rem; font-weight: 900; line-height: 1; }
.ag-mv-cell:hover:not(.void):not(.past) .add-hint { opacity: 1; color: var(--marine); }
.ag-mv-ev { display: flex; align-items: center; gap: 5px; font-size: .7rem; font-weight: 700; color: var(--evc); background: var(--evc-soft); border-radius: 6px; padding: 2px 6px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-mv-ev i { width: 6px; height: 6px; border-radius: 50%; background: var(--evc); flex: 0 0 auto; }
.ag-mv-ev .h { color: var(--encre-3); font-weight: 800; }
.ag-mv-more { font-size: .66rem; font-weight: 800; color: var(--encre-3); padding: 0 4px; }

/* ── Notification ── */
.ag-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--nuit); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: .88rem; font-weight: 700; box-shadow: 0 26px 60px -28px rgba(16,28,51,.55); z-index: 1100; display: flex; align-items: center; gap: 9px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.ag-toast.show { opacity: 1; transform: translate(-50%, 0); }
.ag-toast svg { width: 18px; height: 18px; color: #7BE0A0; }
.ag-toast.err svg { color: #FF9B9B; }

/* ── Responsive ── */
@media (max-width: 980px) {
    .pf-shell { grid-template-columns: 1fr; }
    .agenda { position: static; max-height: none; margin-top: 24px; }
    .events { max-height: 460px; }
}
@media (max-width: 640px) {
    .pf-shell { padding: 0 16px; }
    .ag-types { grid-template-columns: 1fr; }
    .ag-two { grid-template-columns: 1fr; }
    .btn-month span { display: none; }
    .ag-mv-cell { min-height: 62px; }
    .ag-mv-cell .num { font-size: .74rem; }
    .ag-mv-ev { font-size: .6rem; padding: 1px 4px; }
    .ag-mv-ev .lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .ag-overlay, .ag-overlay .ag-modal, .ag-toast, .ag-spinner { transition: none; animation: none; }
}
