:root {
  --red: #B3241F; --red-deep: #8F1B17; --red-soft: #F8E7E5;
  --ink: #1C1A19; --ink2: #2A2420; --muted: #6B6259;
  --cream: #FAF6F1; --cream2: #F1EAE1; --line: #E8DFD3; --white: #fff;
  --c-rdv: #B3241F;      --bg-rdv: #FBE9E7;
  --c-evenement: #A86A12; --bg-evenement: #FBF0DC;
  --c-reunion: #3B3430;   --bg-reunion: #ECE7E2;
  --c-echeance: #2F6B55;  --bg-echeance: #E3F1EB;
  --c-autre: #6F655C;     --bg-autre: #EFEBE6;
  --shadow: 0 1px 2px rgba(28,26,25,.05), 0 8px 28px rgba(28,26,25,.07);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--red); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- en-tête compact ---------- */
.top { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); border-top: 3px solid var(--red); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 6px max(16px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 12px; min-height: 48px; }
.brand { display: flex; align-items: center; }
.brand img { display: block; height: 28px; width: auto; max-width: 46vw; }
.top h1 { margin: 0; padding-left: 12px; border-left: 2px solid var(--line); font-size: 1rem; font-weight: 700; letter-spacing: 0; color: var(--ink); }
.mode-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--red-soft); color: var(--red-deep); border-radius: 999px; padding: 2px 11px; font-size: .76rem; font-weight: 700; }
.mode-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2F9E6B; }
.grow { flex: 1; }
.who { color: var(--muted); font-size: .9rem; font-weight: 600; }

