/* =========================================================================
   alertefeu - Design system CLAIR INSTITUTIONNEL
   Fond clair, épuré, très lisible (ambiance service public). Le thème sombre
   reste disponible via [data-theme="dark"] (bouton jour/nuit).
   ========================================================================= */

:root {
  --bg: #e9edf2;
  --panel-solid: #ffffff;
  --panel: #fffffff5;
  --surface-2: #f3f6fa; /* tuiles/encarts internes */
  --border: #dbe2ea;
  --border-strong: #c4cdda;
  --text: #16212c;
  --muted: #5b6775;
  --accent: #dc2f1e; /* rouge feu, sobre et institutionnel */
  --accent-weak: #dc2f1e14;
  --ember: #ea580c; /* orange, touches (flamme) */
  --danger: #d92d20;
  --ok: #1a7f4b;
  --warn: #b45309;
  --info: #1d4ed8;
  --hover: #16212c0d;
  --active-bg: #dc2f1e14;
  --shadow-sm: 0 1px 2px #16212b12;
  --shadow: 0 6px 20px #16212b17;
  --shadow-lg: 0 18px 50px #16212b2e;
  --radius: 14px;
  --radius-sm: 10px;
  --topbar-bg: #ffffffe8;
}
:root[data-theme="dark"] {
  --bg: #0d1117;
  --panel-solid: #161b22;
  --panel: #161b22e8;
  --surface-2: #ffffff0d;
  --border: #2a3038;
  --border-strong: #3a424d;
  --text: #e6edf3;
  --muted: #94a2b2;
  --accent: #ff6b35;
  --accent-weak: #ff6b3524;
  --ember: #ff8a1a;
  --hover: #ffffff12;
  --active-bg: #ff6b3524;
  --shadow-sm: 0 1px 2px #0006;
  --shadow: 0 8px 24px #0008;
  --shadow-lg: 0 18px 50px #000a;
  --topbar-bg: #0d1117ee;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--bg);
}

/* Scrollbars discrètes (panneau) */
#panel::-webkit-scrollbar,
.zones::-webkit-scrollbar,
.modal-box::-webkit-scrollbar {
  width: 8px;
}
#panel::-webkit-scrollbar-thumb,
.zones::-webkit-scrollbar-thumb,
.modal-box::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

/* =========================================================================
   TOPBAR
   ========================================================================= */
#topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  pointer-events: none;
}
.brand-flame {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 1px 3px #ea580c55);
}
.brand-name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.3px;
  color: var(--text);
}
.brand-name .hot {
  color: var(--accent);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.icon-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.icon-btn .ic {
  width: 18px;
  height: 18px;
}
.icon-btn .ic-moon {
  display: none;
}
:root[data-theme="dark"] .icon-btn .ic-sun {
  display: none;
}
:root[data-theme="dark"] .icon-btn .ic-moon {
  display: inline;
}

/* Toggles de couches (mêmes ronds que le bouton thème = uniforme) */
.layer-toggle {
  color: var(--muted);
}
.layer-toggle input {
  display: none;
}
.layer-toggle svg {
  width: 18px;
  height: 18px;
}
.layer-toggle:has(input:checked) {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

/* Bouton "Signaler" */
.report-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px #d92d2033;
}
.report-btn:hover {
  filter: brightness(1.05);
}
.report-btn.active {
  box-shadow: 0 0 0 3px #d92d2044;
  animation: pulseBtn 1s infinite;
}
@keyframes pulseBtn {
  50% {
    opacity: 0.65;
  }
}

/* Pastille statut données */
.pill {
  pointer-events: auto;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.pill-live {
  color: var(--ok);
  border-color: #a6d8bd;
  background: #e9f6ef;
}
.pill-demo {
  color: var(--warn);
  border-color: #eac48a;
  background: #fdf3e2;
}
.pill-muted {
  color: var(--muted);
}
:root[data-theme="dark"] .pill-live {
  border-color: #1f6f43;
  background: transparent;
}
:root[data-theme="dark"] .pill-demo {
  border-color: #7a5a1a;
  background: transparent;
}

/* Topbar compacte sur mobile */
@media (max-width: 620px) {
  #topbar {
    padding: 7px 10px;
    gap: 6px;
  }
  .brand-name {
    display: none;
  }
  .top-actions {
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .top-actions::-webkit-scrollbar {
    display: none;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
  }
  .report-btn {
    flex: 0 0 auto;
    font-size: 11.5px;
    padding: 7px 10px;
  }
  #dataStatus {
    flex: 0 0 auto;
    font-size: 10.5px;
    padding: 4px 8px;
  }
}

/* =========================================================================
   MARQUEURS & TOASTS (sur la carte)
   ========================================================================= */
.rep {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px #16212b40;
}
.rep-wait {
  background: #f0a020;
  color: #4a2d00;
  font-weight: 800;
}
.rep-on {
  background: var(--danger);
  color: #fff;
}
.alert-marker {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 900;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 7px #16212b4d;
  background: var(--ember);
}
.alert-marker.lvl-red {
  background: #c1121f;
}
.alert-marker.lvl-green {
  background: #2f9e44;
}
.me-dot {
  width: 16px;
  height: 16px;
  background: #2f80ed;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #2f80ed44;
}
.plane {
  line-height: 0;
}
.plane svg {
  filter: drop-shadow(0 1px 2px #16212b66);
}
.wind-arrow {
  line-height: 0;
  filter: drop-shadow(0 1px 2px #16212b40);
  opacity: 0.92;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%) translateY(10px);
  z-index: 2000;
  background: #1b2530;
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: 88%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* "Zone estimée" (badge sur la carte) */
.fz-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  pointer-events: none;
}
.fz-dot {
  font-size: 18px;
  filter: drop-shadow(0 1px 3px #16212b66);
}
.fz-label {
  background: #c1121f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 3px 8px;
  border-radius: 7px;
  box-shadow: var(--shadow);
}

/* Spinner */
.spin {
  display: inline-block;
  animation: sp 0.8s linear infinite;
}
@keyframes sp {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================================
   LÉGENDE CARTE
   ========================================================================= */
.map-legend {
  position: absolute;
  left: 12px;
  bottom: 24px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 11.5px;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.map-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lg {
  width: 13px;
  height: 13px;
  display: inline-block;
  flex: none;
}
.lg-active {
  background: #ff3c1e;
  border-radius: 50%;
  box-shadow: 0 0 4px #ff3c1e88;
}
.lg-front {
  height: 3px;
  align-self: center;
  background: #e01e1e;
  border-radius: 2px;
}
.lg-burnt {
  background: #6b7280;
  border: 1.5px solid #4b5563;
  border-radius: 3px;
}
.lg-plane {
  background: #1d5fd8;
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
}
@media (max-width: 620px) {
  .map-legend {
    bottom: 60px;
    font-size: 10.5px;
    padding: 8px 10px;
  }
}

/* =========================================================================
   PANNEAU GAUCHE + CARTES
   ========================================================================= */
#panel {
  position: absolute;
  top: 62px;
  left: 12px;
  z-index: 1000;
  width: 330px;
  max-height: calc(100% - 78px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
  transition: transform 0.28s ease, opacity 0.2s ease;
}
.card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}
.row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
select,
.btn {
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover,
select:hover {
  border-color: var(--accent);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-danger {
  width: 100%;
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 700;
  padding: 11px;
  box-shadow: 0 2px 10px #d92d2029;
}
.btn-danger:hover {
  filter: brightness(1.06);
  border-color: var(--danger);
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* Liste des feux */
.zones {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 230px;
  overflow-y: auto;
}
.fire-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--panel-solid);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.fire-item:hover {
  background: var(--hover);
}
.fire-item:active {
  transform: scale(0.99);
}
.fire-item.active {
  background: var(--active-bg);
  border-color: var(--accent);
}
.fi-main {
  min-width: 0;
}
.fi-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fi-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.fi-badge {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Qualité de l'air */
.aqi {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
}
.aqi b {
  font-weight: 700;
}

/* Bulletin */
#bulletinText {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}
.bulletin-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

/* =========================================================================
   PANNEAU DROIT "Situation & propagation"
   ========================================================================= */
#rightPanel {
  position: absolute;
  top: 62px;
  right: 12px;
  z-index: 1000;
  width: 330px;
  max-width: calc(100% - 24px);
}
#rightPanel #simCard {
  animation: slideIn 0.22s ease;
}
@keyframes slideIn {
  from {
    transform: translateX(12px);
    opacity: 0;
  }
}
.rp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.rp-head h2 {
  margin: 0;
}
.rp-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 6px;
}
.rp-close:hover {
  color: var(--accent);
}

/* Métadonnées simulation */
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.meta-grid .m {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.meta-grid .m b {
  display: block;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
}
.meta-grid .m span {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.meta-grid .sim-warn {
  grid-column: 1 / -1;
  background: #fdf3e2;
  border: 1px solid #eac48a;
  color: #7a4a08;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.4;
}
:root[data-theme="dark"] .meta-grid .sim-warn {
  background: #4a2c0033;
  border-color: #b9740055;
  color: var(--text);
}

/* Sélecteur d'horizon (segmenté) */
.horizon-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.hz-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-right: 2px;
}
.hz {
  flex: 1;
  padding: 7px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel-solid);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.hz:hover {
  border-color: var(--accent);
}
.hz.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px #dc2f1e2e;
}

/* Timeline */
.timeline input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 22px;
}
.timeline-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
#playBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  background: var(--accent-weak);
  border: 1px solid var(--accent);
  color: var(--accent);
}
#playBtn:hover {
  background: var(--accent);
  color: #fff;
}
#timeLabel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#timeLabel b {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.rel {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.rel-hi {
  background: #e6f4ea;
  color: #147247;
}
.rel-mid {
  background: #fdf0da;
  color: #a15a08;
}
.rel-lo {
  background: #fdeceb;
  color: #bd271b;
}
:root[data-theme="dark"] .rel-hi {
  background: #0f5132;
  color: #b8f0cf;
}
:root[data-theme="dark"] .rel-mid {
  background: #5a4611;
  color: #ffe6a0;
}
:root[data-theme="dark"] .rel-lo {
  background: #5a1f1f;
  color: #ffc4c4;
}

