/* =========================================================================
   SIXIÈME AVENUE — Design system (thème clair + sombre)
   Ardoise marine + vert-de-gris · barre latérale · calendrier
   ========================================================================= */
:root {
  --navy:#243845; --navy-soft:#30505f; --teal:#537b79; --teal-light:#8fb3b0;
  --teal-pale:#e7eeed;
  --bg:#eef2f2; --surface:#ffffff; --surface-2:#f7faf9;
  --ink:#233640; --muted:#5f6f75; --line:#dce4e4; --border:#dce4e4;
  --ok:#2e7d5b; --ok-bg:#e6f1ec; --warn:#b8730f; --warn-bg:#f9efdb;
  --none:#6b7c83; --none-bg:#eceff0; --danger:#c0392b; --danger-bg:#fbeaea;
  --side-bg:linear-gradient(180deg,#243845 0%,#22333d 70%,#274048 100%);
  --side-ink:#eaf1f0; --side-muted:#9db4b8; --side-active:#537b79;
  --radius:14px; --radius-sm:9px;
  --shadow:0 1px 2px rgba(36,56,69,.06), 0 8px 24px rgba(36,56,69,.07);
  --shadow-lg:0 18px 50px rgba(36,56,69,.20);
}
:root[data-theme="dark"] {
  --navy:#c9d7dc; --navy-soft:#9db4b8; --teal:#7bb0ab; --teal-light:#8fb3b0;
  --teal-pale:#22323a;
  --bg:#0e1519; --surface:#16232a; --surface-2:#1b2a32;
  --ink:#e6edef; --muted:#93a7ae; --line:#2a3a42; --border:#2a3a42;
  --ok:#57b184; --ok-bg:#173026; --warn:#d69a4a; --warn-bg:#33260f;
  --none:#8ea0a7; --none-bg:#22303650; --danger:#e2725f; --danger-bg:#33191650;
  --side-bg:linear-gradient(180deg,#0c1418 0%,#101c22 70%,#122229 100%);
  --side-ink:#e6edef; --side-muted:#8299a0; --side-active:#3f6f6b;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.28);
  --shadow-lg:0 18px 50px rgba(0,0,0,.55);
}

* { box-sizing:border-box; }
body { margin:0; font-family:'Inter',system-ui,-apple-system,sans-serif; color:var(--ink);
  background:var(--bg); -webkit-font-smoothing:antialiased; }

/* ----------------------------------------------------------------- BOUTONS */
.btn { font:inherit; font-weight:600; font-size:14px; border:0; border-radius:var(--radius-sm);
  padding:10px 16px; cursor:pointer; transition:transform .08s, background .15s, box-shadow .15s;
  text-decoration:none; display:inline-flex; align-items:center; gap:8px; }
.btn:active { transform:translateY(1px); }
.btn-sm { padding:7px 13px; font-size:13px; }
.btn-primary { background:var(--teal); color:var(--on-teal,#fff); }
.btn-primary:hover { filter:brightness(.92); }
.btn-primary:disabled { opacity:.6; cursor:not-allowed; }
.btn-ghost { background:var(--teal-pale); color:var(--navy); }
.btn-ghost:hover { filter:brightness(.96); }
.btn-danger { background:var(--danger); color:#fff; }
.btn-danger:hover { filter:brightness(.92); }
input[type="checkbox"] { width:17px; height:17px; accent-color:var(--teal); cursor:pointer; }

/* ================================= COQUE ================================= */
.app { display:flex; min-height:calc(100vh / var(--zoom,1)); }

/* ----------------------------------------------------------- BARRE LATÉRALE */
.sidebar { width:250px; flex-shrink:0; background:var(--side-bg); color:var(--side-ink);
  display:flex; flex-direction:column; padding:20px 16px; position:sticky; top:0;
  height:calc(100vh / var(--zoom,1)); overflow-y:auto; gap:6px; }
.side-brand { display:flex; align-items:center; gap:12px; padding:4px 6px 18px; }
.brand-mark { width:34px; height:31px; flex-shrink:0; }
.brand-mark path, .brand-mark circle { fill:currentColor; }
.side-brand .brand-mark { color:#fff; }
.brand-words { display:flex; flex-direction:column; line-height:1.1; }
.brand-line { font-size:19px; }
.brand-serif { font-family:'Cormorant Garamond',Georgia,serif; font-weight:600; font-style:italic; }
.brand-sans { font-weight:700; text-transform:uppercase; letter-spacing:1.4px; font-size:16px; }
.brand-tag { font-size:10.5px; color:var(--side-muted); margin-top:3px; }

.side-nav { display:flex; flex-direction:column; gap:4px; margin-bottom:10px; }
.nav-item { display:flex; align-items:center; gap:11px; width:100%; text-align:left;
  background:transparent; border:0; color:var(--side-ink); font:inherit; font-size:14.5px;
  font-weight:600; padding:11px 13px; border-radius:10px; cursor:pointer; transition:background .15s; }
.nav-item:hover { background:rgba(255,255,255,.08); }
.nav-item.is-active { background:var(--side-active); color:#fff; }
.nav-ico { font-size:16px; }

.side-filters { display:flex; flex-direction:column; gap:16px; margin-top:6px;
  padding-top:14px; border-top:1px solid rgba(255,255,255,.1); }
.side-group h4 { margin:0 0 8px; font-size:11px; text-transform:uppercase; letter-spacing:.7px;
  color:var(--side-muted); font-weight:700; }
.side-pills { display:flex; flex-direction:column; gap:3px; }
.side-pill { text-align:left; background:transparent; border:0; color:var(--side-ink);
  font:inherit; font-size:13.5px; font-weight:500; padding:8px 12px; border-radius:8px; cursor:pointer; }
.side-pill:hover { background:rgba(255,255,255,.07); }
.side-pill.is-active { background:rgba(255,255,255,.15); font-weight:700; box-shadow:inset 3px 0 0 var(--teal-light); }

.side-foot { margin-top:auto; padding-top:16px; display:flex; flex-direction:column; gap:5px;
  border-top:1px solid rgba(255,255,255,.1); }
.side-action { display:flex; align-items:center; gap:10px; width:100%; text-align:left;
  background:transparent; border:0; color:var(--side-ink); font:inherit; font-size:13.5px;
  font-weight:500; padding:9px 12px; border-radius:8px; cursor:pointer; text-decoration:none; }
.side-action:hover { background:rgba(255,255,255,.09); }
.side-action span:first-child { width:16px; text-align:center; }
.side-cost { font-size:11.5px; color:var(--side-muted); padding:6px 12px 2px; }
.side-user { display:flex; align-items:center; justify-content:space-between; gap:8px;
  margin-top:8px; padding:8px 12px; font-size:12px; color:var(--side-muted); }
.side-user-badge { font-weight:600; color:var(--side-ink); }
.side-logout { color:var(--side-muted); text-decoration:none; }
.side-logout:hover { color:#fff; text-decoration:underline; }

/* ------------------------------------------------------------------ CONTENU */
.main { flex:1; min-width:0; display:flex; flex-direction:column; }
.main-top { display:flex; align-items:center; gap:14px; padding:18px 30px;
  border-bottom:1px solid var(--line); background:var(--surface); position:sticky; top:0; z-index:20; }
.burger { display:none; font-size:20px; background:transparent; border:0; color:var(--ink); cursor:pointer; }
.search { flex:1; max-width:520px; font:inherit; font-size:14px; border:1px solid var(--line);
  border-radius:100px; padding:10px 18px; background:var(--surface-2); color:var(--ink); }
.search:focus { outline:none; border-color:var(--teal); box-shadow:0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.fetch-badge { margin-left:auto; font-size:12px; color:var(--muted); white-space:nowrap; }

.view { padding:26px 30px 80px; }
.view-head { display:flex; align-items:center; gap:14px; margin-bottom:20px; }
.view-title { font-family:'Cormorant Garamond',serif; font-weight:600; font-size:30px;
  color:var(--navy); margin:0; }
.view-count { font-size:13px; color:var(--muted); font-weight:600; margin-right:auto; }

/* --------------------------------------------------------------- STATS */
.stats { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:22px; max-width:760px; }
.stat { text-align:left; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); padding:18px 20px; cursor:pointer; box-shadow:var(--shadow);
  transition:border-color .15s, transform .08s; border-left:4px solid var(--teal); color:var(--ink); }
.stat:hover { transform:translateY(-2px); }
.stat.is-active { border-color:var(--navy); box-shadow:0 0 0 2px var(--teal) inset, var(--shadow); }
.stat-complete { border-left-color:var(--ok); }
.stat-incomplete { border-left-color:var(--warn); }
.stat-nofolder { border-left-color:var(--none); }
.stat-num { display:block; font-size:32px; font-weight:700; line-height:1; }
.stat-label { display:block; font-size:13px; color:var(--muted); margin-top:7px; font-weight:500; }

/* ------------------------------------------------------- BARRE DE SÉLECTION */
.results-bar { display:flex; align-items:center; gap:16px; margin-bottom:14px; flex-wrap:wrap; }
.results-bar[hidden] { display:none; }
.select-all { display:flex; align-items:center; gap:8px; font-size:13.5px; font-weight:600;
  color:var(--ink); cursor:pointer; }
.bulk-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.bulk-actions[hidden] { display:none; }
.bulk-count { font-size:13px; color:var(--muted); font-weight:600; }

/* --------------------------------------------------- GROUPES VILLE -> RÉF. */
.ville-head { font-family:'Cormorant Garamond',serif; font-weight:600; font-size:24px;
  color:var(--navy); margin:28px 0 10px; }
.ville-head:first-child { margin-top:0; }
.ref-group { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  margin-bottom:14px; overflow:hidden; box-shadow:var(--shadow); }
.ref-head { display:flex; align-items:center; gap:10px; padding:11px 18px; background:var(--surface-2);
  border-bottom:1px solid var(--border); }
.ref-name { font-weight:600; color:var(--navy); font-size:14.5px; }
.ref-count { font-size:12.5px; color:var(--muted); }

/* --------------------------------------------------------------- TABLEAU */
.table { width:100%; border-collapse:collapse; }
.table tbody td { padding:13px 16px; border-bottom:1px solid var(--line); font-size:14px; vertical-align:middle; }
.table tbody tr:last-child td { border-bottom:0; }
.table tbody tr.row { cursor:pointer; transition:background .12s; }
.table tbody tr.row:hover { background:var(--surface-2); }
.col-check { width:1%; white-space:nowrap; }
.cand-name { font-weight:600; color:var(--ink); }
.cand-sub { font-size:12.5px; color:var(--muted); }
.docs-cell { color:var(--muted); font-size:13px; }
.row-complete { box-shadow:inset 4px 0 0 var(--ok); }
.row-incomplete { box-shadow:inset 4px 0 0 var(--warn); }
.row-nofolder { box-shadow:inset 4px 0 0 var(--danger); }
.row.is-sent { opacity:.62; }

.badge { display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600;
  padding:4px 11px; border-radius:100px; white-space:nowrap; }
.badge::before { content:""; width:7px; height:7px; border-radius:50%; background:currentColor; }
.badge.complete { color:var(--ok); background:var(--ok-bg); }
.badge.incomplete { color:var(--warn); background:var(--warn-bg); }
.badge.nofolder { color:var(--none); background:var(--none-bg); }

.sent-pill,.assign-pill,.rdv-pill,.df-pill,.solv-pill { font-size:10.5px; font-weight:700;
  margin-left:8px; padding:2px 7px; border-radius:100px; vertical-align:1px; }
.sent-pill { background:var(--ok-bg); color:var(--ok); }
.assign-pill { background:var(--ok-bg); color:var(--ok); }
.rdv-pill { background:var(--ok-bg); color:var(--ok); }
.df-pill { background:#e8eefc; color:#2c4d9c; }
.solv-pill { background:var(--danger-bg); color:var(--danger); }
:root[data-theme="dark"] .df-pill { background:#20304f; color:#9bb4ef; }

.stage-chip { font-size:12px; font-weight:600; padding:4px 10px; border-radius:100px; white-space:nowrap; }
.stage-todo { background:var(--teal-pale); color:var(--navy); }
.stage-incomplet { background:var(--warn-bg); color:var(--warn); }
.stage-wait { background:var(--warn-bg); color:var(--warn); }
.stage-visit { background:var(--ok-bg); color:var(--ok); }
.stage-refus { background:var(--danger-bg); color:var(--danger); }
.stage-done { background:var(--none-bg); color:var(--none); }

.empty { padding:56px 24px; text-align:center; color:var(--muted); }

/* =============================== DRAWER =============================== */
.overlay { position:fixed; inset:0; background:rgba(20,32,40,.42); z-index:40; }
.overlay[hidden] { display:none; }
.drawer { position:fixed; top:0; right:0; height:100vh; width:min(560px,94vw); background:var(--surface);
  z-index:50; box-shadow:var(--shadow-lg); display:flex; flex-direction:column; animation:slidein .22s ease; }
.drawer[hidden] { display:none; }
@keyframes slidein { from { transform:translateX(100%); } to { transform:translateX(0); } }
.drawer-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  padding:22px 24px 16px; border-bottom:1px solid var(--line); }
.drawer-head h2 { font-size:20px; margin:0; color:var(--ink); }
.drawer-sub { font-size:13px; color:var(--muted); margin:5px 0 0; }
.drawer-head-actions { display:flex; align-items:center; gap:6px; }
.icon-btn { background:var(--teal-pale); border:0; border-radius:9px; width:34px; height:34px;
  font-size:15px; cursor:pointer; line-height:1; color:var(--ink); }
.icon-btn:hover { filter:brightness(.96); }
.icon-danger { background:var(--danger-bg); }
.drawer-close { font-size:26px; line-height:1; border:0; background:transparent; color:var(--muted);
  cursor:pointer; padding:0 4px; }
.drawer-close:hover { color:var(--ink); }
.drawer-body { padding:18px 24px; overflow-y:auto; flex:1; }
.badges-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:4px; }
.ref-tag { font-size:12.5px; font-weight:600; color:var(--navy); background:var(--teal-pale);
  padding:4px 10px; border-radius:100px; }

.block { margin-top:22px; }
.block-title { font-size:12px; text-transform:uppercase; letter-spacing:.6px; color:var(--muted);
  margin:0 0 10px; font-weight:700; }
.block-title-row { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.block-hint { text-transform:none; letter-spacing:0; font-weight:500; color:var(--teal); font-size:12.5px; }
.block-text { margin:0; font-size:14px; line-height:1.5; color:var(--ink); }
.pen-btn { border:1px solid var(--teal); background:var(--teal-pale); color:var(--navy); font:inherit;
  font-size:12.5px; font-weight:600; padding:6px 12px; border-radius:100px; cursor:pointer;
  white-space:nowrap; transition:background .15s; }
.pen-btn:hover { filter:brightness(.96); }
.pen-btn:disabled { opacity:.6; cursor:default; }

.solvency { background:var(--danger-bg); color:var(--danger); border:1px solid var(--danger);
  border-radius:12px; padding:12px 14px; font-size:13.5px; font-weight:600; margin:4px 0 16px; }

.info-grid { display:grid; grid-template-columns:120px 1fr; gap:6px 12px; margin:4px 0 18px; }
.info-grid dt { font-size:12.5px; color:var(--muted); font-weight:600; }
.info-grid dd { font-size:14px; margin:0; color:var(--ink); overflow-wrap:anywhere; }

.suivi-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.stage-select { font:inherit; font-size:14px; padding:9px 12px; border:1px solid var(--line);
  border-radius:var(--radius-sm); background:var(--surface-2); color:var(--ink); cursor:pointer; }
.stage-select:focus { outline:2px solid var(--teal); border-color:var(--teal); }
.btn-assign { background:var(--ok); color:#fff; border:0; border-radius:var(--radius-sm);
  padding:9px 14px; font:inherit; font-weight:600; font-size:13.5px; cursor:pointer; }
.btn-assign:hover { filter:brightness(.94); }
.assigned-note { margin:8px 0 0; font-size:13px; font-weight:600; color:var(--ok); }

/* Créneaux de visite */
.visit-slots { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:8px; }
.slot-chip-sel { display:inline-flex; align-items:center; gap:8px; font-size:12.5px; font-weight:600;
  color:var(--ink); background:var(--teal-pale); border:1px solid var(--border); padding:5px 6px 5px 11px;
  border-radius:100px; }
.slot-chip-sel button { border:0; background:rgba(0,0,0,.08); color:inherit; width:18px; height:18px;
  border-radius:50%; cursor:pointer; font-size:14px; line-height:1; }
:root[data-theme="dark"] .slot-chip-sel button { background:rgba(255,255,255,.14); }

/* Modèles de réponse */
.tpl-list { display:flex; flex-wrap:wrap; gap:8px; }
.tpl-btn { font:inherit; font-size:12.5px; font-weight:600; text-align:left; cursor:pointer;
  border:1px solid var(--line); background:var(--surface-2); color:var(--ink);
  padding:8px 12px; border-radius:10px; transition:all .12s; display:inline-flex; align-items:center; gap:6px; }
.tpl-btn:hover { border-color:var(--teal); transform:translateY(-1px); }
.tpl-btn.is-proposed { border-color:var(--teal); background:var(--teal-pale); color:var(--navy); box-shadow:0 0 0 1px var(--teal) inset; }
.tpl-btn.is-refus { color:var(--danger); }
.tpl-btn.is-refus.is-proposed { background:var(--danger-bg); border-color:var(--danger); box-shadow:0 0 0 1px var(--danger) inset; }
.tpl-star { color:var(--warn); font-size:12px; }

/* Confirmation de visite (fiche) */
.rdv-confirm { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.rdv-confirm-btn { font:inherit; font-size:12.5px; font-weight:600; text-align:left; cursor:pointer;
  border:1px solid var(--ok); background:var(--ok-bg); color:var(--ok); padding:8px 12px; border-radius:9px; }
.rdv-confirm-btn:hover { filter:brightness(.96); }

/* Documents & historique */
.docs-list { list-style:none; margin:0; padding:0; }
.doc-item { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 10px;
  border:1px solid var(--line); border-radius:10px; margin-bottom:7px; background:var(--surface-2); }
.doc-label { font-size:13.5px; color:var(--ink); font-weight:500; overflow-wrap:anywhere; }
.doc-dl { font-size:12.5px; font-weight:700; color:#fff; background:var(--teal); padding:5px 12px;
  border-radius:100px; text-decoration:none; white-space:nowrap; }
.doc-dl:hover { background:var(--navy); }
.doc-none { font-size:13px; color:var(--muted); }
.file-size { font-size:11.5px; color:var(--muted); font-weight:400; }
.history { list-style:none; margin:0; padding:0; }
.hist { border-left:3px solid var(--border); padding:6px 12px; margin-bottom:10px; }
.hist-in { border-left-color:var(--teal); }
.hist-out { border-left-color:var(--navy); }
.hist-dir { font-size:11.5px; font-weight:700; color:var(--navy); margin-right:8px; }
.hist-date { font-size:11.5px; color:var(--muted); }
.hist-sub { font-size:13px; font-weight:600; margin-top:2px; color:var(--ink); }
.hist-note { font-size:12.5px; color:var(--muted); margin-top:2px; }

.response { width:100%; font:inherit; font-size:13.5px; line-height:1.55; border:1px solid var(--line);
  border-radius:var(--radius-sm); padding:12px 14px; resize:vertical; background:var(--surface-2); color:var(--ink); }
.response:focus { outline:2px solid var(--teal); border-color:var(--teal); }

.edit-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:6px 0 16px; }
.edit-grid label { display:flex; flex-direction:column; font-size:12.5px; color:var(--muted); font-weight:600; gap:4px; }
.edit-grid label:nth-child(3) { grid-column:1 / -1; }
.edit-grid input, .edit-grid select { font:inherit; font-size:14px; padding:9px 11px;
  border:1px solid var(--line); border-radius:9px; color:var(--ink); background:var(--surface); }
.edit-grid input:focus, .edit-grid select:focus { outline:2px solid var(--teal); border-color:var(--teal); }
.edit-actions { display:flex; justify-content:flex-end; gap:10px; }
.drawer-foot { display:flex; gap:10px; justify-content:flex-end; padding:16px 24px; border-top:1px solid var(--line); }

/* =============================== MODALES =============================== */
.modal { position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); background:var(--surface);
  border-radius:16px; box-shadow:var(--shadow-lg); z-index:60; padding:26px; width:min(440px,92vw);
  max-height:90vh; overflow-y:auto; }
.modal[hidden] { display:none; }
.modal h3 { margin:0 0 12px; color:var(--navy); }
.modal p { font-size:14px; line-height:1.55; color:var(--ink); }
.modal-lg { width:min(600px,94vw); }
.modal-sub { font-size:14px; color:var(--ink); }
.modal-hint { font-size:12.5px; color:var(--muted); }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:18px; }
.modal-ok { text-align:center; }
.ok-check { font-size:42px; margin-bottom:4px; }
.df-letters { font-size:22px; font-weight:700; color:var(--navy); text-align:center;
  background:var(--teal-pale); border-radius:10px; padding:10px; }

/* Choix des créneaux */
.slot-controls { display:flex; gap:14px; flex-wrap:wrap; margin-bottom:14px; }
.slot-controls label { display:flex; align-items:center; gap:8px; font-size:13px; font-weight:600; color:var(--muted); }
.slot-controls input { font:inherit; font-size:14px; padding:8px 10px; border:1px solid var(--line);
  border-radius:9px; background:var(--surface-2); color:var(--ink); }
.slot-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(72px,1fr)); gap:8px;
  max-height:280px; overflow-y:auto; padding:2px; }
.slot-chip { font:inherit; font-size:13px; font-weight:600; padding:9px 6px; border-radius:9px;
  border:1px solid var(--line); background:var(--surface-2); color:var(--ink); cursor:pointer; transition:all .12s; }
.slot-chip:hover { border-color:var(--teal); }
.slot-chip.is-on { background:var(--teal); color:#fff; border-color:var(--teal); }

/* =============================== CALENDRIER =============================== */
.cal-top { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.cal-nav { width:36px; height:36px; border-radius:9px; border:1px solid var(--line); background:var(--surface);
  color:var(--ink); font-size:20px; line-height:1; cursor:pointer; }
.cal-nav:hover { border-color:var(--teal); }
.cal-today { border:1px solid var(--line); background:var(--surface); color:var(--ink); font:inherit;
  font-weight:600; font-size:13px; padding:8px 14px; border-radius:9px; cursor:pointer; }
.cal-today:hover { border-color:var(--teal); }
.cal-range { font-size:15px; font-weight:600; color:var(--navy); margin-left:6px; }
.cal-legend { margin-left:auto; font-size:12px; color:var(--muted); display:flex; align-items:center; gap:6px; }
.cal-dot { width:10px; height:10px; border-radius:50%; display:inline-block; margin-left:10px; }
.cal-dot.confirme { background:var(--ok); }
.cal-dot.propose { background:var(--warn); }

.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:10px; }
.cal-col { background:var(--surface); border:1px solid var(--line); border-radius:12px; overflow:hidden;
  min-height:160px; display:flex; flex-direction:column; }
.cal-col.is-today { border-color:var(--teal); box-shadow:0 0 0 2px color-mix(in srgb, var(--teal) 28%, transparent); }
.cal-colhead { display:flex; align-items:baseline; justify-content:space-between; padding:9px 12px;
  background:var(--surface-2); border-bottom:1px solid var(--line); }
.cal-dayname { font-size:11.5px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); font-weight:700; }
.cal-daynum { font-size:16px; font-weight:700; color:var(--navy); }
.cal-colbody { padding:8px; display:flex; flex-direction:column; gap:7px; flex:1; }
.cal-empty { color:var(--muted); font-size:13px; text-align:center; padding:16px 0; }
.cal-evt { position:relative; text-align:left; border:0; border-left:4px solid var(--warn); background:var(--warn-bg);
  border-radius:8px; padding:8px 22px 8px 10px; cursor:pointer; display:flex; flex-direction:column; gap:1px;
  transition:transform .08s; width:100%; }
.cal-del { position:absolute; top:4px; right:4px; width:18px; height:18px; border:0; border-radius:50%;
  background:rgba(0,0,0,.12); color:inherit; cursor:pointer; font-size:13px; line-height:1; opacity:0; transition:opacity .12s; }
.cal-evt:hover .cal-del { opacity:1; }
:root[data-theme="dark"] .cal-del { background:rgba(255,255,255,.2); }
.cal-evt:hover { transform:translateY(-1px); }
.cal-evt.confirme { border-left-color:var(--ok); background:var(--ok-bg); }
.cal-evt-time { font-size:13px; font-weight:700; color:var(--ink); }
.cal-evt-name { font-size:12.5px; font-weight:600; color:var(--ink); overflow-wrap:anywhere; }
.cal-evt-sub { font-size:11px; color:var(--muted); }

/* Sélection par groupe (référence / type) */
.grp-check { display:flex; align-items:center; }
.grp-quick { margin-left:auto; display:flex; gap:6px; flex-wrap:wrap; }
.grp-pick { font:inherit; font-size:11px; font-weight:700; border:1px solid var(--line); background:var(--surface);
  color:var(--muted); padding:3px 9px; border-radius:100px; cursor:pointer; white-space:nowrap; }
.grp-pick:hover { border-color:var(--teal); color:var(--ink); }
.grp-pick.complete { color:var(--ok); }
.grp-pick.incomplete { color:var(--warn); }
.grp-pick.nofolder { color:var(--none); }

/* Champ candidat (ajout de créneau) */
.caladd-fld { display:flex; flex-direction:column; gap:6px; font-size:13px; font-weight:600;
  color:var(--muted); margin-bottom:12px; }
.caladd-fld select { width:100%; }

/* --------------------------------------------------------------- TOAST */
.toast { position:fixed; bottom:26px; left:50%; transform:translateX(-50%); background:var(--navy);
  color:var(--bg); padding:13px 22px; border-radius:100px; font-size:14px; font-weight:600;
  box-shadow:var(--shadow-lg); z-index:70; animation:pop .2s ease; }
:root[data-theme="dark"] .toast { color:#0e1519; }
.toast[hidden] { display:none; }
.toast.toast-err { background:var(--danger); color:#fff; }
@keyframes pop { from { opacity:0; transform:translate(-50%,10px); } to { opacity:1; transform:translate(-50%,0); } }

/* --------------------------------------------------------------- RESPONSIVE */
@media (max-width:900px) {
  .app { flex-direction:column; }
  .sidebar { position:fixed; top:0; left:0; width:270px; z-index:80; transform:translateX(-100%);
    transition:transform .22s ease; }
  .sidebar.open { transform:translateX(0); box-shadow:var(--shadow-lg); }
  .burger { display:block; }
  .main { width:100%; }
}
@media (max-width:640px) {
  .stats { grid-template-columns:repeat(3,1fr); gap:10px; }
  .stat { padding:14px; }
  .stat-num { font-size:24px; }
  .view { padding:20px 16px 80px; }
  .cal-grid { grid-template-columns:1fr; }
  .table tbody td:nth-child(4), .table tbody td:nth-child(5) { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation:none !important; transition:none !important; }
}

/* =================== PALETTES DE COULEURS (Profil & paramètres) =================== */
:root[data-palette="automne"] { --navy:#4a2c1d; --navy-soft:#6b4430; --teal:#b35e26; --teal-light:#e0985f; --teal-pale:#f7e9dc; --bg:#f6efe7; --surface-2:#fbf6f0; --line:#e8dccf; --border:#e8dccf; --side-bg:linear-gradient(180deg,#4a2c1d 0%,#3b2217 100%); --side-active:#b35e26; --side-muted:#d3b9a3; }
:root[data-palette="rouge"] { --navy:#4a1c22; --navy-soft:#6e2a33; --teal:#b5303c; --teal-light:#e07a82; --teal-pale:#fbe6e8; --bg:#f8eeef; --surface-2:#fdf6f6; --line:#ecd9db; --border:#ecd9db; --side-bg:linear-gradient(180deg,#4a1c22 0%,#3a151a 100%); --side-active:#b5303c; --side-muted:#d9b0b5; }
:root[data-palette="ocean"] { --navy:#12325a; --navy-soft:#1d4a7e; --teal:#2a78c7; --teal-light:#7eb3e8; --teal-pale:#e3eefa; --bg:#edf3fa; --surface-2:#f6f9fd; --line:#d6e2f0; --border:#d6e2f0; --side-bg:linear-gradient(180deg,#12325a 0%,#0e2745 100%); --side-active:#2a78c7; --side-muted:#a9c2e0; }
:root[data-palette="foret"] { --navy:#1f3d2b; --navy-soft:#2d5a40; --teal:#3a8357; --teal-light:#86c2a0; --teal-pale:#e4f2ea; --bg:#eef4ef; --surface-2:#f7faf8; --line:#d9e6dd; --border:#d9e6dd; --side-bg:linear-gradient(180deg,#1f3d2b 0%,#183222 100%); --side-active:#3a8357; --side-muted:#a8c7b4; }
:root[data-palette="violet"] { --navy:#33224f; --navy-soft:#4b3377; --teal:#7c55c9; --teal-light:#b39ae6; --teal-pale:#eee7fa; --bg:#f3f0f8; --surface-2:#faf8fd; --line:#e1daef; --border:#e1daef; --side-bg:linear-gradient(180deg,#33224f 0%,#291b40 100%); --side-active:#7c55c9; --side-muted:#bcaedb; }
:root[data-palette="rose"] { --navy:#4f2238; --navy-soft:#733452; --teal:#d33675; --teal-light:#ee93b6; --teal-pale:#fce6ef; --bg:#f9eff3; --surface-2:#fdf6f9; --line:#efdbe4; --border:#efdbe4; --side-bg:linear-gradient(180deg,#4f2238 0%,#3f1b2d 100%); --side-active:#d33675; --side-muted:#dcb1c6; }
:root[data-palette="graphite"] { --navy:#2b2f33; --navy-soft:#41464b; --teal:#5b6770; --teal-light:#98a3ab; --teal-pale:#e8ebed; --bg:#f0f1f2; --surface-2:#f8f9f9; --line:#dfe2e4; --border:#dfe2e4; --side-bg:linear-gradient(180deg,#2b2f33 0%,#212427 100%); --side-active:#5b6770; --side-muted:#a7aeb4; }
:root[data-theme="dark"][data-palette="automne"] { --navy:#f0d9c4; --navy-soft:#d3b9a3; --teal:#e08a4a; --teal-light:#e0985f; --teal-pale:#3a281c; --bg:#17110d; --surface:#221913; --surface-2:#2a1f18; --line:#3d2e24; --border:#3d2e24; --side-bg:linear-gradient(180deg,#120d0a 0%,#1d1510 100%); --side-active:#a8561f; --side-muted:#b89a85; --on-teal:#0f1418; }
:root[data-theme="dark"][data-palette="rouge"] { --navy:#f3d3d6; --navy-soft:#d9b0b5; --teal:#e5636f; --teal-light:#e07a82; --teal-pale:#3a1d21; --bg:#170d0f; --surface:#231417; --surface-2:#2b191d; --line:#402a2e; --border:#402a2e; --side-bg:linear-gradient(180deg,#120a0c 0%,#1e1114 100%); --side-active:#9c2a35; --side-muted:#b98f95; --on-teal:#0f1418; }
:root[data-theme="dark"][data-palette="ocean"] { --navy:#cfe0f5; --navy-soft:#a9c2e0; --teal:#5aa2ec; --teal-light:#7eb3e8; --teal-pale:#1b2d44; --bg:#0c141f; --surface:#131f2e; --surface-2:#182739; --line:#26384d; --border:#26384d; --side-bg:linear-gradient(180deg,#0a111b 0%,#0f1b2b 100%); --side-active:#2a6aaf; --side-muted:#8aa6c6; --on-teal:#0f1418; }
:root[data-theme="dark"][data-palette="foret"] { --navy:#d3eadb; --navy-soft:#a8c7b4; --teal:#5fc08a; --teal-light:#86c2a0; --teal-pale:#1a2f23; --bg:#0c1510; --surface:#14211a; --surface-2:#1a2a21; --line:#263a2e; --border:#263a2e; --side-bg:linear-gradient(180deg,#09110d 0%,#0f1c15 100%); --side-active:#2f7549; --side-muted:#88aa96; --on-teal:#0f1418; }
:root[data-theme="dark"][data-palette="violet"] { --navy:#e3d9f8; --navy-soft:#bcaedb; --teal:#a184e6; --teal-light:#b39ae6; --teal-pale:#2a1f40; --bg:#110d1a; --surface:#1b1428; --surface-2:#221a31; --line:#342a4a; --border:#342a4a; --side-bg:linear-gradient(180deg,#0d0a15 0%,#161022 100%); --side-active:#6a45b3; --side-muted:#9d8fbf; --on-teal:#0f1418; }
:root[data-theme="dark"][data-palette="rose"] { --navy:#f8d6e5; --navy-soft:#dcb1c6; --teal:#ee6a9c; --teal-light:#ee93b6; --teal-pale:#3a1b2a; --bg:#170c11; --surface:#23131a; --surface-2:#2b1a22; --line:#402a35; --border:#402a35; --side-bg:linear-gradient(180deg,#120a0e 0%,#1e1118 100%); --side-active:#b83768; --side-muted:#bd93a8; --on-teal:#0f1418; }
:root[data-theme="dark"][data-palette="graphite"] { --navy:#e1e5e8; --navy-soft:#a7aeb4; --teal:#8d9ba5; --teal-light:#98a3ab; --teal-pale:#25292d; --bg:#0e0f10; --surface:#181a1c; --surface-2:#1e2124; --line:#2d3135; --border:#2d3135; --side-bg:linear-gradient(180deg,#0b0c0d 0%,#141618 100%); --side-active:#4a545c; --side-muted:#8a9299; --on-teal:#0f1418; }
:root[data-theme="dark"][data-palette="defaut"] { --on-teal:#0f1418; }
.sw-defaut { --sa:#5e8c89; --sb:#243845; }
.sw-automne { --sa:#b35e26; --sb:#4a2c1d; }
.sw-rouge { --sa:#b5303c; --sb:#4a1c22; }
.sw-ocean { --sa:#2a78c7; --sb:#12325a; }
.sw-foret { --sa:#3a8357; --sb:#1f3d2b; }
.sw-violet { --sa:#7c55c9; --sb:#33224f; }
.sw-rose { --sa:#d33675; --sb:#4f2238; }
.sw-graphite { --sa:#5b6770; --sb:#2b2f33; }

/* ----------------------------------------------- Taille du texte / densité / animations */
:root[data-size="s"]  { --zoom:.92; }
:root[data-size="m"]  { --zoom:1; }
:root[data-size="l"]  { --zoom:1.1; }
:root[data-size="xl"] { --zoom:1.22; }
body { zoom:var(--zoom,1); }
:root[data-density="compact"] .table tbody td { padding:7px 14px; }
:root[data-density="compact"] .nav-item { padding:8px 12px; }
:root[data-density="compact"] .side-pill { padding:5px 12px; }
:root[data-density="compact"] .view { padding:16px 22px 60px; }
:root[data-density="compact"] .stat { padding:12px 16px; }
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after {
  transition:none !important; animation:none !important; scroll-behavior:auto !important; }
:root[data-showcost="0"] #cost-badge { display:none; }


/* ============ POLICES HÉBERGÉES LOCALEMENT (RGPD : aucune requête vers Google) ============ */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/cormorant-garamond-500-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/cormorant-garamond-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/cormorant-garamond-500-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/cormorant-garamond-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/inter-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/inter-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/inter-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/fonts/inter-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/inter-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/static/fonts/inter-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/static/fonts/inter-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/static/fonts/inter-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============================ ACCESSIBILITÉ (clavier, lecteurs d'écran) ============================ */
:focus-visible { outline:3px solid var(--teal); outline-offset:2px; border-radius:4px; }
.sidebar :focus-visible { outline-color:var(--teal-light); }
tr.row:focus-visible { outline-offset:-3px; }
.skip-link { position:absolute; left:-9999px; top:8px; z-index:300; background:var(--navy); color:var(--surface);
  padding:10px 16px; border-radius:8px; font-weight:600; text-decoration:none; }
.skip-link:focus { left:12px; }
.problem-banner { background:var(--danger-bg); color:var(--danger); border-bottom:2px solid var(--danger);
  padding:11px 30px; font-size:14px; font-weight:600; }
.stale-banner { background:var(--warn-bg); color:var(--ink); border:1px solid var(--warn);
  border-radius:var(--radius-sm); padding:10px 14px; margin-bottom:14px; font-size:13.5px;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.stale-banner[hidden], .problem-banner[hidden] { display:none; }
