/* Poêle — feuille de style (aucune dépendance, aucun style en ligne) */

:root {
  color-scheme: light dark;
  --bg: #f7f1ea;
  --bg-2: #efe4d8;
  --surface: #fffdfa;
  --surface-2: #f4ebe1;
  --surface-3: #eadccd;
  --border: rgba(80, 40, 10, 0.09);
  --text: #2b1d15;
  --muted: #76614f;
  --accent: #ef6a1c;
  --accent-2: #ff9a3c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(239, 106, 28, 0.12);
  /* texte orange et aplats orange sous texte blanc : contrastes WCAG AA (>= 4.5:1) */
  --accent-text: #c2510f;
  --accent-fill: #bd4f0e;
  --accent-fill-2: #c45210;
  --accent-fill-ink: #ffffff;
  --danger: #d63b2c;
  --danger-soft: #fdebe7;
  --danger-ink: #8e1f13;
  --danger-fill: #c8372a;
  --danger-fill-ink: #ffffff;
  --warn: #b7781a;
  --warn-soft: #fff3da;
  --warn-ink: #7a4f0a;
  --ok: #2c9a5f;
  --ok-soft: #e3f5ea;
  --ok-ink: #1d7044;
  --cold: #3b8fd6;
  --cold-soft: rgba(59, 143, 214, 0.14);
  --shadow: 0 1px 2px rgba(70, 35, 10, 0.05), 0 10px 30px rgba(70, 35, 10, 0.08);
  --shadow-strong: 0 18px 60px rgba(40, 20, 5, 0.28);
  --radius: 24px;
  --radius-sm: 14px;
  --tabbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14100d;
    --bg-2: #1b1410;
    --surface: #1f1813;
    --surface-2: #2a201a;
    --surface-3: #352920;
    --border: rgba(255, 220, 190, 0.08);
    --text: #f7ece3;
    --muted: #a8968a;
    --accent: #ff7a26;
    --accent-2: #ffad4d;
    --accent-ink: #1d0f06;
    --accent-soft: rgba(255, 122, 38, 0.16);
    --accent-text: #ff8a3d;
    --accent-fill: #ff7a26;
    --accent-fill-2: #ffad4d;
    --accent-fill-ink: #1d0f06;
    --danger: #ff6b5b;
    --danger-soft: rgba(255, 90, 70, 0.14);
    --danger-ink: #ffb4aa;
    --danger-fill: #c8372a;
    --danger-fill-ink: #ffffff;
    --warn: #f0b048;
    --warn-soft: rgba(240, 176, 72, 0.13);
    --warn-ink: #f6d39a;
    --ok: #4cc485;
    --ok-soft: rgba(76, 196, 133, 0.14);
    --ok-ink: #4cc485;
    --cold: #6bb3f0;
    --cold-soft: rgba(107, 179, 240, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-strong: 0 18px 60px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(120% 60% at 50% -10%, var(--bg-2) 0%, var(--bg) 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.stove-hot {
  background-image: radial-gradient(120% 55% at 50% -12%, rgba(255, 122, 38, 0.22) 0%, var(--bg) 62%);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.center { text-align: center; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; overflow-wrap: anywhere; }

/* ---------- mise en page ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px);
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px 14px; }
.topbar-title { min-width: 0; }
.eyebrow { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.stove-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-title { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: -0.02em; margin: 6px 2px 4px; }
.content { display: block; }
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

/* ---------- pastille d'état ---------- */
.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
[data-phase="on"] .pill .dot, [data-phase="standby"] .pill .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
[data-phase="igniting"] .pill .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
[data-phase="turning_off"] .pill .dot, [data-phase="cooling"] .pill .dot { background: var(--cold); animation: pulse 1.8s ease-in-out infinite; }
[data-phase="alarm"] .pill { background: var(--danger-soft); color: var(--danger-ink); border-color: transparent; }
[data-phase="alarm"] .pill .dot { background: var(--danger); animation: pulse 0.9s ease-in-out infinite; }
[data-phase="disconnected"] .pill .dot, [data-phase="unknown"] .pill .dot { background: var(--warn); }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }

/* ---------- bandeaux ---------- */
.banners:empty { display: none; }
.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 18px;
  margin-bottom: 12px;
  font-size: 0.94rem;
}
.banner svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.banner strong { display: block; font-size: 1rem; margin-bottom: 2px; }
.banner p { margin: 0; }
.banner .banner-action { margin-top: 8px; }
.banner.alarm { background: var(--danger-fill); color: var(--danger-fill-ink); box-shadow: 0 10px 30px rgba(200, 55, 42, 0.3); }
.banner.alarm .link-btn { color: var(--danger-fill-ink); }
.banner.warn .link-btn { color: var(--warn-ink); }
.banner.warn { background: var(--warn-soft); color: var(--warn-ink); }
.banner.info { background: var(--surface-2); color: var(--text); }

/* ---------- héros : température + flamme ---------- */
.hero { text-align: center; padding: 22px 18px 16px; overflow: hidden; }
.hero-glow {
  position: absolute;
  inset: -30% -20% auto;
  height: 120%;
  background: radial-gradient(closest-side, rgba(255, 122, 38, 0.32), rgba(255, 122, 38, 0));
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
[data-phase="on"] .hero-glow, [data-phase="igniting"] .hero-glow { opacity: 1; }
[data-phase="igniting"] .hero-glow { opacity: 0.55; animation: glow 2.4s ease-in-out infinite; }
[data-phase="cooling"] .hero-glow, [data-phase="turning_off"] .hero-glow {
  opacity: 0.8;
  background: radial-gradient(closest-side, rgba(59, 143, 214, 0.22), rgba(59, 143, 214, 0));
}
[data-phase="alarm"] .hero-glow { opacity: 1; background: radial-gradient(closest-side, rgba(214, 59, 44, 0.25), rgba(214, 59, 44, 0)); }
@keyframes glow { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.8; } }

.flame-stage { position: relative; height: 128px; display: flex; justify-content: center; align-items: flex-end; }
.flame { width: 96px; height: 128px; overflow: visible; }
.flame-shadow { fill: #000; opacity: 0.12; }
.flame-body, .flame .f1, .flame .f2, .flame .f3 {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 0.9s cubic-bezier(.2, .8, .2, 1), opacity 0.9s ease, fill 0.6s ease;
}
/* éteint : une braise discrète */
.flame-body { transform: scale(0.42); opacity: 0.4; }
.flame .f1, .flame .f2, .flame .f3 { fill: var(--surface-3); }
.flame .f3 { opacity: 0.6; }
/* en marche */
[data-phase="on"] .flame-body, [data-phase="standby"] .flame-body { transform: scale(1); opacity: 1; }
[data-phase="on"] .flame .f1 { fill: url(#gf1); animation: flick1 1.6s ease-in-out infinite alternate; }
[data-phase="on"] .flame .f2 { fill: url(#gf2); animation: flick2 1.25s ease-in-out infinite alternate; }
[data-phase="on"] .flame .f3 { fill: url(#gf3); opacity: 1; animation: flick3 0.9s ease-in-out infinite alternate; }
/* veille : petite flamme calme */
[data-phase="standby"] .flame-body { transform: scale(0.6); }
[data-phase="standby"] .flame .f1 { fill: url(#gf1); opacity: 0.8; }
[data-phase="standby"] .flame .f2 { fill: url(#gf2); }
[data-phase="standby"] .flame .f3 { fill: url(#gf3); opacity: 1; }
/* allumage : la flamme grandit */
[data-phase="igniting"] .flame-body { opacity: 1; animation: ignite 2.4s ease-in-out infinite; }
[data-phase="igniting"] .flame .f1 { fill: url(#gf1); }
[data-phase="igniting"] .flame .f2 { fill: url(#gf2); }
[data-phase="igniting"] .flame .f3 { fill: url(#gf3); opacity: 1; }
/* extinction / refroidissement : bleuté, décroissant */
[data-phase="turning_off"] .flame-body, [data-phase="cooling"] .flame-body { transform: scale(0.5); opacity: 0.7; }
[data-phase="turning_off"] .flame .f1, [data-phase="cooling"] .flame .f1 { fill: var(--cold); opacity: 0.35; }
[data-phase="turning_off"] .flame .f2, [data-phase="cooling"] .flame .f2 { fill: var(--cold); opacity: 0.55; }
[data-phase="turning_off"] .flame .f3, [data-phase="cooling"] .flame .f3 { fill: var(--cold); opacity: 0.9; }
/* alarme */
[data-phase="alarm"] .flame-body { transform: scale(0.55); opacity: 1; animation: alarm-blink 1.1s ease-in-out infinite; }
[data-phase="alarm"] .flame .f1, [data-phase="alarm"] .flame .f2, [data-phase="alarm"] .flame .f3 { fill: var(--danger); }
[data-phase="alarm"] .flame .f2 { opacity: 0.6; }
[data-phase="alarm"] .flame .f3 { opacity: 0.3; }

@keyframes flick1 { 0% { transform: scale(1, 1) skewX(0deg); } 50% { transform: scale(0.97, 1.04) skewX(-2deg); } 100% { transform: scale(1.02, 0.97) skewX(1.5deg); } }
@keyframes flick2 { 0% { transform: scale(1, 1) skewX(1deg); } 100% { transform: scale(0.95, 1.07) skewX(-2.5deg); } }
@keyframes flick3 { 0% { transform: scale(1, 1); } 100% { transform: scale(0.9, 1.1) skewX(2deg); } }
@keyframes ignite { 0% { transform: scale(0.35); } 60% { transform: scale(0.75); } 100% { transform: scale(0.35); } }
@keyframes alarm-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.temp {
  position: relative;
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 5.2rem;
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.temp-unit { font-size: 0.5em; vertical-align: top; position: relative; top: 0.32em; margin-left: 2px; color: var(--muted); font-weight: 300; }
.temp-caption { position: relative; color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
.hero-meta { position: relative; display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.updated { font-size: 0.82rem; color: var(--muted); }
.updated.is-stale { color: var(--warn-ink); font-weight: 600; }
.chip { font-size: 0.8rem; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- contrôles ---------- */
.control-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.label { font-weight: 650; font-size: 1rem; }
.hint { color: var(--muted); font-size: 0.84rem; }
.reason { margin: 8px 2px 0; color: var(--muted); font-size: 0.86rem; min-height: 0; }
.reason:empty { display: none; }
.control.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
#crono-reason { margin: 0 4px 14px; }
.control.is-disabled .stepper-value, .control.is-disabled .segmented, .control.is-disabled .chips { opacity: 0.5; }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.round {
  width: 60px; height: 60px; flex: none; border-radius: 50%; border: 0;
  background: var(--surface-2); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease, background 0.2s ease;
}
.round svg { width: 24px; height: 24px; }
.round:active:not(:disabled) { transform: scale(0.92); background: var(--surface-3); }
.round:disabled { opacity: 0.4; }
.stepper-value { font-family: var(--font-display); font-size: 2.6rem; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; transition: color 0.2s ease; }
.stepper-unit { font-size: 0.45em; color: var(--muted); margin-left: 4px; font-weight: 500; }
.stepper-value.pending { color: var(--accent-text); }
.stepper-value.sending { animation: alarm-blink 1s ease-in-out infinite; color: var(--accent-text); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 18px; }
.seg {
  height: 58px; border: 0; border-radius: 14px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-weight: 650; font-size: 1.05rem; color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, transform 0.12s ease;
}
.seg .bars { display: flex; align-items: flex-end; gap: 2px; height: 12px; }
.seg .bars i { display: block; width: 4px; border-radius: 2px; background: currentColor; opacity: 0.3; }
.seg .bars i.on { opacity: 1; }
.seg[aria-checked="true"] { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow); }
.seg.pending { color: var(--accent-text); background: var(--accent-soft); }
.seg:active:not(:disabled) { transform: scale(0.95); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  min-height: 46px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); font-weight: 600; color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
}
.chip-btn[aria-checked="true"] { background: var(--accent-fill); color: var(--accent-fill-ink); border-color: transparent; }
.chip-btn.pending { background: var(--accent-soft); color: var(--accent-text); }

.switch {
  position: relative; width: 60px; height: 36px; flex: none; border-radius: 999px; border: 0;
  background: var(--surface-3); transition: background 0.25s ease;
}
/* zone tactile élargie (72 x 48) sans changer l'aspect */
.switch::before { content: ""; position: absolute; inset: -6px; }
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); transition: transform 0.25s cubic-bezier(.2, .8, .2, 1);
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"] .knob { transform: translateX(24px); }
.switch:disabled { opacity: 0.5; }

/* ---------- bouton marche/arrêt ---------- */
.power-zone { margin: 4px 0 18px; }
#ack-zone { margin-top: 10px; }
.power-btn {
  width: 100%; min-height: 66px; border: 0; border-radius: 22px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em;
  color: var(--accent-fill-ink);
  background: linear-gradient(135deg, var(--accent-fill-2), var(--accent-fill));
  box-shadow: 0 12px 30px rgba(200, 85, 15, 0.32);
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.power-btn svg { width: 24px; height: 24px; }
.power-btn:active:not(:disabled) { transform: scale(0.98); }
.power-btn.off-action { background: var(--surface); color: var(--danger); border: 1.5px solid var(--danger-soft); box-shadow: var(--shadow); }
.power-btn:disabled { background: var(--surface-2); color: var(--muted); box-shadow: none; border: 0; }
.power-btn.busy span::after { content: ""; display: inline-block; width: 1em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.demo-tools .btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.footer-note { text-align: center; color: var(--muted); font-size: 0.82rem; margin: 22px 0 8px; }

/* ---------- boutons génériques ---------- */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 0; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn-primary { background: var(--accent-fill); color: var(--accent-fill-ink); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-primary.danger { background: var(--danger-fill); color: var(--danger-fill-ink); }
.big { width: 100%; min-height: 56px; font-size: 1.05rem; border-radius: 16px; }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.5; }
.link-btn {
  border: 0; background: none; padding: 0 6px; min-height: 44px; display: inline-flex; align-items: center;
  color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; font-size: inherit;
}
.banner .link-btn { margin-left: -6px; }
.small-btn { min-height: 44px; padding: 0 14px; font-size: 0.88rem; border-radius: 12px; }

/* ---------- état vide ---------- */
.empty { text-align: center; padding: 30px 22px; }
.empty h2 { font-size: 1.25rem; margin: 10px 0 8px; }
.empty p { margin: 0 0 10px; color: var(--muted); }

/* ---------- journal ---------- */
.journal { list-style: none; margin: 14px 0 0; padding: 0; }
.journal-day { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin: 18px 4px 8px; }
.entry {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; margin-bottom: 8px;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--accent-text); background: var(--accent-soft);
}
.entry-main { min-width: 0; }
.entry-title { font-weight: 600; }
.entry-sub { font-size: 0.82rem; color: var(--muted); }
.entry-msg { font-size: 0.84rem; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.badge { font-size: 0.74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); }
.badge.refused { background: var(--warn-soft); color: var(--warn-ink); }
.badge.error { background: var(--danger-soft); color: var(--danger); }
.badge.role { background: var(--surface-2); color: var(--muted); }
.badge.revoked { background: var(--danger-soft); color: var(--danger); }
.journal-empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* ---------- personnes ---------- */
.add-person { display: flex; flex-direction: column; gap: 10px; }
.add-person input, .add-person select {
  width: 100%; min-height: 50px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2);
  padding: 0 14px; font-size: 1rem;
}
.add-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.new-link { border: 1.5px solid var(--accent); }
.new-link .link-box {
  margin: 10px 0; padding: 12px; border-radius: 12px; background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; word-break: break-all; user-select: all;
}
.new-link .btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.new-link .warn-text { font-size: 0.84rem; color: var(--warn-ink); margin: 8px 0 0; }
.people { list-style: none; margin: 0; padding: 0; }
.person { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px; margin-bottom: 8px; }
.person.is-revoked { opacity: 0.6; }
.person-head { display: flex; align-items: center; gap: 12px; }
.person-head .entry-main { flex: 1; }
.person-name { font-weight: 650; }
.person-sub { font-size: 0.82rem; color: var(--muted); }
.person-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- barre d'onglets ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 12px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; max-width: 150px; min-height: 52px; border: 0; background: none; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 0.74rem; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--accent-text); }

/* ---------- feuille de confirmation ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(15, 8, 4, 0.45); animation: fade 0.2s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; margin: 0 auto; max-width: 520px;
  background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-strong);
  padding: 10px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  animation: slide-up 0.28s cubic-bezier(.2, .8, .2, 1);
}
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 14px; }
.sheet h2 { margin: 4px 0 8px; font-size: 1.3rem; letter-spacing: -0.01em; }
.sheet p { margin: 0 0 18px; color: var(--muted); }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 16px; right: 16px; margin: 0 auto; max-width: 448px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  padding: 14px 16px; border-radius: 16px; background: #2b1d15; color: #fff; box-shadow: var(--shadow-strong);
  font-size: 0.93rem; animation: slide-up-small 0.25s ease;
}
.toast.ok { background: #1f6b43; }
.toast.refused { background: #7a4f0a; }
.toast.error { background: #a32a1d; }
@keyframes slide-up-small { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- pages simples (accueil sans lien, messages) ---------- */
body.plain { display: flex; }
.plain-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; min-height: 100vh; min-height: 100dvh; }
.plain-card {
  width: 100%; max-width: 420px; text-align: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 28px; box-shadow: var(--shadow); padding: 34px 24px;
}
.plain-card h1 { font-family: var(--font-display); font-size: 1.8rem; letter-spacing: -0.02em; margin: 12px 0 10px; }
.plain-card .lead { color: var(--muted); }
.big-hint {
  font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--accent-text);
  margin: 22px 0 14px; padding: 16px; border-radius: 18px; background: var(--accent-soft);
}
.mini-flame { width: 56px; height: 75px; }
.mini-flame .mf1 { fill: #ff6a1f; }
.mini-flame .mf2 { fill: #ffa53a; }
.mini-flame .mf3 { fill: #ffe6a3; }
.mini-flame.dim .mf1, .mini-flame.dim .mf2, .mini-flame.dim .mf3 { fill: var(--surface-3); }
.session-gone { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg); }

@media (min-width: 560px) {
  .app { padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
