:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e3e6ee;
  --text: #1b1f2a;
  --muted: #6b7285;
  --primary: #4f46e5;
  --primary-ink: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .05);

  --lvl-calm: #1fa463;
  --lvl-moderate: #8cc63f;
  --lvl-busy: #f2b705;
  --lvl-very-busy: #f07c1b;
  --lvl-avoid: #d93636;
  --lvl-closed: #c9ced9;

  --tint-calm: #dcf3e7;
  --tint-moderate: #eaf5d8;
  --tint-busy: #fcf1cc;
  --tint-very-busy: #fde3cd;
  --tint-avoid: #f9d7d7;
  --tint-closed: #eceef3;

  --radius: 14px;
  --radius-sm: 9px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117; --surface: #171a23; --surface-2: #1f2330; --border: #2a2f3d; --text: #e8eaf0; --muted: #9098ad;
    --primary: #818cf8; --primary-ink: #0f1117; --shadow: none;
    --tint-calm: #173a2a; --tint-moderate: #2c3a1a; --tint-busy: #3d3313; --tint-very-busy: #43291a; --tint-avoid: #472020; --tint-closed: #1d2029;
    --lvl-closed: #454b5c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1117; --surface: #171a23; --surface-2: #1f2330; --border: #2a2f3d; --text: #e8eaf0; --muted: #9098ad;
  --primary: #818cf8; --primary-ink: #0f1117; --shadow: none;
  --tint-calm: #173a2a; --tint-moderate: #2c3a1a; --tint-busy: #3d3313; --tint-very-busy: #43291a; --tint-avoid: #472020; --tint-closed: #1d2029;
  --lvl-closed: #454b5c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Boutons & formulaires ---------- */