/* Légende propagation */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text);
}
.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sw {
  display: inline-block;
  vertical-align: middle;
}
.sw-burnt-lg {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #6b7280;
  border: 1px solid #4b5563;
}
.sw-active {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #ff2a00;
  opacity: 0.6;
}
.sw-front {
  width: 17px;
  height: 0;
  border-top: 3px solid #e01e1e;
}
.legend-note {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.legend-note.warn {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: #fdf3e2;
  border: 1px solid #eac48a;
  color: #7a4a08;
}
:root[data-theme="dark"] .legend-note.warn {
  background: #4a2c0033;
  border-color: #b9740055;
  color: var(--text);
}

/* =========================================================================
   RÉSULTAT "Suis-je en danger ?"
   ========================================================================= */
#evacResult {
  margin-top: 10px;
}
.alert {
  border-radius: var(--radius-sm);
  padding: 13px;
  border: 1px solid;
  animation: pop 0.2s ease;
}
@keyframes pop {
  from {
    transform: scale(0.97);
    opacity: 0;
  }
}
.alert h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
.alert p {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.45;
}
.off-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.off-actions .btn {
  text-decoration: none;
  font-size: 13px;
  padding: 9px 13px;
}
.a-danger {
  background: #fdeceb;
  border-color: #e6a9a3;
  color: #8a1c12;
}
.a-warning {
  background: #fef3e2;
  border-color: #eac48a;
  color: #7a4a08;
}
.a-watch {
  background: #fbf8e3;
  border-color: #ddd08a;
  color: #6b6209;
}
.a-safe {
  background: #e9f6ef;
  border-color: #a6d8bd;
  color: #0f5f39;
}
:root[data-theme="dark"] .a-danger {
  background: #3a0d0a;
  color: #ffd7d2;
}
:root[data-theme="dark"] .a-warning {
  background: #3a2a0a;
  color: #ffe9c2;
}
:root[data-theme="dark"] .a-watch {
  background: #2a2a0a;
  color: #f5f0c0;
}
:root[data-theme="dark"] .a-safe {
  background: #0d2a18;
  color: #c8f5db;
}
.advice {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
  font-style: italic;
  font-size: 12px;
}

/* =========================================================================
   MODALE "Comment ça marche"
   ========================================================================= */
.modal[hidden] {
  display: none; /* sinon le display:flex ci-dessous écrase l'attribut hidden */
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #16212b66;
  backdrop-filter: blur(4px);
}
.modal-box {
  position: relative;
  max-width: 560px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 26px;
  box-shadow: var(--shadow-lg);
}
.modal-box h2 {
  margin: 0 0 12px;
  font-size: 20px;
}
.modal-box h3 {
  margin: 18px 0 5px;
  font-size: 14px;
  color: var(--accent);
}
.modal-box p,
.modal-box li {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.modal-box ul {
  margin: 4px 0;
  padding-left: 18px;
}
.modal-box a {
  color: var(--accent);
  font-weight: 600;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  cursor: pointer;
}
.modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =========================================================================
   BANDEAU LÉGAL
   ========================================================================= */
.legal-bar {
  position: fixed;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  z-index: 1200;
  max-width: 94%;
  font-size: 10px;
  line-height: 1.3;
  color: var(--muted);
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 12px;
  text-align: center;
  pointer-events: none;
}
@media (max-width: 620px) {
  .legal-bar {
    font-size: 9px;
    bottom: 2px;
  }
}

/* =========================================================================
   POIGNÉE / PANNEAU REPLIABLE
   ========================================================================= */
.panel-handle {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  margin-bottom: 2px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.panel-handle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.panel-handle .grabber {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
}

/* Desktop : replié = escamoté à gauche (réouverture via ☰) */
@media (min-width: 621px) {
  .panel-handle .grabber {
    display: none;
  }
  body.panel-collapsed #panel {
    transform: translateX(calc(-100% - 24px));
    opacity: 0;
    pointer-events: none;
  }
}

/* Mobile : bottom-sheet */
@media (max-width: 620px) {
  #panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 74%;
    border-radius: 18px 18px 0 0;
    background: var(--panel-solid);
    box-shadow: 0 -8px 30px #16212b1f;
    padding: 8px 12px 20px;
  }
  .handle-label {
    display: none;
  }
  .panel-handle {
    height: 28px;
    box-shadow: none;
    border: none;
    background: transparent;
  }
  body.panel-collapsed #panel {
    transform: translateY(calc(100% - 48px));
  }
  #rightPanel {
    top: auto;
    bottom: 58px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }
}
