/* Présence — même ossature que Monitoring et Chlocogram (barre du haut, onglets
   qui descendent sous le pouce sur téléphone, fenêtres en feuille, thème clair
   ou sombre), avec sa propre palette : un vert d'eau, couleur des ondes. */

:root {
  color-scheme: light;
  --bg: #f3f6f6;
  --surface: #ffffff;
  --surface-2: #e7eeee;
  --text: #13262a;
  --muted: #587073;
  --line: #d3e0e0;
  --accent: #0f7d79;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --ok: #1a8f4c;
  --warn: #b8620f;
  --danger: #c93a52;
  --still: #2f80c4;
  --moving: #d9822b;
  --active: #d64545;
  --grad: linear-gradient(45deg, #2bc4b0, #0f7d79 55%, #155e75);
  --radius: 16px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1416;
  --surface: #122124;
  --surface-2: #1a2e32;
  --text: #e5f1f1;
  --muted: #8ea7aa;
  --line: #24393d;
  --accent: #4fd1c5;
  --ok: #4ade80;
  --warn: #f0a04b;
  --danger: #ff7d8f;
  --still: #6cb2ff;
  --moving: #fbbf24;
  --active: #ff7b7b;
  --grad: linear-gradient(45deg, #5eead4, #2dd4bf 55%, #38bdf8);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(900px 420px at 50% -160px, color-mix(in srgb, var(--accent) 16%, transparent), transparent) no-repeat var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; overflow-wrap: anywhere; }
h2 { font-size: 17px; margin: 0; }
p { margin: 8px 0; }
.muted { color: var(--muted); font-size: 13px; }
.ok-text { color: var(--ok); font-weight: 600; }
.danger-text { color: var(--danger) !important; }

.logo {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo.big { font-size: 30px; }

/* ---------- boutons et champs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 9px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #062022; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

input[type="text"], input[type="password"], select {
  width: 100%; min-height: 44px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
input:focus-visible, select:focus-visible, .btn:focus-visible, .tab:focus-visible, .row:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.field > span:first-child { font-weight: 600; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

.segmented { display: flex; padding: 3px; border-radius: 999px; background: var(--surface-2); margin: 4px 0 8px; }
.segmented button {
  flex: 1; min-height: 36px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }

/* ---------- ossature ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 760px; margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 4px;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { border-radius: 8px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
.live.off .live-dot { background: var(--danger); animation: none; }
@keyframes pulse { 50% { opacity: 0.35; } }

.tabs { display: flex; gap: 6px; max-width: 760px; margin: 0 auto; padding: 10px 16px 0; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--muted); font-weight: 600; text-decoration: none;
}
.tab svg { width: 18px; height: 18px; flex: none; }
.tab[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.view { max-width: 760px; margin: 0 auto; padding: 14px 16px 40px; display: grid; gap: 14px; }

.banner {
  display: flex; align-items: center; gap: 8px; max-width: 728px; margin: 12px auto 0;
  padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--line);
}
@media (max-width: 760px) { .banner { margin-inline: 16px; } }
.banner-text { flex: 1; text-align: left; background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 0; }
.banner-close { background: none; border: 0; color: var(--muted); font-size: 16px; padding: 8px 10px; cursor: pointer; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.foot { margin: 12px 0 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 600; z-index: 50; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* ---------- Maison : plan 3D ---------- */

.card.house { position: relative; padding: 0; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); }
.house-stage { position: relative; }
.house-canvas { position: relative; height: clamp(360px, 62vh, 600px); touch-action: none; }
.house-canvas canvas { display: block; width: 100%; height: 100%; outline: none; }
.house-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 20px; text-align: center; }
.house-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.house-top > * { pointer-events: auto; }
.house-people { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line);
  color: var(--text); font-size: 13.5px; font-weight: 600; text-decoration: none; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.chip.home { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); }
.house-note {
  position: absolute; left: 10px; right: 10px; bottom: 58px; padding: 8px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; text-align: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.house-bottom { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.house-bottom .segmented { margin: 0; background: color-mix(in srgb, var(--surface-2) 90%, transparent); }
.house-bottom .btn { background: color-mix(in srgb, var(--surface) 90%, transparent); }
.house-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 14px 12px; border-top: 1px solid var(--line); font-size: 12.5px; }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.lg.still::before { background: var(--still); }
.lg.moving::before { background: var(--moving); }
.lg.active::before { background: var(--active); }
.lg.heat::before { width: 18px; border-radius: 3px; background: linear-gradient(90deg, #14b8a6, #facc15, #ef4444); }
.segmented.compact { display: inline-flex; }
.segmented.compact button { flex: none; min-height: 32px; padding: 4px 12px; font-size: 13px; }

.vitals { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: 12px 0 0; font-weight: 600; }

/* ---------- Maison : personnes ---------- */

.hero-count { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.hero-number { font-size: 52px; line-height: 1; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.hero-number.on { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-label { font-size: 19px; font-weight: 700; }

.people { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.person-emoji { font-size: 26px; line-height: 1; flex: none; }
.person-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.person-text strong, .person-text .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.person.home { background: color-mix(in srgb, var(--ok) 11%, var(--surface)); }
.person.home .person-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.person.away { opacity: 0.75; }

/* ---------- Maison : capteurs Wi-Fi ---------- */

.rf-status { display: flex; align-items: center; gap: 16px; margin: 6px 0 12px; --tone: var(--muted); }
.rf-status.still { --tone: var(--still); }
.rf-status.moving { --tone: var(--moving); }
.rf-status.active { --tone: var(--active); }
.rf-title { display: block; font-size: 19px; }

/* Trois ondes qui s'élargissent : plus vite quand ça bouge, immobiles sans personne. */
.rf-orb { position: relative; width: 54px; height: 54px; flex: none; }
.rf-orb span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--tone); opacity: 0; }
.rf-orb span:first-child { inset: 19px; background: var(--tone); opacity: 1; border: 0; }
.rf-status:not(.calm) .rf-orb span:not(:first-child) { animation: wave 2.4s ease-out infinite; }
.rf-status:not(.calm) .rf-orb span:nth-child(3) { animation-delay: 1.2s; }
.rf-status.moving .rf-orb span:not(:first-child), .rf-status.active .rf-orb span:not(:first-child) { animation-duration: 1.2s; }
.rf-status.moving .rf-orb span:nth-child(3), .rf-status.active .rf-orb span:nth-child(3) { animation-delay: 0.6s; }
.rf-status.calm .rf-orb span:first-child { background: var(--line); }
@keyframes wave { 0% { transform: scale(0.4); opacity: 0.9; } 100% { transform: scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rf-orb span, .live-dot { animation: none !important; } }

.spark-wrap { background: var(--surface-2); border-radius: 12px; padding: 8px 8px 4px; }
.spark { display: block; width: 100%; height: 64px; }
.spark-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.spark-area { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-legend { display: flex; justify-content: space-between; font-size: 11.5px; padding: 2px 2px 0; }

.rooms { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.room { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); --tone: var(--line); min-width: 0; }
.room.still { --tone: var(--still); }
.room.moving { --tone: var(--moving); }
.room.active { --tone: var(--active); }
.room.calm { --tone: var(--muted); }
.room.stale { opacity: 0.55; }
.room-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--tone); flex: none; }
.room-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.room-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-signal { font-size: 11.5px; flex: none; }

.demo-note {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 8px; border-radius: 12px;
  background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--text); font-size: 14px; font-weight: 600;
}

.setup ol { padding-left: 20px; margin: 10px 0 14px; }
.setup li { margin: 6px 0; }

/* ---------- ondes Wi-Fi ---------- */

.linklist { list-style: none; margin: 0; padding: 0; }
.link { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); --tone: var(--muted); }
.link:first-child { border-top: 0; }
.link.still { --tone: var(--still); }
.link.moving { --tone: var(--moving); }
.link.active { --tone: var(--active); }
.link.stale { opacity: 0.5; }
.link .room-text strong { font-size: 14px; }
.meter { width: 64px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; flex: none; }
.meter > span { display: block; height: 100%; background: var(--tone); border-radius: 3px; transition: width 0.4s; }

/* ---------- événements ---------- */

.events { list-style: none; margin: 0; padding: 0; }
.event { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.event:first-child { border-top: 0; }
.event-time { flex: none; min-width: 52px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.event-text { display: flex; flex-direction: column; min-width: 0; }
.event.empty_motion .event-text > span:first-child { color: var(--danger); font-weight: 600; }

/* ---------- Historique ---------- */

.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daynav .btn { font-size: 22px; min-width: 44px; }
.timeline { display: flex; flex-direction: column; gap: 8px; }
.tl-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; }
.tl-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-bar { display: block; width: 100%; height: 18px; border-radius: 5px; }
.tl-track { fill: var(--surface-2); }
.tl-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tl-home { fill: var(--ok); }
.tl-rf { fill: var(--accent); }
.tl-now { stroke: var(--danger); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tl-hours { display: flex; justify-content: space-between; font-size: 11.5px; }
@media (max-width: 480px) { .tl-row { grid-template-columns: 84px 1fr; gap: 8px; } .tl-name { font-size: 13px; } }

/* ---------- Réglages ---------- */

.rows { list-style: none; margin: 0 0 12px; padding: 0; }
.rows li + li { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 2px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row-emoji { font-size: 24px; flex: none; }
.row-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-text strong, .row-text .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: var(--muted); font-size: 22px; flex: none; }
.sub { font-size: 14px; margin: 14px 0 6px; }
form.inline { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.push .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.logout { text-align: center; }

.emojis { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji { width: 44px; height: 44px; font-size: 22px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.emoji[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); }
.device-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; max-height: 50vh; overflow-y: auto; }
.check.device + .check.device { border-top: 1px solid var(--line); }

/* ---------- éditeur du plan ---------- */

.editor-head { margin: 0; }
.editor-card { padding: 8px; }
.editor { display: block; width: 100%; height: clamp(300px, 52vh, 560px); touch-action: none; background: var(--surface-2); border-radius: 12px; user-select: none; -webkit-user-select: none; }
.ed-grid { stroke: var(--line); stroke-width: 0.02; }
.ed-room rect { stroke: var(--muted); stroke-width: 0.06; cursor: grab; }
.ed-room.sel rect { stroke: var(--accent); stroke-width: 0.1; }
.ed-room text { pointer-events: none; text-anchor: middle; fill: var(--text); }
.ed-name { font-size: 0.42px; font-weight: 700; }
.ed-size { font-size: 0.3px; fill: var(--muted) !important; }
.ed-room.c0 rect { fill: #cfe7e2; } .ed-room.c1 rect { fill: #efe2cc; } .ed-room.c2 rect { fill: #d3def0; } .ed-room.c3 rect { fill: #ecd9ea; }
.ed-room.c4 rect { fill: #dbe9cc; } .ed-room.c5 rect { fill: #f0e6c8; } .ed-room.c6 rect { fill: #cde4ec; } .ed-room.c7 rect { fill: #e2dcf2; }
:root[data-theme="dark"] .ed-room.c0 rect { fill: #1f3a3f; } :root[data-theme="dark"] .ed-room.c1 rect { fill: #3a3426; }
:root[data-theme="dark"] .ed-room.c2 rect { fill: #252f45; } :root[data-theme="dark"] .ed-room.c3 rect { fill: #3a2a3a; }
:root[data-theme="dark"] .ed-room.c4 rect { fill: #2b3a24; } :root[data-theme="dark"] .ed-room.c5 rect { fill: #3b3523; }
:root[data-theme="dark"] .ed-room.c6 rect { fill: #213640; } :root[data-theme="dark"] .ed-room.c7 rect { fill: #2f2a48; }
.ed-sensor circle { fill: var(--accent); stroke: var(--surface); stroke-width: 0.06; cursor: grab; }
.ed-sensor.sel circle { stroke: var(--text); stroke-width: 0.08; }
.ed-sensor text { pointer-events: none; text-anchor: middle; font-size: 0.32px; font-weight: 800; fill: #fff; }
.ed-handle { fill: var(--accent); cursor: nwse-resize; }
.ed-beam { stroke: var(--accent); stroke-width: 0.04; stroke-dasharray: 0.15 0.12; opacity: 0.7; pointer-events: none; }
.ed-device rect { fill: var(--surface); stroke: var(--text); stroke-width: 0.05; cursor: grab; }
.ed-device.sel rect { stroke: var(--accent); stroke-width: 0.09; }
.ed-device text { pointer-events: none; text-anchor: middle; font-size: 0.28px; font-weight: 700; fill: var(--text); }
.ed-spot circle { fill: var(--surface); stroke: var(--accent); stroke-width: 0.07; cursor: grab; }
.ed-spot.sel circle { stroke: var(--text); stroke-width: 0.1; }
.ed-spot text { pointer-events: none; text-anchor: middle; font-size: 0.36px; }
.editor-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 4px 2px; }
.editor-form .card { display: grid; gap: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field.small { margin: 8px 0; }
.field.small input { min-height: 40px; }
input[type="number"] { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
.editor-save { display: flex; justify-content: flex-end; gap: 8px; }
.row.static { cursor: default; }

/* ---------- fenêtres ---------- */

dialog { color: var(--text); border: 0; padding: 0; }
dialog::backdrop { background: rgba(4, 14, 16, 0.65); }
.sheet { width: min(560px, 100vw); max-width: 100vw; max-height: min(92vh, 100dvh); border-radius: 20px; background: var(--surface); }
.sheet[open] { display: flex; flex-direction: column; }
.sheet-head { padding: 18px 20px 6px; flex: none; }
.sheet-head h2 { font-size: 20px; overflow-wrap: anywhere; }
.sheet-head p { margin: 2px 0 0; overflow-wrap: anywhere; }
.sheet-body { overflow-y: auto; padding: 4px 20px 12px; flex: 1 1 auto; min-height: 0; }
.sheet-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); flex: none; }
.sheet-foot .btn:first-child { margin-right: auto; }
@media (max-width: 600px) {
  .sheet { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .sheet-head { padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
}
.alert { width: min(380px, calc(100vw - 32px)); padding: 20px; border-radius: 18px; background: var(--surface); }
.alert[open] { display: flex; flex-direction: column; gap: 8px; }
.alert h2 { margin-bottom: 4px; }

/* ---------- connexion ---------- */

.login-page { display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 28px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; text-align: center;
}
.login-logo { border-radius: 20px; }
.tagline { color: var(--muted); margin: -6px 0 6px; }
.login-card input, .login-card .btn { width: 100%; }
.form-error { width: 100%; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 600; }

/* ---------- téléphone : onglets sous le pouce ---------- */

@media (max-width: 700px) {
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; justify-content: space-around; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tab { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; border: 0; background: none; font-size: 11.5px; border-radius: 12px; }
  .tab svg { width: 22px; height: 22px; }
  .tab[aria-current="page"] { background: none; }
  .view { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
@media (display-mode: standalone) {
  .btn, .tab, .row { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
}