.btn {
  font: inherit; font-weight: 500; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 7px 12px; cursor: pointer; background: var(--surface-2); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-ghost { background: transparent; border-color: var(--border); }
input[type="date"], input[type="text"], input[type="number"], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px;
}
textarea { resize: none; width: 100%; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-btn { font: inherit; font-size: 13px; border: 0; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { font-size: 28px; }
.header-search { position: relative; flex: 1 1 auto; min-width: 0; max-width: 340px; margin: 0 auto; }
.header-search input { width: 100%; padding: 7px 14px; border-radius: 999px; font-size: 13px; }
.header-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  max-height: 320px; overflow: auto; z-index: 30;
}
.header-search-results a { display: block; padding: 8px 12px; color: inherit; text-decoration: none; font-size: 13px; }
.header-search-results a div:last-child { font-size: 12px; }
.header-search-results a:hover, .header-search-results a.active { background: var(--surface-2); }
.header-search-results p { padding: 8px 12px; margin: 0; }
.brand-title { display: block; font-weight: 700; letter-spacing: -.01em; color: inherit; text-decoration: none; }
.topbar-actions { display: flex; gap: 8px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); font-size: 12px; color: var(--text); white-space: nowrap; flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.alerts { max-width: 1320px; margin: 12px auto 0; padding: 0 24px; display: grid; gap: 6px; }
.alert { background: var(--tint-busy); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; }

/* ---------- Mise en page ---------- */
.layout { max-width: 1320px; margin: 0 auto; padding: 20px 24px 60px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
/* Enveloppe de bascule annuaire/parc : "contents" pour que ses enfants restent des items de la grille
   .layout ci-dessus (et gardent donc l'espacement gap: 20px) ; [hidden] doit rester prioritaire. */
#park-view { display: contents; }
#park-view[hidden] { display: none; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head .muted { font-size: 12px; }

.overview { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.05fr; gap: 20px; }

/* Aujourd'hui */
.today { display: flex; flex-direction: column; gap: 12px; }
.today-top { display: flex; align-items: center; gap: 16px; }
.gauge { --val: 0; --col: var(--lvl-closed); width: 92px; height: 92px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--col) calc(var(--val) * 1%), var(--surface-2) 0); display: grid; place-items: center; }
.gauge-inner { width: 72px; height: 72px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.gauge-val { font-size: 24px; font-weight: 700; line-height: 1; }
.gauge-sub { font-size: 10px; color: var(--muted); }
.today-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.today-level { font-size: 20px; font-weight: 700; }
.today-meta { display: grid; gap: 4px; font-size: 13px; }

/* Listes de jours */
.day-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.day-list li, .finder-results li { min-width: 0; }
.day-list li button, .finder-results li button {
  width: 100%; display: flex; align-items: center; gap: 10px; font: inherit; color: inherit; text-align: left;
  background: transparent; border: 0; padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.day-list li button:hover, .finder-results li button:hover { background: var(--surface-2); }
.score-chip { min-width: 34px; text-align: center; font-weight: 700; font-size: 13px; padding: 2px 6px; border-radius: 7px; font-variant-numeric: tabular-nums; }
.day-list .grow, .finder-results .grow { flex: 1; min-width: 0; }
.day-list .why, .finder-results .why { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lvl-calm { background: var(--tint-calm); } .score-chip.lvl-calm { background: var(--lvl-calm); color: #fff; }
.lvl-moderate { background: var(--tint-moderate); } .score-chip.lvl-moderate { background: var(--lvl-moderate); color: #1b1f2a; }
.lvl-busy { background: var(--tint-busy); } .score-chip.lvl-busy { background: var(--lvl-busy); color: #1b1f2a; }
.lvl-very-busy { background: var(--tint-very-busy); } .score-chip.lvl-very-busy { background: var(--lvl-very-busy); color: #fff; }
.lvl-avoid { background: var(--tint-avoid); } .score-chip.lvl-avoid { background: var(--lvl-avoid); color: #fff; }
.lvl-closed { background: var(--tint-closed); } .score-chip.lvl-closed { background: var(--lvl-closed); color: var(--text); }

/* Météo */
.weather-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 12px; }
.weather-strip .w-day { padding: 6px 0; border-radius: 8px; }
.weather-strip .w-icon, .h-hour .w-icon { font-size: 20px; line-height: 1.4; }
.weather-strip .w-t, .h-hour .w-t { font-weight: 600; }
.weather-panel-body .seg { margin-bottom: 12px; }
.hourly-strip { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 4px; }
.h-hour { flex: none; width: 52px; text-align: center; font-size: 12px; padding: 6px 0; border-radius: 8px; }
.h-hour:hover { background: var(--surface-2); }

/* Météo, en bulle flottante (voir .chat pour le même principe de panneau à bascule). À gauche pour ne
   pas chevaucher la sidebar fixée à droite. */
.weather-float { position: fixed; left: 20px; bottom: 20px; z-index: 35; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.weather-bubble {
  display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.weather-bubble:hover { background: var(--surface-2); }
/* Le conteneur fait la taille du panneau (même fermé/invisible) : sans ça il interceptait les clics sur le calendrier en dessous. */
.weather-float { pointer-events: none; }
.weather-bubble { pointer-events: auto; }
.weather-bubble-icon { font-size: 18px; }
.weather-panel {
  width: min(360px, calc(100vw - 40px)); max-height: min(520px, calc(100vh - 120px)); overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 36px rgba(0,0,0,.18);
  display: flex; flex-direction: column; transform-origin: bottom left;
  transform: scale(.95) translateY(8px); opacity: 0; pointer-events: none; transition: transform .15s ease, opacity .15s ease;
}
.weather-panel.open { transform: none; opacity: 1; pointer-events: auto; }
.weather-panel-body { padding: 14px 16px; overflow: auto; }
@media (max-width: 760px) {
  .weather-float { left: 16px; bottom: 16px; }
  .weather-bubble-icon + .weather-bubble-temp:empty { display: none; }
}

/* Composition de l'indice : carte de la sidebar fixe (voir .planner-sidebar) */
.composition-panel .detail-section { margin-top: 0; }

/* Recherche */
.finder-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.finder-form label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.finder-results { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; counter-reset: rank; }
.finder-results:empty { display: none; }
.rank { color: var(--muted); font-size: 12px; width: 18px; }

/* ---------- Calendrier ---------- */
/* Le calendrier occupe toute la largeur disponible ; la sidebar (détail du jour + composition de l'indice)
   est fixe à droite, hors du flux (voir .planner-sidebar), et .layout lui réserve la place. */
.planner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
/* Carte de navigation/légende/filtres : sous 1600px elle passe au-dessus du calendrier, à hauteur naturelle ;
   à partir de 1600px elle est à côté et prend exactement la hauteur du calendrier (son contenu défile dedans,
   .filters-inner étant hors flux pour ne jamais agrandir la ligne de la grille). */
.filters-card { order: -1; }
@media (min-width: 1600px) {
  .planner { grid-template-columns: minmax(0, 1fr) 340px; align-items: stretch; }
  .filters-card { order: 0; position: relative; padding: 0; }
  .filters-inner { position: absolute; inset: 0; overflow: auto; padding: 22px; }
  .filters-card .cal-filters { flex-direction: column; flex-wrap: nowrap; }
  .filters-card .legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: 13.5px; }
  .filters-card .filter-items { max-height: none; overflow: visible; }
  .filters-card .filter-group summary, .filters-card .filter-item { font-size: 14px; }
  .filters-card .filter-group summary { padding: 8px 12px; }
  .filters-card .calendar-head { flex-direction: column; align-items: stretch; }
  .filters-card .calendar-nav { justify-content: space-between; }
  .filters-card .calendar-top .seg { flex: none; }
  .filters-card .calendar-nav span { flex: 1; min-width: 0; font-size: 13px; }
  .filters-card .calendar-nav .btn { padding: 6px 9px; }
}
.calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.calendar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.calendar-nav { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.calendar-nav span { min-width: 190px; text-align: center; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.filters-card .legend { margin: 4px 0 14px; }
.filters-card .filter-item { white-space: normal; align-items: flex-start; }
.filters-card .filter-items { overflow-x: hidden; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

.cal-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-group { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.filter-group summary {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; list-style: none; user-select: none;
}
.filter-group summary::-webkit-details-marker { display: none; }
.filter-group summary input { margin: 0; }
.filter-items { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px 10px 30px; max-height: 220px; overflow: auto; border-top: 1px solid var(--border); }
.filter-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 2px 0; white-space: nowrap; }
.filter-item input { margin: 0; }

.months { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.month h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-grid .dow { font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 2px; text-transform: uppercase; }
.cell {
  position: relative; aspect-ratio: 1 / .9; border-radius: 8px; border: 1px solid transparent; padding: 4px 5px;
  font: inherit; color: inherit; cursor: pointer; text-align: left; display: flex; flex-direction: column; justify-content: space-between; min-width: 0;
}
.cell:hover { border-color: var(--text); }
.cell.selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.cell.today-cell .cell-date { background: var(--text); color: var(--surface); border-radius: 5px; padding: 0 4px; }
.cell.past { opacity: .45; }
.cell-date { font-size: 12px; font-weight: 600; align-self: flex-start; }
.cell-score { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cell-icons { position: absolute; top: 3px; right: 4px; font-size: 10px; letter-spacing: -1px; }
.cell.lvl-closed .cell-score { font-size: 10px; font-weight: 500; color: var(--muted); }
.cell-empty { visibility: hidden; }

.year { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.year .month h3 { font-size: 13px; }
.year .month-grid { gap: 2px; }
.year .cell { aspect-ratio: 1; padding: 0; border-radius: 4px; justify-content: center; align-items: center; }
.year .cell-date { font-size: 9px; font-weight: 500; align-self: center; }
.year .cell-score, .year .cell-icons { display: none; }

/* Sidebar : détail du jour + composition de l'indice, en colonne fixe à droite (toujours visible, quel que
   soit le défilement). En dessous de 1181px elle redevient une carte normale sous le calendrier. */
.planner-sidebar { position: fixed; top: 76px; right: 20px; width: 360px; max-height: calc(100vh - 96px); overflow: auto; z-index: 25; display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 1181px) {
  .layout:has(#park-view:not([hidden])) { max-width: none; margin: 0; padding-right: 404px; }
}
@media (min-width: 1181px) and (max-width: 1599px) {
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .year { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.detail-head h2 { font-size: 17px; }
.factor { border-top: 1px solid var(--border); font-size: 13px; }
.factor:first-of-type { border-top: 0; }
.factor summary {
  display: grid; grid-template-columns: 1fr 44px; gap: 8px; align-items: center; padding: 6px 0;
  cursor: pointer; list-style: none;
}
.factor summary::-webkit-details-marker { display: none; }
.factor-chevron { display: inline-block; margin-right: 4px; color: var(--muted); transition: transform .15s; }
.factor[open] .factor-chevron { transform: rotate(90deg); }
.factor-pts { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.factor-pts.pos { color: var(--lvl-avoid); }
.factor-pts.neg { color: var(--lvl-calm); }
.factor-bar { grid-column: 1 / -1; height: 4px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.factor-bar i { display: block; height: 100%; background: var(--muted); }
.factor-bar i.pos { background: var(--lvl-very-busy); }
.factor-bar i.neg { background: var(--lvl-calm); }
.factor-explain { margin: 0 0 8px; }
.detail-section { margin-top: 14px; }
.detail-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.detail-section ul { margin: 0; padding-left: 18px; font-size: 13px; }
.detail-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Temps d'attente */
.waits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 20px; }
.waits-links p { margin: 12px 0 0; }
.wait { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.wait-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.wait.closed .wait-time { color: var(--muted); font-weight: 400; }

.footer { font-size: 12px; text-align: center; }
.skeleton { color: var(--muted); padding: 20px 0; }

/* ---------- Assistant IA ---------- */
.chat {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 40; background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: -8px 0 30px rgba(0,0,0,.12); display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .22s ease;
}
.chat.open { transform: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-head > div:last-child { display: flex; gap: 6px; }
.chat-messages { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 10px 13px; border-radius: 14px; font-size: 14px; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.error { align-self: stretch; background: var(--tint-avoid); }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin: 0; }
.msg ul, .msg ol { margin: 4px 0 8px; padding-left: 20px; }
.msg h4 { margin: 8px 0 4px; font-size: 14px; }
.msg code { background: var(--surface); padding: 0 4px; border-radius: 4px; }
.msg.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.chat-suggestions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.chat-suggestions button { font: inherit; font-size: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 4px 10px; cursor: pointer; }
.chat-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-end; }

/* ---------- Réglages ---------- */
.settings { border: 0; padding: 0; border-radius: var(--radius); width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--text); }
.settings::backdrop { background: rgba(10, 12, 20, .45); }
.settings-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.settings-body .alert { margin: 8px 0; }
.settings-head, .settings-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; }
.settings-head { border-bottom: 1px solid var(--border); }
.settings-foot { border-top: 1px solid var(--border); }
.settings-tabs { margin: 14px 20px 0; }
.settings-body { padding: 16px 20px; overflow: auto; }
.help { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.slider-row { display: grid; grid-template-columns: 170px 1fr 52px; gap: 12px; align-items: center; padding: 5px 0; font-size: 14px; }
.slider-row input[type="range"] { width: 100%; accent-color: var(--primary); }
.slider-row output { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.country { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 8px; }
.country summary { cursor: pointer; list-style: none; }
.country summary::-webkit-details-marker { display: none; }
.country summary .slider-row { grid-template-columns: 20px 14px 150px 1fr 52px; }
.caret { color: var(--muted); transition: transform .15s; display: inline-block; }
.country[open] .caret { transform: rotate(90deg); }
.country .regions .slider-row { grid-template-columns: 200px 1fr 52px; padding-left: 12px; font-size: 13px; }

.subhead { font-size: 13px; font-weight: 600; margin: 18px 0 8px; }
.stack { display: grid; gap: 4px; font-size: 13px; margin-bottom: 12px; }
.stack input { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.form-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form-grid input, .form-grid select { width: 100%; color: var(--text); }
.form-grid label .small { color: var(--muted); }
.span-2 { grid-column: 1 / -1; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.btn-danger { background: transparent; border-color: var(--lvl-avoid); color: var(--lvl-avoid); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; }
.inline-form input[type="text"] { flex: 1; min-width: 160px; }
.item-list { display: grid; margin-top: 10px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.item-row:has(> :nth-child(3):last-child) { grid-template-columns: minmax(0, 1fr) auto auto; }
.item-row .row-actions { margin-top: 0; }
.item-row.editing { display: block; padding: 6px 0; }
.item-row.editing .inline-form { margin-top: 0; }
.source-row { grid-template-columns: 24px minmax(0, 1fr) auto auto; }

.mode-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; background: var(--surface-2); }
.mode-box .subhead { margin-top: 0; }
.radio-row { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.radio-row input { margin-top: 3px; flex: none; }
.badge { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge-warn { background: var(--tint-busy); color: var(--text); }
.badge-err { background: var(--tint-avoid); color: var(--text); cursor: help; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--surface-2); font-size: 13px; }
.chip button { font: inherit; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 6px; }
.chip input { padding: 1px 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.research { border: 1px dashed var(--primary); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 8px; }
.research summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.research-body { padding-top: 8px; }
.research-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.research-form input[type="text"] { flex: 1; min-width: 200px; }
.research-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; font-size: 13px; }
.research-list label { display: flex; gap: 8px; align-items: flex-start; }
.research-list input { margin-top: 3px; }
.period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.period label { display: inline-flex; align-items: center; gap: 4px; }
.period input[type="text"] { flex: 1; min-width: 160px; }
.source-add { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--border); }
.ai-fill { margin-top: 16px; font-size: 14px; }
[hidden] { display: none !important; }

/* ---------- Connexion ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 32px 28px; text-align: center; }
.login-card h1 { font-size: 20px; margin: 8px 0 4px; }
.login-card form { display: grid; gap: 12px; margin-top: 20px; text-align: left; }
.login-card input[type="password"] { width: 100%; padding: 9px 12px; }
.login-card .btn { justify-content: center; padding: 9px 12px; }
.login-back { margin-top: 14px; }
.login-back a { color: var(--muted); }
.login-logo { font-size: 44px; }
.topbar-actions form { display: contents; }
.topbar-actions form[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planner-sidebar { position: static; width: auto; max-height: none; overflow: visible; }
  .year { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .hide-sm { display: none; }
  .pill { white-space: normal; flex: 0 1 auto; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; margin: 8px 0 0; }
  .park-header { flex-direction: column; align-items: stretch; }
  .layout { padding: 16px 16px 60px; gap: 16px; }
  .alerts { padding: 0 16px; }
  .overview { grid-template-columns: 1fr; }
  .months { grid-template-columns: 1fr; }
  .year { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-nav span { min-width: 0; }
  .slider-row { grid-template-columns: 110px 1fr 44px; }
  .country summary .slider-row { grid-template-columns: 20px 14px 90px 1fr 44px; }
  .country .regions .slider-row { grid-template-columns: 120px 1fr 44px; }
  .form-grid { grid-template-columns: 1fr; }
  .item-row, .item-row:has(> :nth-child(3):last-child) { grid-template-columns: minmax(0, 1fr) auto; }
  .source-row { grid-template-columns: 24px minmax(0, 1fr); }
}

/* ---------- Site public : intro, publicité, mur avant réponse IA ---------- */
.intro {
  max-width: 1320px; margin: 0 auto 4px; padding: 0 24px; font-size: 15px; color: var(--muted); white-space: pre-wrap;
}
.park-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.park-title:empty { display: none; }
.park-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.park-status { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.history-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.history-nav button:disabled { opacity: .4; cursor: default; }
.ad-slot {
  max-width: 1320px; margin: 12px auto; padding: 0 24px; text-align: center; overflow: hidden;
}
.ad-slot:not([hidden]):empty { display: none; }
.footer-legal { display: flex; gap: 14px; justify-content: center; margin-top: 6px; }
.footer-legal a { color: var(--muted); }
.footer-legal a[hidden] { display: none; }

.ad-gate { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.ad-gate .ad-slot { margin: 0; padding: 0; min-height: 60px; background: var(--surface-2); border-radius: var(--radius-sm); }

@media (max-width: 760px) {
  .intro, .ad-slot { padding: 0 16px; }
}

/* ---------- Annuaire des parcs ---------- */
.park-directory { width: 100%; max-width: 1320px; margin: 0 auto; padding: 4px 24px 8px; }
.directory-search { margin-bottom: 18px; }
.directory-search input { width: 100%; max-width: 480px; padding: 10px 14px; font-size: 15px; border-radius: 999px; }
.park-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.park-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .1s;
}
.park-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.park-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.park-card-name { font-weight: 700; margin-bottom: 2px; }
.park-card-cta { display: block; margin-top: 10px; font-size: 12.5px; color: var(--primary); font-weight: 600; }

/* ---------- Plan du site ---------- */
.sitemap-page { max-width: 720px; margin: 0 auto; padding: 4px 24px 40px; }
.sitemap-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 4px; }
.sitemap-list a { display: block; padding: 8px 4px; border-bottom: 1px solid var(--border); }

/* ---------- Historique des temps d'attente ---------- */
#waits-history .subhead:first-child { margin-top: 0; }
.consistency { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
#consistency-result { margin-top: 12px; display: grid; gap: 10px; font-size: 13px; }
#consistency-result p { margin: 0; }
#consistency-result ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.verdict { display: inline-block; padding: 2px 9px; border-radius: 99px; font-weight: 600; font-size: 12.5px; }
.verdict-good { background: var(--tint-calm); } .verdict-partial { background: var(--tint-busy); }
.verdict-poor { background: var(--tint-avoid); } .verdict-unknown { background: var(--surface-2); }
.history-rows { display: grid; gap: 5px; max-height: 320px; overflow: auto; }
.history-row { display: grid; grid-template-columns: 70px 1fr 60px; gap: 10px; align-items: center; font-size: 12.5px; }
.history-date { color: var(--muted); white-space: nowrap; }
.history-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.history-bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.history-val { text-align: right; font-weight: 600; }

@media (max-width: 760px) {
  .park-directory { padding: 4px 16px 8px; }
}