/* ---------- mise en page ---------- */
.layout { max-width: 1240px; margin: 0 auto; padding: 14px max(16px, env(safe-area-inset-left)) 6px; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
.main-col { min-width: 0; }
.side { display: grid; gap: 18px; position: sticky; top: 16px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 1.1rem; font-weight: 700; }
.status { min-height: 0; color: var(--muted); font-size: .86rem; margin: 0 0 6px; }
.status:empty { display: none; }
.status.err { color: var(--red-deep); font-weight: 600; }

/* ---------- filtres ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.legend button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--white); color: var(--ink); border-radius: 999px; padding: 4px 12px 4px 9px; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; transition: background .15s, opacity .15s, transform .15s; }
.legend button:hover { background: var(--cream2); transform: translateY(-1px); }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.legend button[aria-pressed="false"] { opacity: .5; }
.legend button[aria-pressed="false"] .dot { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }

/* ---------- boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: .92rem; font-weight: 650; border-radius: 999px; padding: 10px 20px; border: 1px solid transparent; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; text-decoration: none; line-height: 1.2; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--red); color: var(--white); box-shadow: 0 6px 16px rgba(179,36,31,.28); }
.btn.primary:hover { background: var(--red-deep); }
.btn.soft { background: rgba(255,255,255,.8); color: var(--ink); border-color: var(--line); backdrop-filter: blur(6px); }
.btn.soft:hover { background: var(--white); box-shadow: 0 4px 14px rgba(28,26,25,.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--cream2); }
.btn.danger { background: var(--white); color: var(--red-deep); border-color: #E3B7B3; }
.btn.danger:hover { background: var(--red-deep); color: var(--white); border-color: var(--red-deep); }
.btn.small { padding: 7px 14px; font-size: .84rem; }
.btn.wide { width: 100%; }
.btn:focus-visible, .x:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .up-item:focus-visible, .legend button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.btn[disabled] { opacity: .6; cursor: wait; transform: none; }
.editbar .btn.primary { box-shadow: none; }

/* ---------- panneau « À venir » ---------- */
.upcoming { display: grid; gap: 6px; }
.up-item { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 14px; padding: 8px; font: inherit; color: inherit; cursor: pointer; transition: background .15s; }
.up-item:hover { background: var(--cream); }
.up-date { display: grid; place-items: center; width: 54px; height: 58px; border-radius: 14px; background: var(--bg); color: var(--c); line-height: 1; }
.up-date b { font-family: var(--display); font-size: 1.45rem; font-weight: 750; }
.up-date span { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }
.up-title { font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.up-meta { color: var(--muted); font-size: .84rem; margin-top: 2px; }
.up-empty { color: var(--muted); font-size: .92rem; padding: 6px 2px; }
.sub-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- calendrier ---------- */
#calendar { margin: -4px; }
.fc { --fc-border-color: var(--line); --fc-today-bg-color: transparent; --fc-neutral-bg-color: var(--cream); --fc-list-event-hover-bg-color: var(--cream); --fc-page-bg-color: transparent; --fc-event-border-color: transparent; font-family: var(--font); }
.fc .fc-toolbar { gap: 8px 12px; margin-bottom: 10px !important; flex-wrap: wrap; }
.fc .fc-toolbar-title { font-family: var(--display); font-size: clamp(1.25rem, 3.4vw, 1.6rem); font-weight: 750; letter-spacing: -.02em; text-transform: capitalize; }
.fc .fc-button { background: var(--white); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; font-size: .86rem; font-weight: 650; padding: 7px 15px; text-transform: none; box-shadow: none !important; transition: background .15s; }
.fc .fc-button:hover { background: var(--cream2); color: var(--ink); border-color: var(--line); }
.fc .fc-button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.fc .fc-button-primary:disabled { background: var(--cream); color: var(--muted); border-color: var(--line); opacity: .7; }
.fc .fc-button-group { gap: 0; }
.fc .fc-button-group > .fc-button { border-radius: 0; margin: 0; }
.fc .fc-button-group > .fc-button:first-child { border-radius: 999px 0 0 999px; }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 999px 999px 0; }
.fc .fc-button-group > .fc-button:only-child { border-radius: 999px; }
.fc .fc-button-group > .fc-button + .fc-button { margin-left: -1px; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--ink2); color: var(--white); border-color: var(--ink2); }
.fc .fc-today-button { background: var(--red-soft); color: var(--red-deep); border-color: #F0CDC9; }
.fc .fc-today-button:hover { background: #F3D5D1; color: var(--red-deep); }
.fc .fc-scrollgrid { border-radius: 14px; overflow: hidden; border-color: var(--line); }
.fc .fc-col-header-cell { background: var(--cream); padding: 9px 0; }
.fc .fc-col-header-cell-cushion { color: var(--muted); font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; }
.fc .fc-daygrid-day-number { color: var(--ink); font-weight: 600; font-size: .9rem; text-decoration: none; padding: 6px 8px; }
.fc .fc-day-other .fc-daygrid-day-number { color: #B5ABA0; }
.fc .fc-day-sat, .fc .fc-day-sun { background: #FDFBF8; }
.fc .fc-day-today { background: #FFF7F3 !important; }
.fc .fc-day-today .fc-daygrid-day-number { background: var(--red); color: var(--white); border-radius: 999px; min-width: 28px; height: 28px; display: grid; place-items: center; margin: 4px 4px 0 0; padding: 0; }
.fc .fc-daygrid-day-frame { min-height: 92px; }
.fc .fc-more-link { color: var(--muted); font-weight: 700; font-size: .78rem; }
.fc .fc-popover { border-radius: 14px; border-color: var(--line); box-shadow: var(--shadow); overflow: hidden; }
.fc .fc-popover-header { background: var(--cream); }
.fc .fc-timegrid-slot-label-cushion, .fc .fc-timegrid-axis-cushion { font-size: .78rem; color: var(--muted); }
.fc .fc-timegrid-now-indicator-line { border-color: var(--red); }
.fc .fc-timegrid-now-indicator-arrow { border-color: var(--red); border-top-color: transparent; border-bottom-color: transparent; }

/* pastilles d'événement */
.fc .fc-event { cursor: pointer; border-radius: 8px; transition: transform .12s, box-shadow .12s; }
.fc .fc-event:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(28,26,25,.14); }
.fc .fc-h-event, .fc .fc-v-event { background: var(--bg, var(--bg-autre)); border: 0; border-left: 4px solid var(--c, var(--c-autre)); color: var(--ink); }
.fc .fc-h-event .fc-event-main, .fc .fc-v-event .fc-event-main { color: var(--ink); padding: 1px 4px; font-weight: 600; font-size: .82rem; }
.fc .fc-event-time { font-weight: 700; color: var(--c); }
.fc .fc-daygrid-dot-event { background: transparent; border-left: 0; padding: 2px 4px; }
.fc .fc-daygrid-dot-event:hover { background: var(--bg); }
.fc .fc-daygrid-event-dot { border-color: var(--c, var(--c-autre)); }
.fc .fc-event.draft { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.55) 0 6px, transparent 6px 12px); border-style: dashed; }
.fc-theme-standard .fc-list { border-radius: 14px; border-color: var(--line); overflow: hidden; }
.fc .fc-list-day-cushion { background: var(--cream); }
.fc .fc-list-day-text, .fc .fc-list-day-side-text { color: var(--ink); font-weight: 700; text-decoration: none; text-transform: capitalize; }
.fc .fc-list-event td { padding: 11px 14px; }
.fc .fc-list-event-dot { border-color: var(--c, var(--c-autre)); border-width: 6px; }
.fc .fc-list-event:hover td { background: var(--cream); }
.fc .fc-list-empty { color: var(--muted); }

.foot { text-align: center; color: var(--muted); font-size: .86rem; padding: 18px 20px 40px; }

/* ---------- fenêtres ---------- */
.modal { position: fixed; inset: 0; background: rgba(28,26,25,.5); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px; overflow-y: auto; z-index: 50; animation: fade .18s ease-out; }
.card { position: relative; background: var(--white); border-radius: 24px; padding: 30px 28px 26px; width: 100%; max-width: 640px; box-shadow: 0 24px 70px rgba(0,0,0,.3); overflow: hidden; animation: rise .22s cubic-bezier(.2,.8,.2,1); }
.card.small { max-width: 430px; }
.band { position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--c, var(--red)); }
.card h2 { margin: 12px 0 14px; font-size: clamp(1.4rem, 4vw, 1.75rem); line-height: 1.15; font-weight: 750; padding-right: 36px; }
.x { position: absolute; top: 16px; right: 14px; width: 38px; height: 38px; border: 0; background: var(--cream); font-size: 1.5rem; line-height: 1; color: var(--muted); cursor: pointer; border-radius: 50%; transition: background .15s; }
.x:hover { background: var(--cream2); color: var(--ink); }
.chip { display: inline-block; color: var(--c, var(--c-autre)); background: var(--bg, var(--bg-autre)); border-radius: 999px; padding: 4px 13px; font-size: .78rem; font-weight: 750; letter-spacing: .03em; }
.info { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 8px; color: var(--ink); font-weight: 550; overflow-wrap: anywhere; }
.info svg { margin-top: .2em; color: var(--c, var(--red)); }
.desc { white-space: pre-wrap; margin: 16px 0 6px; padding: 14px 16px; background: var(--cream); border-radius: 14px; overflow-wrap: anywhere; }
.sec { margin: 18px 0 8px; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.files { display: grid; gap: 8px; }
.file { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px 8px 8px; text-decoration: none; color: var(--ink); background: var(--white); font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; transition: background .15s, transform .15s; }
.file:hover { background: var(--cream); transform: translateY(-1px); }
.file img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; flex: none; }
.file .ico { width: 52px; height: 52px; flex: none; display: grid; place-items: center; background: var(--red-soft); color: var(--red-deep); border-radius: 10px; font-weight: 800; font-size: .72rem; letter-spacing: .04em; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.confirm-text { margin: 10px 0 0; font-size: 1.05rem; font-weight: 600; padding-right: 30px; }

label { display: block; margin: 14px 0 0; font-weight: 650; font-size: .9rem; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
input:not([type=checkbox]):not([type=file]), select, textarea { display: block; width: 100%; margin-top: 5px; font: inherit; padding: 11px 13px; border: 1px solid #D9CEC0; border-radius: 12px; background: var(--white); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:not([type=checkbox]):not([type=file]):focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(179,36,31,.15); outline: none; }
input[type=file] { margin-top: 8px; font: inherit; font-size: .9rem; max-width: 100%; }
input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--red); flex: none; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
fieldset { border: 1px solid var(--line); border-radius: 14px; margin: 18px 0 0; padding: 8px 14px 14px; }
legend { font-weight: 650; font-size: .9rem; padding: 0 6px; }
.exist { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; overflow-wrap: anywhere; }
.err { color: var(--red-deep); font-weight: 650; margin: 14px 0 0; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- tablette et téléphone ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .side { grid-template-columns: 1fr; }
  .hide-s { display: none; }
  .panel { padding: 14px; border-radius: 18px; }
  .row { grid-template-columns: 1fr; }
  .modal { padding: 0; align-items: flex-end; }
  .card { max-width: none; border-radius: 24px 24px 0 0; padding: 28px 18px 24px; max-height: 94vh; overflow-y: auto; animation: sheet .26s cubic-bezier(.2,.8,.2,1); }
  .card.small { max-width: none; }
  .fc .fc-toolbar { flex-direction: column; align-items: stretch; text-align: center; }
  .fc .fc-toolbar-chunk { display: flex; justify-content: center; gap: 8px; }
  .fc .fc-daygrid-day-frame { min-height: 84px; }
  .btn { padding: 11px 18px; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .6; } }
@media print { .bar-right, .editbar, .legend, .side, .fc-toolbar { display: none !important; } body, .hero { background: #fff; } .panel { box-shadow: none; } }


/* ---------- espace administratrice et import ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tile { display: grid; gap: 6px; text-align: left; font: inherit; color: var(--ink); background: var(--cream); border: 1px solid var(--line); border-radius: 18px; padding: 18px; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.tile:hover { background: var(--white); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.tile b { font-family: var(--display); font-size: 1.05rem; }
.tile span:not(.tile-ico) { color: var(--muted); font-size: .86rem; line-height: 1.4; }
.tile-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--red); color: var(--white); }
.tile-ico svg { width: 22px; height: 22px; }
.tip { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 0; padding: 12px 14px; background: var(--red-soft); color: var(--red-deep); border-radius: 14px; font-size: .9rem; }
.tip svg { margin-top: .15em; }
.card.wide { max-width: 860px; }
.drop { display: grid; justify-items: center; gap: 6px; text-align: center; border: 2px dashed #D9CEC0; border-radius: 18px; padding: 30px 16px; margin: 14px 0 6px; cursor: pointer; background: var(--cream); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--red); background: var(--red-soft); }
.drop svg { width: 34px; height: 34px; color: var(--red); }
.drop small { color: var(--muted); }
.sum { margin: 6px 0 10px; font-weight: 650; }
.imp-list { display: grid; gap: 10px; max-height: 52vh; overflow-y: auto; padding: 2px; margin-bottom: 6px; }
.imp { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--c-autre)); border-radius: 14px; padding: 10px 12px 12px; background: var(--white); display: grid; gap: 8px; }
.imp.off { opacity: .45; }
.imp-top { display: flex; align-items: center; gap: 10px; }
.imp-top input[type=text], .imp-top input:not([type]) { margin-top: 0; font-weight: 650; }
.imp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 8px; align-items: end; }
.imp-grid label { margin: 0; font-size: .76rem; color: var(--muted); font-weight: 650; }
.imp-grid input:not([type=checkbox]), .imp-grid select { padding: 7px 9px; font-size: .88rem; border-radius: 10px; margin-top: 3px; }
.imp-grid label.check { align-self: end; padding-bottom: 7px; color: var(--ink); font-size: .84rem; }
.imp-src { color: var(--muted); font-size: .76rem; }
.sk { font-style: italic; }

@media (max-width: 700px) {
  .top-in { gap: 8px; }
  .top h1 { font-size: .95rem; padding-left: 8px; }
  .brand img { height: 24px; }
  .btn.small .lbl { display: none; }
  .tiles { grid-template-columns: 1fr; }
  .layout { padding-top: 10px; }
  .card.wide { max-width: none; }
}
