/* Styles partagés par toutes les pages de l'app de démos. */
:root {
  --ink: #2b3440; --soft: #6b7480; --line: #e6e1d9; --bg: #f7f4ee; --card: #ffffff;
  --accent: #e8673e; --accent-ink: #ffffff; --danger: #c43d3d; --ok: #2e9e5b; --info: #3f72b8;
  --radius: 12px; --shadow: 0 4px 20px rgba(40, 30, 20, .12), 0 0 0 1px rgba(0, 0, 0, .04);
  --topbar-h: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: .01em; }

/* Barre du haut ----------------------------------------------------------- */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--card); border-bottom: 1px solid var(--line); position: relative; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; text-decoration: none; }
.flag { display: inline-flex; width: 21px; height: 14px; border-radius: 2px; overflow: hidden; }
.flag i { flex: 1; } .flag i:nth-child(1) { background: #14b53a; } .flag i:nth-child(2) { background: #fcd116; } .flag i:nth-child(3) { background: #ce1126; }
.topbar .crumb { color: var(--soft); }
.topbar .spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--soft); }

/* Badges, boutons, champs --------------------------------------------------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
         text-transform: uppercase; letter-spacing: .06em; background: #eef0f3; color: var(--soft); }
.badge.admin { background: #fde6dd; color: #b8492a; }
.badge.modifier { background: #e3eefb; color: #2f5f9e; }
.badge.viewer { background: #e7f4ec; color: #237a46; }
.badge.demo { background: #fff3cd; color: #8a6d1a; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
       border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
       font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--soft); font-weight: 500; }
.input, select.input { height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink); width: 100%; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }

/* Cartes et listes ------------------------------------------------------------ */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.muted { color: var(--soft); }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--soft); font-size: 13px; padding: 10px 0; }

table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th, table.table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.table th { color: var(--soft); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }

/* Mise en page d'une démo : carte plein écran + panneau latéral ------------------------- */
.demo-layout { position: absolute; inset: var(--topbar-h) 0 0 0; display: flex; }
.demo-map { flex: 1; position: relative; }
.demo-map #map { position: absolute; inset: 0; }
.side-panel { width: 340px; max-width: 45vw; background: var(--card); border-left: 1px solid var(--line);
              overflow-y: auto; padding: 18px 18px 24px; }
.side-panel h2 { font-size: 16px; margin-bottom: 4px; }
.side-panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); margin: 18px 0 8px; }
.side-panel p { margin: 6px 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 12px 0; }
.tabs button { border: 0; background: none; padding: 8px 10px; font: inherit; color: var(--soft); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 8px; vertical-align: -2px; }

@media (max-width: 760px) {
  /* barre du haut sur téléphone : pas de fil d'Ariane, nom d'utilisateur masqué (le badge de rôle reste) */
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar .crumb { display: none; }
  .userbox { font-size: 0; gap: 0; }
  .userbox .badge { font-size: 11px; }
  .demo-layout { flex-direction: column; }
  .side-panel { width: 100%; max-width: none; height: 42%; border-left: 0; border-top: 1px solid var(--line); }
}

/* Popups MapLibre + toasts ---------------------------------------------------- */
.maplibregl-popup-content { border-radius: 10px; padding: 12px 14px; font: 13px/1.4 system-ui, sans-serif; box-shadow: var(--shadow); }
.maplibregl-popup-content h4 { margin: 0 0 4px; font-size: 14px; }
.maplibregl-popup-content .actions { display: flex; gap: 6px; margin-top: 10px; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .2s ease-out; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
