/* ArtesymHub — interface de la box, thème « clair et coloré » (0.11.0).
   Aucune ressource externe (fonctionnement hors ligne, CSP stricte) : police servie par la box. */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #F3F5FA;              /* fond de page */
  --card: #FFFFFF;            /* cartes, tuiles, menu */
  --sunken: #F6F8FC;          /* zones en retrait (cartes dans une carte, champs) */
  --ink: #16213A;
  --ink-soft: #5A6478;
  --line: #E3E7F0;
  --line-strong: #CBD2E0;
  --action: #1462C8;          /* bleu du logo ArtesymHub */
  --action-soft: #E8F0FC;
  --action-ink: #FFFFFF;
  --action-strong: #0E4A99;
  --brand-navy: #0B1B45;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --ok: #1E7A3C;
  --ok-dot: #2DA44E;
  --warn-bg: #FFF4D6;
  --warn-ink: #7A4B00;
  --warn-edge: #F2C14E;
  --switch-off: #D5DAE5;
  --shadow: 0 1px 2px rgba(22, 33, 58, .06), 0 1px 1px rgba(22, 33, 58, .03);
  --shadow-lift: 0 6px 20px rgba(22, 33, 58, .10);
  --tint: 13%;                /* force de la teinte de pièce sur une tuile allumée */
  --tint-ink: #000;           /* base pour foncer la couleur de pièce (texte lisible) */
  --room-keep: 48%;

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --r-card: 20px;
  --r-ctl: 12px;
  --r-pill: 999px;
  color-scheme: light;
}
:root[data-theme=light] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0D1424;
    --card: #162036;
    --sunken: #111A2D;
    --ink: #E8ECF5;
    --ink-soft: #A3AEC4;
    --line: #26324A;
    --line-strong: #3A4864;
    --action: #5AA2F5;
    --action-soft: #1A2D4F;
    --action-ink: #08182E;
    --action-strong: #8CC0FF;
    --danger: #F59A90;
    --danger-soft: #3A1E1E;
    --ok: #6FD08E;
    --ok-dot: #4ADE80;
    --warn-bg: #3A2C12;
    --warn-ink: #FFD58A;
    --warn-edge: #7A5A20;
    --switch-off: #3A4864;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lift: 0 6px 20px rgba(0, 0, 0, .35);
    --tint: 22%;
    --tint-ink: #fff;
    --room-keep: 55%;
    color-scheme: dark;
  }
}
/* thème forcé (sombre / immersif), choisi sur l’appareil */
:root:is([data-theme=dark],[data-theme=immersif]) {
    --bg: #0D1424;
    --card: #162036;
    --sunken: #111A2D;
    --ink: #E8ECF5;
    --ink-soft: #A3AEC4;
    --line: #26324A;
    --line-strong: #3A4864;
    --action: #5AA2F5;
    --action-soft: #1A2D4F;
    --action-ink: #08182E;
    --action-strong: #8CC0FF;
    --danger: #F59A90;
    --danger-soft: #3A1E1E;
    --ok: #6FD08E;
    --ok-dot: #4ADE80;
    --warn-bg: #3A2C12;
    --warn-ink: #FFD58A;
    --warn-edge: #7A5A20;
    --switch-off: #3A4864;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lift: 0 6px 20px rgba(0, 0, 0, .35);
    --tint: 22%;
    --tint-ink: #fff;
    --room-keep: 55%;
    color-scheme: dark;
  }

/* Couleurs des pièces (dans l'ordre des pièces) */
.room-0 { --room: #F08A24; }
.room-1 { --room: #2DA44E; }
.room-2 { --room: #8B5CF6; }
.room-3 { --room: #1462C8; }
.room-4 { --room: #0F9488; }
.room-5 { --room: #DB2777; }
.room-6 { --room: #CA8A04; }
.room-7 { --room: #64748B; }
.room-none { --room: #64748B; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .room-3 { --room: #5AA2F5; }
  :root:not([data-theme]) .room-7, :root:not([data-theme]) .room-none { --room: #94A3B8; }
}
/* thème forcé (sombre / immersif), choisi sur l’appareil */
:root:is([data-theme=dark],[data-theme=immersif]) .room-3 { --room: #5AA2F5; }
:root:is([data-theme=dark],[data-theme=immersif]) .room-7, :root:is([data-theme=dark],[data-theme=immersif]) .room-none { --room: #94A3B8; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font); font-weight: 800; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: 1.85rem; line-height: 1.2; }
h2 { font-size: 1.15rem; line-height: 1.3; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .75rem; max-width: 70ch; }
a { color: var(--action); }
a:hover { color: var(--action-strong); }
:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 20px; height: 20px; flex: none; display: block; }

/* ---------- Boutons et champs ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  appearance: none; border: 1px solid var(--action); background: var(--action); color: var(--action-ink);
  min-height: 42px; padding: .5rem 1.1rem; border-radius: var(--r-ctl); cursor: pointer; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; text-decoration: none;
}
.btn:hover { filter: brightness(1.07); color: var(--action-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.quiet { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.quiet:hover { border-color: var(--line-strong); filter: none; color: var(--ink); }
.btn.danger { background: var(--card); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.small { min-height: 34px; padding: .25rem .75rem; font-size: .85rem; border-radius: 10px; }

label.field { display: grid; gap: .35rem; font-size: .88rem; color: var(--ink-soft); font-weight: 600; }
input[type=text], input[type=search], input[type=time], input[type=password], input[type=number], input[type=email], input[type=tel], select, textarea {
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  min-height: 42px; padding: .55rem .8rem; color: var(--ink); width: 100%; font-weight: 500;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--action) 35%, transparent); outline-offset: 0; border-color: var(--action); }
textarea { font-family: var(--mono); font-size: .86rem; line-height: 1.45; }
.hint { font-size: .86rem; color: var(--ink-soft); }
.error-text { color: var(--danger); font-size: .9rem; font-weight: 600; }

/* ---------- Écrans d'accès (installation, connexion) ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.faceplate {
  width: min(440px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; padding: 0 0 1.75rem; box-shadow: var(--shadow-lift); overflow: hidden;
}
.faceplate .label-strip { padding: .9rem 1.75rem; }
.faceplate form, .faceplate .gate-body { display: grid; gap: 1rem; padding: 1.25rem 1.75rem 0; }
.faceplate .brand { font-size: 1.5rem; font-weight: 800; }

/* ---------- Marque ArtesymHub ---------- */
.brand-logo { display: block; line-height: 0; }
.brand-logo img { display: block; width: 100%; height: auto; }
.brand-large { width: min(300px, 100%); }
.brand-small { width: 100%; max-width: 178px; }
.gate-brand { display: grid; justify-items: center; gap: .7rem; padding: 1.8rem 1.75rem 1.2rem !important; text-align: center; }
.brand-icon { width: 64px; height: 64px; border-radius: 16px; }
.brand-tagline { font-size: .9rem; color: var(--ink-soft); font-weight: 600; }
.sidebar a.brand { display: block; padding: .25rem .5rem .5rem; border-radius: var(--r-ctl); }
.sidebar a.brand:focus-visible { outline: 2px solid var(--action); outline-offset: 3px; }

/* Titre de carte (ancienne bande d'étiquette) */
.label-strip { font-size: 1.02rem; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }

/* ---------- Coque de l'application ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--card); border-right: 1px solid var(--line); padding: 1.4rem 1rem 1.2rem;
  display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 0; height: 100vh; align-self: start; overflow-y: auto;
}
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a, .more-nav a {
  display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink-soft);
  padding: .62rem .75rem; border-radius: var(--r-ctl); font-weight: 600; font-size: .95rem; line-height: 1.25;
}
.sidebar nav a:hover, .more-nav a:hover { background: var(--sunken); color: var(--ink); }
.sidebar nav a[aria-current=page], .more-nav a[aria-current=page] { background: var(--action-soft); color: var(--action-strong); font-weight: 800; }
.emoji { width: 20px; text-align: center; flex: none; }
.live { font-size: .82rem; color: var(--ink-soft); display: flex; align-items: center; gap: .5rem; margin-top: auto; font-weight: 600; padding: 0 .75rem; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.live.on { color: var(--ok); }
.live.on::before { background: var(--ok-dot); }
.whoami { font-size: .82rem; color: var(--ink-soft); padding: 0 .75rem; }
.bottom-nav { display: none; }

main { padding: 1.9rem 2.2rem 4rem; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-head p { margin: .3rem 0 0; color: var(--ink-soft); font-size: .98rem; }

/* ---------- Tableau : tuiles ---------- */
.group { margin-bottom: 2rem; }
.group h2 { margin-bottom: .8rem; display: flex; align-items: center; gap: .55rem; }
.rail { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 14px; }
.module {
  position: relative; background: var(--card); border: 1px solid transparent; border-radius: var(--r-card);
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  transition: background-color .15s, box-shadow .15s;
}
.module.on { background: color-mix(in srgb, var(--room) var(--tint), var(--card)); }
.module.warn { background: var(--warn-bg); border-color: var(--warn-edge); }
.module.unavailable { opacity: .7; }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 44px; }
.tile-icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--room) 16%, var(--card)); color: color-mix(in srgb, var(--room) var(--room-keep), var(--tint-ink));
}
.tile-icon .ic { width: 22px; height: 22px; }
.module.on .tile-icon { background: var(--room); color: #fff; }
.module.warn .tile-icon { background: var(--warn-edge); color: #3A2400; }
.tile-text { min-width: 0; }
.tile-name { display: flex; align-items: center; gap: .3rem; font-weight: 700; font-size: .98rem; line-height: 1.3; }
.label-text { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.tile-name { align-items: flex-start; }
.tile-sub { margin: .15rem 0 0; color: var(--ink-soft); font-size: .84rem; line-height: 1.35; }
.module.on .tile-sub { color: color-mix(in srgb, var(--room) var(--room-keep), var(--tint-ink)); font-weight: 600; }
.module.warn .tile-sub { color: var(--warn-ink); font-weight: 600; }
.module .face { display: grid; gap: .45rem; }
.foot { font-size: .8rem; color: var(--ink-soft); }

/* Interrupteur (ancien levier) */
.lever {
  appearance: none; width: 54px; height: 32px; padding: 3px; position: relative; flex: none;
  background: var(--switch-off); border: 0; border-radius: var(--r-pill); cursor: pointer; transition: background-color .16s;
}
.lever::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .16s ease-out;
}
.lever[aria-checked=true] { background: var(--room, var(--action)); }
.lever[aria-checked=true]::after { transform: translateX(22px); }
.lever:disabled { cursor: not-allowed; opacity: .55; }
.lever.pending::after { opacity: .6; }
.switch-row { display: flex; align-items: center; gap: .9rem; }
.state-word { font-weight: 600; }

/* Consigne réglable */
.setpoint-row { display: flex; gap: 6px; width: 100%; }
.setpoint-row .setpoint { width: 100%; min-width: 0; }
.muted { color: var(--ink-soft); }
.mono { font-family: var(--mono); font-size: .84rem; white-space: pre-wrap; word-break: break-all; }
.link-btn { appearance: none; background: none; border: 0; padding: 0; color: var(--action); font: inherit; font-size: .82rem; cursor: pointer; text-decoration: underline; }

/* Afficheur de capteur */
.reading { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.reading.text { font-size: 1.15rem; font-weight: 700; }
.reading .unit { font-size: .95rem; font-weight: 600; color: var(--ink-soft); margin-left: .25rem; letter-spacing: 0; }
.age { font-size: .78rem; color: var(--ink-soft); }

.empty { border: 1.5px dashed var(--line-strong); border-radius: var(--r-card); padding: 1.6rem; max-width: 62ch; background: var(--card); }

/* Alertes en tête du tableau */
.alerts { display: flex; flex-wrap: wrap; gap: .5rem; margin: -.4rem 0 1.2rem; }
.alert-pill { margin: 0; display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .9rem; border-radius: var(--r-pill);
  background: var(--warn-bg); color: var(--warn-ink); font-weight: 700; font-size: .88rem; }
.alert-pill .ic { width: 17px; height: 17px; }

/* ---------- Formulaires longs ---------- */
fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.1rem; margin: 0; display: grid; gap: 1rem; }
legend { font-weight: 800; padding: 0 .4rem; }
label.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
label.check input { margin-top: .25rem; width: 1.1rem; height: 1.1rem; accent-color: var(--action); flex: none; }
.hint.block { display: block; }
details > summary { cursor: pointer; color: var(--action); font-weight: 700; }
details[open] > summary { margin-bottom: .75rem; }
.panel form { max-width: 820px; }

/* ---------- Cartes (panneaux) et tableaux ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); margin-bottom: 1.4rem; box-shadow: var(--shadow); }
.panel > .label-strip { padding: 1.1rem 1.3rem 0; }
.panel .body { padding: 1rem 1.3rem 1.3rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 700; color: var(--ink-soft); font-size: .8rem; text-transform: none; }
th, td { padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.tag { display: inline-block; padding: .12rem .6rem; border-radius: var(--r-pill); font-size: .78rem; font-weight: 700; }
.tag.ok { color: var(--ok); background: color-mix(in srgb, var(--ok-dot) 15%, var(--card)); }
.tag.warn { color: var(--danger); background: var(--danger-soft); }
.tag.neutral { color: var(--ink-soft); background: var(--sunken); }

.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.stack { display: grid; gap: 1rem; }
details.inline-form { margin-bottom: 1.4rem; }
details.inline-form summary { cursor: pointer; color: var(--action); font-weight: 700; }
details.inline-form form { margin-top: 1rem; max-width: 640px; }

.banner { padding: .8rem 1rem; border-radius: 14px; margin-bottom: 1rem; font-weight: 600; }
.banner.ok { color: var(--ok); background: color-mix(in srgb, var(--ok-dot) 13%, var(--card)); }
.banner.bad { color: var(--danger); background: var(--danger-soft); }

.toast {
  position: fixed; bottom: 16px; right: 16px; max-width: min(420px, calc(100vw - 32px)); z-index: 50;
  background: var(--ink); color: var(--bg); padding: .8rem 1.1rem; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.bad { background: var(--danger); color: #fff; }

/* ---------- Pièces, renommage ---------- */
.edit-btn {
  appearance: none; border: 0; background: none; color: var(--ink-soft); cursor: pointer; flex: none;
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; padding: 0;
}
.edit-btn .ic { width: 16px; height: 16px; }
.edit-btn:hover, .edit-btn:focus-visible { color: var(--action); background: var(--sunken); }

.area-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: -.2rem 0 1.5rem; }
.chip {
  appearance: none; font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; min-height: 40px;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .35rem .95rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 700; }
.chip-count { font-size: .78rem; opacity: .7; font-weight: 600; }
.room-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--room); flex: none; display: inline-block; }
h2 .room-dot { width: 12px; height: 12px; }

.group.area > h2 { flex-wrap: wrap; gap: .25rem .55rem; }
.group.area > h2 .count { font-size: .85rem; font-weight: 500; color: var(--ink-soft); letter-spacing: 0; }
.group.area.loose .group { margin: .75rem 0 1.25rem; }
.group.area.loose h3 { font-size: .95rem; color: var(--ink-soft); margin-bottom: .6rem; }

.dialog {
  border: 1px solid var(--line); border-radius: 22px; padding: 0; box-shadow: var(--shadow-lift);
  background: var(--card); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
}
.dialog::backdrop { background: rgba(13, 20, 36, .45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem .4rem; }
.dialog-head h2 { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-body { padding: .8rem 1.2rem 1.2rem; display: grid; gap: 1rem; }
.dialog-form { display: grid; gap: 1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.icon-btn {
  appearance: none; border: 1px solid transparent; background: none; color: var(--ink-soft); cursor: pointer;
  font-size: 1rem; line-height: 1; min-width: 36px; min-height: 36px; padding: .3rem .5rem; border-radius: 10px;
}
.icon-btn:hover:not(:disabled) { border-color: var(--line); color: var(--ink); background: var(--sunken); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.area-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.area-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.area-row input[type=text] { flex: 1 1 10rem; min-width: 0; }
.area-row select { flex: 0 1 11rem; min-width: 0; }
.area-row.add { padding-top: .8rem; border-top: 1px dashed var(--line-strong); }
.dialog.wide { width: min(720px, calc(100vw - 32px)); }
.area-row .hint { min-width: 4.5rem; }

/* ---------- Mon compte, réseau ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; }
.facts dt { color: var(--ink-soft); font-weight: 600; }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.notice { border: 0; border-radius: 16px; padding: .85rem 1.1rem; background: var(--action-soft); display: grid; gap: .5rem; }
.notice p { margin: 0; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.warn a { color: inherit; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem 1rem; }
.choice { border: 0; padding: 0; margin: 0; display: grid; gap: .45rem; }
.choice legend { font-weight: 700; margin-bottom: .3rem; padding: 0; }
.choice label { display: flex; gap: .5rem; align-items: baseline; cursor: pointer; }
.cmd-box { margin: 0; padding: .8rem 1rem; background: var(--brand-navy); color: #E8ECF5; border-radius: 14px; overflow-x: auto; white-space: pre; }
.cmd-box code { color: inherit; }

.subtabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.2rem 0 1.3rem; }
.subtab { padding: .5rem 1rem; min-height: 40px; display: inline-flex; align-items: center; color: var(--ink); text-decoration: none;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: .92rem; }
.subtab:hover { border-color: var(--line-strong); color: var(--ink); }
.subtab.active { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 700; }
.subtab:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
.subtabs.minor { margin: .2rem 0 1rem; gap: .3rem; }
.subtabs.minor .subtab { min-height: 36px; padding: .35rem .85rem; font-size: .86rem; background: transparent; }
.subtabs.minor .subtab.active { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.subtab-body > .page-head h2, .subtab-body .subtab-body > .page-head h2 { margin: 0; font-size: 1.35rem; }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: .35rem; margin-left: auto; }
.link-choice label { padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.link-choice label:has(input:checked) { border-color: var(--action); box-shadow: inset 0 0 0 1px var(--action); }

/* ---------- Menu personnalisé ---------- */
.nav-links { display: grid; gap: 2px; margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.nav-edit { appearance: none; border: 0; background: none; color: var(--ink-soft); font: inherit; font-size: .84rem;
  text-align: left; padding: .5rem .75rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.nav-edit:hover { color: var(--action); }
.menu-item { display: inline-flex; align-items: center; gap: .45rem; flex: 1 1 12rem; min-width: 0; cursor: pointer; }
.icon-input { flex: 0 0 3.4rem !important; text-align: center; }
.more-nav { display: grid; gap: 2px; }

/* ---------- Tableau personnalisé ---------- */
.edit-bar { display: flex; flex-wrap: wrap; gap: .2rem; justify-content: center; padding-top: .55rem; border-top: 1px dashed var(--line-strong); }
.edit-bar .icon-btn { font-size: .85rem; }
.edit-bar .icon-btn.active { color: #C58A00; }
.module.is-hidden { opacity: .45; }
main.compact .rail { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
main.compact .module { padding: 12px; gap: 8px; }
main.compact .tile-icon { width: 36px; height: 36px; border-radius: 11px; }
main.compact .module .age, main.compact .tile-sub { font-size: .78rem; }

/* ---------- Assistant d'automatisation ---------- */
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .8rem; margin-bottom: 1.3rem; }
.template { appearance: none; text-align: left; font: inherit; color: var(--ink); background: var(--card); cursor: pointer;
  border: 1px solid var(--line); border-radius: 16px; padding: .9rem 1rem; display: grid; gap: .3rem; box-shadow: var(--shadow); }
.template:hover, .template:focus-visible { border-color: var(--action); }
.template-icon { font-size: 1.4rem; }
.assistant .step { border: 1px solid var(--line); border-radius: 16px; padding: .8rem 1.1rem 1.1rem; margin: 0; display: grid; gap: .75rem; }
.assistant .step legend { font-weight: 800; padding: 0 .3rem; }
.days { display: flex; gap: .35rem; flex-wrap: wrap; }
.day { appearance: none; font: inherit; font-weight: 700; width: 2.6rem; height: 2.6rem; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.day[aria-pressed=true] { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.actions-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.action-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; }
.action-row > select { flex: 0 1 12rem; min-width: 0; }
.action-row > .field { flex: 1 1 12rem; min-width: 0; }
.step-no { width: 1.7rem; height: 1.7rem; border-radius: 50%; display: inline-grid; place-items: center; font-size: .8rem; font-weight: 800;
  background: var(--action-soft); color: var(--action-strong); align-self: center; }
.sentence { margin: 0; display: inline; }

/* ---------- Matter ---------- */
.expose-list { list-style: none; margin: 0; display: grid; gap: .35rem; max-height: 22rem; overflow: auto;
  border: 1px solid var(--line); border-radius: 14px; padding: .55rem .8rem; }
.expose-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; justify-content: space-between; }
.expose-row select { width: auto; flex: 0 0 auto; }
.pairing { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.qr { width: 200px; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.pairing .stack { flex: 1 1 18rem; min-width: 0; }
.big { font-size: 1.3rem; letter-spacing: .04em; font-weight: 800; }
.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }

[hidden] { display: none !important; }

/* ---------- Accès à distance ---------- */
.vpn-device { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border: 1px solid var(--line);
  border-radius: 14px; background: var(--sunken); }
.vpn-device-main { display: grid; gap: .1rem; flex: 1 1 auto; min-width: 0; }
.vpn-device-main .hint { overflow-wrap: anywhere; }
.vpn-device .dot { width: .7rem; height: .7rem; border-radius: 50%; flex: 0 0 auto; background: var(--line-strong); }
.vpn-device .dot.on { background: var(--ok-dot); }
.vpn-new { display: grid; gap: .7rem; }
.vpn-qr { width: min(280px, 100%); background: #fff; padding: .5rem; border-radius: 14px; border: 1px solid var(--line); }
.vpn-qr svg { display: block; width: 100%; height: auto; }
.add-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.add-row input { flex: 1 1 14rem; min-width: 0; }
.ok-text { color: var(--ok); font-weight: 700; }

/* ---------- Wi-Fi ---------- */
.wifi-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.wifi-card { border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem; background: var(--sunken); min-width: 0; }
.wifi-card h3 { margin: 0; }
.wifi-card select { width: 100%; min-width: 0; }
.plain-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .3rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.scan-list .chip { font-size: .86rem; }
.wifi-join { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 1rem; }
.wifi-join > .stack { flex: 1 1 16rem; min-width: 0; }
.small-qr { width: 150px; }
.secret { overflow-wrap: anywhere; }
td .dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--line-strong); vertical-align: middle; }
td .dot.on { background: var(--ok-dot); }
td input[type=text] { max-width: 11rem; }
.wifi-advanced { border: 1px solid var(--line); border-radius: 14px; padding: .6rem .9rem; background: var(--card); }
.wifi-advanced > summary { padding: .2rem 0; }
.access-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.access-cell .port-in { width: 6.5em; }
.check.inline { display: inline-flex; gap: 4px; align-items: center; margin: 0; }

/* ---------- Téléphone ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; justify-content: space-between;
    gap: .75rem; padding: .7rem 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible;
  }
  .sidebar .side-nav, .whoami { display: none; }
  .sidebar a.brand { width: 150px; padding: 0; }
  .live { margin: 0; padding: 0; }
  main { padding: 1.2rem 16px 6.5rem; }
  h1 { font-size: 1.55rem; }
  .rail { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .module { padding: 13px; gap: 10px; border-radius: 18px; }
  .tile-icon { width: 40px; height: 40px; border-radius: 13px; }
  .lever { width: 48px; height: 28px; }
  .lever::after { width: 22px; height: 22px; }
  .lever[aria-checked=true]::after { transform: translateX(20px); }
  .reading { font-size: 1.6rem; }
  .area-chips, .subtabs { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; scrollbar-width: none; }
  .chip, .subtab { flex: 0 0 auto; white-space: nowrap; }
  th, td { padding: .5rem .6rem; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line); padding: 6px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav a, .bottom-nav .more-btn {
    appearance: none; border: 0; background: none; font: inherit; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; padding: 4px 2px;
    color: var(--ink-soft); font-size: .68rem; font-weight: 600; text-decoration: none; border-radius: 12px; min-width: 0;
  }
  .bottom-nav a span, .bottom-nav .more-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav .ic { width: 22px; height: 22px; }
  .bottom-nav a[aria-current=page] { color: var(--action); font-weight: 800; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 380px) {
  .rail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dt { font-size: .85rem; margin-top: .45rem; }
  .facts dd { overflow-wrap: break-word; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
.data td.mono { white-space: nowrap; }

/* Réseau des équipements : carte des adresses .1 à .254 */
.ip-grid { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 3px; max-width: 760px; }
.ip-cell { min-width: 0; min-height: 30px; padding: 0; border-radius: 6px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-soft); font: 600 .72rem/1 var(--mono); cursor: pointer; }
.ip-cell:hover { border-color: var(--action); }
.ip-cell:focus-visible { outline: 3px solid var(--action); outline-offset: 1px; }
.ip-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line);
  vertical-align: -2px; margin-right: .4rem; }
.ip-box { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
.ip-fixed-on { background: var(--ok-dot); border-color: var(--ok); color: #fff; }
.ip-fixed-off { background: var(--card); border: 2px solid var(--ok-dot); color: var(--ok); }
.ip-unknown { background: var(--warn-edge); border-color: var(--warn-ink); color: #2b1d00; }
.ip-welcome { background: var(--action); border-color: var(--action-strong); color: var(--action-ink); }
.ip-pool { background: var(--sunken); border-style: dashed; }
.ip-free { background: var(--card); }
.ip-legend { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem;
  font-size: .85rem; color: var(--ink-soft); }
.ip-detail { border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--sunken); padding: .7rem .9rem; }
.ip-detail p { margin: .2rem 0; }
@media (max-width: 640px) {
  .ip-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .ip-cell { min-height: 34px; }
}
.data td .mono { white-space: nowrap; }

/* Certificat de la box */
.cert-help { margin-top: .4rem; font-size: .9rem; }
.cert-help summary { cursor: pointer; color: var(--action); }
.cert-help-body { margin-top: .5rem; }
.cert-os summary { cursor: pointer; font-weight: 600; }
.cert-os ol { margin: .4rem 0 .2rem; padding-left: 1.3rem; }
.cert-os li { margin: .2rem 0; }
.fingerprint { word-break: break-all; font-size: .8rem; margin: 0; }

/* Nettoyage */
.clean-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.clean-list > li { display: flex; flex-direction: column; gap: .1rem; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--card); min-width: 0; }
.clean-list > li.clean-head { background: transparent; border-style: dashed; }
.clean-main { font-weight: 600; overflow-wrap: anywhere; }
.clean-detail { padding-left: 1.7rem; font-size: .82rem; overflow-wrap: anywhere; }

/* Pièces : ajout et modification depuis le tableau */
.chip-add { border-style: dashed; color: var(--action); }
.room-edit { margin-left: auto; }
.room-pick { max-height: 46vh; overflow-y: auto; }

.cmd-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cmd-row .btn { flex: 1 1 auto; }

/* ---------- 0.17 : carte « Maison », présence, alertes ---------- */
.home-card { display: grid; gap: 10px; margin: 0 0 18px; padding: 14px 16px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); }
.home-card:empty { display: none; }
.home-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.home-people { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.home-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; margin-right: 4px; }
.home-title svg { width: 20px; height: 20px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--sunken); border: 1px solid var(--line); font-weight: 600; font-size: .9rem; }
.person-state { font-weight: 400; color: var(--ink-soft); }
.person-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--switch-off); }
.person-chip.home .person-dot { background: var(--ok-dot); }
.person-chip.home { border-color: color-mix(in srgb, var(--ok-dot) 45%, var(--line)); }
.notice-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r-ctl);
  background: var(--action-soft); border: 1px solid var(--line); }
.notice-item.warning { background: var(--warn-bg); border-color: var(--warn-edge); color: var(--warn-ink); }
.notice-item p { margin: 2px 0 4px; }
.notice-text { flex: 1 1 auto; min-width: 0; }
.notice-icon svg { width: 20px; height: 20px; }
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: var(--r-pill); background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-form input[type=text], .row-form select { flex: 1 1 180px; min-width: 0; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.field.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.num-unit { display: inline-flex; align-items: center; gap: 6px; }
.num-unit input { width: 5.5em; }
details.help { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 8px 12px; background: var(--sunken); }
details.help summary { cursor: pointer; font-weight: 600; }
details.help[open] summary { margin-bottom: 8px; }
.people-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.people-list > li { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--card); }
.person-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.person-head select { flex: 0 1 220px; min-width: 0; }
.phone-list { margin: 0; padding-left: 18px; color: var(--ink-soft); }
.phone-list li { overflow-wrap: anywhere; }

/* ---------- 0.18 : sécurité incendie ---------- */
.fire-bar { position: sticky; top: 0; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 10px max(16px, env(safe-area-inset-left, 0px)); background: #B42318; color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25); animation: fire-pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .fire-bar { animation: none; } }
@keyframes fire-pulse { 50% { filter: brightness(1.15); } }
.fire-bar-icon svg { width: 26px; height: 26px; }
.fire-bar-text { display: grid; flex: 1 1 260px; min-width: 0; }
.fire-bar-text strong { font-size: 1.05rem; letter-spacing: .02em; }
.fire-bar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fire-bar .btn { background: #fff; color: #B42318; border-color: #fff; }
.fire-bar .btn.quiet { background: transparent; color: #fff; }
.fire-status { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; padding: 16px; border-radius: var(--r-card);
  border: 1px solid var(--line); background: var(--sunken); }
.fire-status .stack { flex: 1 1 260px; min-width: 0; }
.fire-status-icon svg { width: 36px; height: 36px; }
.fire-status-title { font-size: 1.3rem; }
.fire-status.ok .fire-status-icon { color: var(--ok-dot); }
.fire-status.warn { background: var(--warn-bg); border-color: var(--warn-edge); color: var(--warn-ink); }
.fire-status.alarm { background: #B42318; border-color: #B42318; color: #fff; }
.fire-status.alarm .hint { color: rgba(255, 255, 255, .85); }
.fault-list, .det-list, .step-list, .fire-journal { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fault-list li { display: flex; gap: 8px; align-items: center; }
.fault-list li.fault { color: var(--danger); font-weight: 600; }
.fault-list svg { width: 18px; height: 18px; flex: none; }
.det-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--card); }
.det-main { min-width: 0; overflow-wrap: anywhere; }
.det-meta { grid-column: 1 / -1; }
.det-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.det-state { align-self: start; padding: 2px 10px; border-radius: var(--r-pill); font-size: .82rem; font-weight: 700; background: var(--sunken); }
.det-state.ok { color: var(--ok-dot); }
.det-state.warn { background: var(--warn-bg); color: var(--warn-ink); }
.det-state.alarm { background: #B42318; color: #fff; }
.fire-prog { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-card); }
.fire-prog h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
.fire-prog h3 svg { width: 20px; height: 20px; }
.fire-order { margin: 0; padding-left: 20px; }
.step-editor h4 { margin: 0; }
.step-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 6px 10px;
  background: var(--sunken); border-radius: var(--r-ctl); overflow-wrap: anywhere; }
.step-list li.hint { background: none; padding: 0; }
.row-form select[hidden] { display: none; }
.fire-journal li { padding: 4px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.fire-journal li.alarm { color: var(--danger); font-weight: 700; }
.fire-journal li.warning { color: var(--warn-ink); }

/* ---------- 0.18.1 : choix de l'icône d'un équipement ---------- */
.icon-picker { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 10px 12px; margin: 0; min-width: 0; }
.icon-picker legend { padding: 0 4px; font-weight: 600; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; max-height: 38vh; overflow-y: auto; }
.icon-opt { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: var(--r-ctl); cursor: pointer; background: var(--card); min-width: 0; }
.icon-opt input { position: absolute; opacity: 0; pointer-events: none; }
.icon-opt:has(input:checked) { border-color: var(--action); background: var(--action-soft); box-shadow: 0 0 0 1px var(--action); }
.icon-opt:has(input:focus-visible) { outline: 2px solid var(--action); outline-offset: 2px; }
.icon-swatch svg { width: 22px; height: 22px; display: block; }
.icon-label { font-size: .82rem; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; min-width: 0; }
.icon-opt:first-child { grid-column: 1 / -1; }

/* ArtesymHub Connect : code QR de l'adresse et étapes côte à côte */
.connect-phone { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; }
.connect-phone .vpn-qr { flex: 0 0 auto; }
.connect-phone ol { flex: 1 1 16rem; min-width: 0; margin: 0; padding-left: 1.25rem; }
.connect-phone li + li { margin-top: .4rem; }

/* ---------- Plan de la maison (2.0.0) ---------- */
.plan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.plan-stage { position: relative; background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 12px; }
.plan-svg { display: block; width: 100%; height: auto; max-height: calc(100vh - 230px); touch-action: manipulation; user-select: none;
  font-family: var(--font); }
.plan-svg.zoomed { cursor: grab; touch-action: none; }
.plan-svg.editing { touch-action: none; cursor: default; }
.plan-svg.editing.tool-rect, .plan-svg.editing.tool-poly { cursor: crosshair; }
.plan-ground { fill: var(--sunken); }
.plan-ground.outdoor { fill: color-mix(in srgb, #2DA44E 8%, var(--sunken)); }
.plan-bg { opacity: .35; pointer-events: none; }
.plan-bg.editing { opacity: .7; }
.plan-grid { pointer-events: none; }
.grid-line { fill: none; stroke: var(--line); vector-effect: non-scaling-stroke; stroke-width: 1px; }
.grid-line.strong { stroke: var(--line-strong); stroke-width: 1px; }
.grass-bg { fill: color-mix(in srgb, #2DA44E 18%, var(--card)); }
.grass-blade { stroke: color-mix(in srgb, #2DA44E 34%, var(--card)); stroke-linecap: round; fill: none; }

.plan-room { cursor: pointer; outline: none; }
.plan-room .room-fill { fill: color-mix(in srgb, var(--room) 9%, var(--card)); transition: fill .2s; }
.plan-svg.has-bg .plan-room .room-fill { fill-opacity: .6; }
.plan-room.garden .room-fill { fill: url(#plan-grass); }
.plan-room.paved .room-fill { fill: color-mix(in srgb, #B08D57 14%, var(--card)); }
.plan-room.paved:hover .room-fill { fill: color-mix(in srgb, #B08D57 22%, var(--card)); }
.plan-room .room-light { pointer-events: none; transition: opacity .35s ease; mix-blend-mode: multiply; }
.plan-svg polygon, .plan-svg circle, .plan-svg rect, .plan-svg polyline { vector-effect: non-scaling-stroke; }
.plan-room .room-edge { fill: none; stroke: color-mix(in srgb, var(--room) 70%, var(--ink)); stroke-linejoin: round; stroke-width: 2px; }
.plan-room:hover .room-fill, .plan-room:focus-visible .room-fill { fill: color-mix(in srgb, var(--room) 18%, var(--card)); }
.plan-room.garden:hover .room-fill { fill: url(#plan-grass); filter: brightness(1.05); }
.plan-room.selected .room-edge { stroke: var(--room); stroke-width: 4px; }
.plan-room.selected .room-fill { fill: color-mix(in srgb, var(--room) 20%, var(--card)); }
.plan-room .room-name { fill: var(--ink); font-weight: 800; pointer-events: none; letter-spacing: -.01em; }
.plan-room .room-info { fill: var(--ink-soft); font-weight: 700; pointer-events: none; }
.plan-room.lit .room-info { fill: color-mix(in srgb, #8A5A00 85%, var(--ink)); }
.plan-room .room-name, .plan-room .room-info { paint-order: stroke; stroke: color-mix(in srgb, var(--card) 75%, transparent);
  stroke-width: 3px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.plan-room.alert .room-edge { stroke: var(--danger); animation: plan-alert 1s ease-in-out infinite; }
.plan-room.alert .room-fill { fill: color-mix(in srgb, var(--danger) 20%, var(--card)); }
@keyframes plan-alert { 50% { stroke-opacity: .25; } }

.plan-dev { cursor: pointer; outline: none; }
.plan-dev .plan-dev-dot { fill: var(--card); stroke: color-mix(in srgb, var(--room) 60%, var(--ink-soft)); stroke-width: 1.5px; transition: fill .2s;
  filter: drop-shadow(0 1px 1.5px rgba(22, 33, 58, .25)); }
.plan-dev .plan-ic { color: color-mix(in srgb, var(--room) 60%, var(--ink)); pointer-events: none; }
.plan-dev.on .plan-dev-dot { fill: var(--room); stroke: var(--room); }
.plan-dev.on .plan-ic { color: #fff; }
.plan-dev.light.on .plan-dev-dot { fill: #FFC93C; stroke: #E0A100; }
.plan-dev.water.on .plan-dev-dot { fill: #1E88E5; stroke: #1565C0; }
.plan-dev.water.on .plan-ic { color: #fff; }
.plan-dev.light.on .plan-ic { color: #5A3B00; }
.plan-dev .plan-halo { pointer-events: none; }
.plan-dev.alert .plan-dev-dot { fill: var(--danger); stroke: var(--danger); animation: plan-alert 1s infinite; }
.plan-dev.alert .plan-ic { color: #fff; }
.plan-dev.unavailable { opacity: .45; }
.plan-dev.missing .plan-dev-dot { fill: var(--danger-soft); stroke: var(--danger); stroke-dasharray: 2 2; }
.plan-dev.missing text { fill: var(--danger); font-weight: 800; }
.plan-dev.selected .plan-dev-dot, .plan-dev:focus-visible .plan-dev-dot { stroke: var(--action); stroke-width: 3px; }
.plan-dev:hover .plan-dev-dot { stroke-width: 2.5px; }
.plan-dev.pending { opacity: .6; }
.plan-badge rect { fill: var(--ink); opacity: .85; }
.plan-badge text { fill: var(--bg); font-weight: 700; font-variant-numeric: tabular-nums; }

.plan-vertex { fill: var(--card); stroke: var(--action); stroke-width: 2.5px; cursor: move; }
.plan-vertex.first { fill: var(--action); }
.plan-draft { fill: color-mix(in srgb, var(--action) 12%, transparent); stroke: var(--action); stroke-width: 2px; stroke-dasharray: 8 5; pointer-events: none; }
polyline.plan-draft { fill: none; }
.plan-draft-text { fill: var(--action-strong); font-weight: 800; pointer-events: none; }
.plan-svg.editing .plan-room { cursor: move; }
.plan-svg.editing .plan-dev { cursor: grab; }
.plan-svg.editing.tool-rect .plan-room, .plan-svg.editing.tool-poly .plan-room,
.plan-svg.editing.tool-rect .plan-dev, .plan-svg.editing.tool-poly .plan-dev { pointer-events: none; }

.plan-zoom { position: absolute; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow-lift); padding: 4px; }
.plan-zoom .icon-btn { font-size: 1.1rem; font-weight: 700; }

.plan-panel { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px;
  max-height: calc(100vh - 150px); overflow-y: auto; position: sticky; top: 16px; }
.plan-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.plan-panel-head h2 { margin: 0; display: flex; align-items: center; gap: .5rem; font-size: 1.15rem; }
.plan-panel .hint { margin: 0; }
.plan-panel h3 { margin: .4rem 0 0; font-size: .95rem; }
.plan-tiles { display: grid; gap: 10px; }
.plan-tile { display: grid; gap: 6px; }
.plan-tile .module, .plan-panel > .module { box-shadow: none; border-color: var(--line); }
.plan-tile:has(.stepper) .setpoint-row, .plan-tile:has(.stepper) .face .age, .plan-panel:has(> .stepper) .setpoint-row { display: none; }
.plan-ctl { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .6rem; font-size: .85rem; font-weight: 600;
  color: var(--ink-soft); padding: 0 .4rem; }
.plan-ctl.stepper { grid-template-columns: 1fr auto auto auto; }
.plan-ctl.stepper strong { color: var(--ink); font-size: 1.1rem; min-width: 4.5ch; text-align: center; font-variant-numeric: tabular-nums; }
.plan-range { width: 100%; accent-color: var(--action); }
.plan-ctl output { font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; }
.plan-rooms-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.plan-room-row { appearance: none; width: 100%; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer;
  display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border-radius: 10px; text-align: left; }
.plan-room-row:hover { background: var(--sunken); }
.plan-room-row .clean-main { flex: 1; font-weight: 600; }
.plan-fire { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-radius: 14px; margin-bottom: 1rem;
  background: var(--danger); color: #fff; font-weight: 800; text-decoration: none; animation: plan-alert 1.2s infinite; }
.plan-fire .ic { width: 22px; height: 22px; }
.plan-levels { margin-bottom: 1rem; }
.plan-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.plan-snap { margin-left: auto; font-size: .88rem; }
.plan-area-pick { display: flex; flex-wrap: wrap; gap: .5rem; }
.plan-todo { display: grid; gap: .6rem; }
.plan-todo-area { margin: 0; font-size: .8rem; font-weight: 700; color: var(--ink-soft); display: flex; align-items: center; gap: .4rem; }
.plan-todo-list { list-style: none; margin: .25rem 0 0; padding: 0; display: grid; gap: 3px; }
.plan-todo-item { appearance: none; width: 100%; border: 1px solid var(--line); background: var(--card); font: inherit; font-size: .88rem;
  color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border-radius: 10px; text-align: left; }
.plan-todo-item .ic { width: 16px; height: 16px; flex: none; color: var(--ink-soft); }
.plan-todo-item:hover { border-color: var(--line-strong); }
.plan-todo-item.active { border-color: var(--action); background: var(--action-soft); font-weight: 700; }
.plan-empty .actions { margin-top: 1rem; }

@media (max-width: 1100px) {
  .plan-layout { grid-template-columns: minmax(0, 1fr); }
  .plan-panel { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .plan-stage { padding: 6px; border-radius: 16px; }
  .plan-svg { max-height: 62vh; }
  .plan-snap { margin-left: 0; }
  .plan-zoom { position: static; flex-direction: row; justify-content: flex-end; box-shadow: none; background: none; padding: 6px 0 0; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .plan-room .room-light { mix-blend-mode: screen; }
  :root:not([data-theme]) .plan-room.lit .room-info { fill: #FFE9A8; }
  :root:not([data-theme]) .plan-room.lit .room-name, :root:not([data-theme]) .plan-room.lit .room-info { stroke: rgba(13, 20, 36, .8); }
  :root:not([data-theme]) .plan-dev .plan-dev-dot { filter: none; }
}
/* thème forcé (sombre / immersif), choisi sur l’appareil */
:root:is([data-theme=dark],[data-theme=immersif]) .plan-room .room-light { mix-blend-mode: screen; }
:root:is([data-theme=dark],[data-theme=immersif]) .plan-room.lit .room-info { fill: #FFE9A8; }
:root:is([data-theme=dark],[data-theme=immersif]) .plan-room.lit .room-name, :root:is([data-theme=dark],[data-theme=immersif]) .plan-room.lit .room-info { stroke: rgba(13, 20, 36, .8); }
:root:is([data-theme=dark],[data-theme=immersif]) .plan-dev .plan-dev-dot { filter: none; }
@media (prefers-reduced-motion: reduce) {
  .plan-room.alert .room-edge, .plan-dev.alert .plan-dev-dot, .plan-fire { animation: none; }
}

/* ---------- Thème « immersif » (2.1.0) : nuit bleutée, cartes translucides ---------- */
:root[data-theme=immersif] {
  --bg: #0A0F22;
  --card: rgba(26, 33, 62, .66);
  --sunken: rgba(14, 20, 42, .55);
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 8px 24px rgba(0, 0, 0, .25);
}
:root[data-theme=immersif] body {
  background:
    radial-gradient(1100px 700px at 82% 12%, rgba(168, 38, 92, .32), transparent 62%),
    radial-gradient(900px 640px at 8% 92%, rgba(28, 86, 196, .28), transparent 60%),
    linear-gradient(160deg, #090E20 0%, #111634 52%, #1A0F2E 100%);
  background-attachment: fixed;
}
:root[data-theme=immersif] .sidebar, :root[data-theme=immersif] .bottom-nav { background: rgba(9, 13, 30, .72); backdrop-filter: blur(14px); }
:root[data-theme=immersif] .module, :root[data-theme=immersif] .panel, :root[data-theme=immersif] .plan-stage,
:root[data-theme=immersif] .plan-panel, :root[data-theme=immersif] .home-card { backdrop-filter: blur(10px); border-color: var(--line); }
:root[data-theme=immersif] .dialog { background: #161D38; }
.theme-select { min-height: 36px; width: auto; max-width: 12rem; padding-top: .3rem; padding-bottom: .3rem; font-size: .88rem; }

/* ---------- Page « Maison » (2.1.0) : bandeau, pièces, plan, rangées de commandes ---------- */
.home-top { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1rem; }
.home-top > .actions { flex-wrap: nowrap; }
.home-tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.home-tab { appearance: none; border: 0; background: none; font: inherit; font-weight: 700; color: var(--ink-soft); cursor: pointer;
  padding: .55rem .9rem; border-radius: 10px; position: relative; min-height: 40px; }
.home-tab:hover { color: var(--ink); background: var(--sunken); }
.home-tab[aria-pressed=true] { color: var(--ink); }
.home-tab[aria-pressed=true]::after { content: ""; position: absolute; left: .9rem; right: .9rem; bottom: 2px; height: 3px; border-radius: 3px; background: var(--action); }
.home-pills { display: flex; flex-wrap: wrap; gap: .45rem; margin-left: auto; }
.home-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: var(--r-pill); background: var(--card);
  border: 1px solid var(--line); font-weight: 700; font-size: .86rem; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); white-space: nowrap; }
.home-pill .ic { width: 16px; height: 16px; color: #F2B33D; }

.home-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.home-grid.no-rooms { grid-template-columns: minmax(0, 1fr); }
.home-rooms { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; max-height: calc(100vh - 200px); overflow-y: auto; padding-right: 2px; }
.home-hello { grid-column: 1 / -1; margin: 0 0 .25rem; font-size: 1.35rem; font-weight: 800; }
.home-hello span { font-size: .95rem; font-weight: 600; color: var(--ink-soft); }
.home-room { appearance: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; display: flex; align-items: center; gap: .6rem;
  padding: .6rem .65rem; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.home-room:hover { border-color: var(--line-strong); }
.home-room-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 1.15rem;
  background: color-mix(in srgb, var(--room) 18%, transparent); }
.home-room.lit .home-room-icon { background: #F2B33D; box-shadow: 0 0 14px rgba(242, 179, 61, .55); }
.home-room.alert { border-color: var(--danger); animation: plan-alert 1s infinite; }
.home-room.selected { border-color: var(--room); box-shadow: 0 0 0 2px color-mix(in srgb, var(--room) 45%, transparent); }
.home-room-text { display: grid; min-width: 0; }
.home-room-name { font-weight: 700; font-size: .9rem; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.home-room-sub { font-size: .76rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }

.plan-stage { min-height: 320px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.plan-stage .plan-svg { max-height: calc(100vh - 220px); }
.plan-panel.floating { position: absolute; top: 12px; right: 12px; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 24px);
  overflow-y: auto; z-index: 3; box-shadow: var(--shadow-lift); border: 1px solid var(--line); }
.plan-panel.floating[hidden] { display: none; }

.home-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 12px; }
.home-row.covers { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.home-chip { appearance: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; display: flex; align-items: center; gap: .6rem;
  padding: .55rem .7rem; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.home-chip:disabled { cursor: default; opacity: .6; }
.home-chip-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--sunken); color: var(--ink-soft); }
.home-chip-icon .ic { width: 18px; height: 18px; }
.home-chip.on .home-chip-icon { background: #F2B33D; color: #3A2400; box-shadow: 0 0 14px rgba(242, 179, 61, .5); }
.home-chip-text { display: grid; min-width: 0; }
.home-chip-name { font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-chip-sub { font-size: .76rem; color: var(--ink-soft); }
.home-cover { display: grid; grid-template-columns: 1fr auto; gap: .5rem .6rem; align-items: center; padding: .6rem .7rem; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.home-cover-head { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.home-cover.open .home-chip-icon { background: color-mix(in srgb, var(--action) 22%, transparent); color: var(--action); }
.home-cover-ctl { display: flex; gap: 4px; }
.home-cover-ctl .icon-btn { border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; }
.home-bar { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--sunken); overflow: hidden; }
.home-bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--action), #8B5CF6); border-radius: 6px; transition: width .4s; }

/* Rendu photo : image réaliste, voile de nuit, halos de lampes, repères ronds blancs */
.plan-bg.photo { opacity: 1; }
.plan-bg.photo.editing { opacity: .9; }
.plan-night { fill: #050A1A; pointer-events: none; transition: opacity .3s; }
.plan-warm { mix-blend-mode: screen; pointer-events: none; }
.plan-layer { mix-blend-mode: lighten; pointer-events: none; transition: opacity .35s; }
.plan-room.zone .room-fill { fill: transparent; }
.plan-room.zone .room-edge { stroke: transparent; }
.plan-room.zone:hover .room-fill, .plan-room.zone:focus-visible .room-fill { fill: rgba(255, 255, 255, .08); }
.plan-room.zone:hover .room-edge { stroke: rgba(255, 255, 255, .5); }
.plan-room.zone.selected .room-fill { fill: rgba(255, 255, 255, .1); }
.plan-room.zone.selected .room-edge { stroke: #fff; stroke-width: 3px; }
.plan-room.zone .room-name, .plan-room.zone .room-info { fill: #fff; stroke: rgba(0, 0, 0, .6); }
.plan-room.zone.alert .room-fill { fill: rgba(220, 38, 38, .28); }
.plan-svg.editing .plan-room.zone .room-edge { stroke: rgba(255, 255, 255, .85); stroke-dasharray: 6 4; }
.plan-dev.photo .plan-dev-dot { fill: rgba(255, 255, 255, .94); stroke: rgba(0, 0, 0, .15); stroke-width: 1px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); }
.plan-dev.photo .plan-ic { color: #2A3245; }
.plan-dev.photo.on .plan-dev-dot { fill: #fff; stroke: #fff; }
.plan-dev.photo.light.on .plan-dev-dot { fill: #FFF6DA; stroke: #FFC93C; stroke-width: 2px; }
.plan-dev.photo.light.on .plan-ic { color: #B87800; }
.plan-dev.photo.water.on .plan-dev-dot { fill: #1E88E5; }
.plan-dev.photo.water.on .plan-ic { color: #fff; }
.plan-ring { fill: none; stroke: rgba(255, 201, 60, .55); stroke-width: 3px; animation: plan-ring 2.4s ease-out infinite; pointer-events: none; }
@keyframes plan-ring { 0% { stroke-opacity: .7; } 100% { stroke-opacity: .15; } }
.plan-stage.photo { background: #070B18; padding: 0; }
.plan-layer-box { padding: .6rem; border-radius: 12px; background: var(--sunken); }

@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-rooms { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); max-height: none; order: 2; }
  .home-pills { margin-left: 0; }
  .plan-panel.floating { position: static; width: auto; max-height: none; margin-top: 10px; }
  .plan-stage { flex-direction: column; }
}
@media (max-width: 640px) {
  .home-row, .home-row.covers { grid-template-columns: 1fr 1fr; }
  .home-cover { grid-template-columns: 1fr; }
  .home-rooms { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .plan-ring, .home-room.alert { animation: none; } }

/* ---------- Vue 3D (2.2.0) ---------- */
.plan-stage.three { padding: 0; background: radial-gradient(120% 90% at 50% 20%, #1B2440 0%, #0B1020 70%); display: block; }
.plan3d { position: relative; width: 100%; height: clamp(420px, calc(100vh - 230px), 900px); overflow: hidden; border-radius: inherit;
  touch-action: none; cursor: grab; }
.plan3d:active { cursor: grabbing; }
.plan3d-canvas { display: block; width: 100%; height: 100%; }
.plan3d-overlay { position: absolute; inset: 0; pointer-events: none; }
.plan3d-dev { position: absolute; left: 0; top: 0; margin: -18px 0 0 -18px; pointer-events: auto; appearance: none; border: 0; padding: 0;
  background: none; cursor: pointer; display: grid; justify-items: center; gap: 3px; will-change: transform; }
.plan3d-dev[hidden] { display: none; }
.plan3d-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .95);
  color: #2A3245; box-shadow: 0 3px 10px rgba(0, 0, 0, .45); transition: background-color .2s, box-shadow .2s, transform .15s; }
.plan3d-dot .ic { width: 18px; height: 18px; }
.plan3d-dev:hover .plan3d-dot, .plan3d-dev:focus-visible .plan3d-dot { transform: scale(1.12); }
.plan3d-dev:focus-visible { outline: none; }
.plan3d-dev:focus-visible .plan3d-dot { box-shadow: 0 0 0 3px var(--action), 0 3px 10px rgba(0, 0, 0, .45); }
.plan3d-dev.light.on .plan3d-dot { background: #FFF3CF; color: #B87800; box-shadow: 0 0 0 3px rgba(255, 201, 60, .6), 0 0 22px rgba(255, 190, 60, .75); }
.plan3d-dev.water.on .plan3d-dot { background: #1E88E5; color: #fff; }
.plan3d-dev.on:not(.light):not(.water) .plan3d-dot { background: #DDEBFF; color: #0E4A99; }
.plan3d-dev.alert .plan3d-dot { background: var(--danger); color: #fff; animation: plan-alert 1s infinite; }
.plan3d-dev.unavailable { opacity: .5; }
.plan3d-dev.behind { opacity: .35; }
.plan3d-dev.behind:hover { opacity: 1; }
.plan3d-val { font-size: .72rem; font-weight: 800; color: #fff; background: rgba(10, 14, 28, .78); padding: 1px 7px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan3d-val:empty { display: none; }
.plan3d-tools { flex-direction: row; gap: 6px; background: rgba(10, 14, 28, .6); backdrop-filter: blur(8px); }
.plan3d-tools .chip { min-height: 34px; font-size: .82rem; padding: .2rem .8rem; background: rgba(255,255,255,.08); color: #E8ECF5; border-color: rgba(255,255,255,.14); }
.plan3d-tools .chip[aria-pressed=true] { background: #fff; color: #0B1020; border-color: #fff; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg-btn { appearance: none; border: 0; background: none; font: inherit; font-weight: 800; font-size: .82rem; color: var(--ink-soft);
  padding: .35rem .8rem; min-height: 36px; cursor: pointer; }
.seg-btn[aria-pressed=true] { background: var(--action); color: var(--action-ink); }
@media (max-width: 640px) {
  .plan3d { height: 62vh; min-height: 340px; }
  .home-top > .actions { flex-wrap: wrap; }
  .plan3d-dev { margin: -13px 0 0 -13px; }
  .plan3d-dot { width: 26px; height: 26px; }
  .plan3d-dot .ic { width: 14px; height: 14px; }
  .plan3d-val { font-size: .62rem; padding: 0 5px; }
  .plan3d-tools { position: absolute; }
}
@media (prefers-reduced-motion: reduce) { .plan3d-dev.alert .plan3d-dot { animation: none; } }

/* ---------- Bibliothèque 3D (3.1.0) : mobilier, portes et fenêtres sur le plan 2D ---------- */
.plan-obj { cursor: pointer; outline: none; }
.plan-obj .plan-obj-body { fill-opacity: .55; stroke: color-mix(in srgb, var(--ink) 55%, transparent); stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.plan-obj.rug .plan-obj-body { fill-opacity: .25; stroke-dasharray: 4 3; }
.plan-obj.cat-exterieur .plan-obj-body { fill-opacity: .7; }
.plan-obj .plan-obj-front { stroke: color-mix(in srgb, var(--ink) 45%, transparent); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.plan-obj .plan-obj-label { fill: var(--ink); font-weight: 700; pointer-events: none; paint-order: stroke;
  stroke: color-mix(in srgb, var(--card) 80%, transparent); stroke-width: 3px; vector-effect: non-scaling-stroke; }
.plan-obj.selected .plan-obj-body { stroke: var(--action); stroke-width: 3px; fill-opacity: .7; }
.plan-svg:not(.editing) .plan-obj, .plan-svg:not(.editing) .plan-open { pointer-events: none; }
.plan-svg.editing.tool-rect .plan-obj, .plan-svg.editing.tool-poly .plan-obj,
.plan-svg.editing.tool-rect .plan-open, .plan-svg.editing.tool-poly .plan-open,
.plan-svg.editing.tool-obj .plan-obj, .plan-svg.editing.tool-open .plan-open { pointer-events: none; }
.plan-svg.editing.tool-obj, .plan-svg.editing.tool-open { cursor: copy; }
.plan-svg.editing .plan-obj { cursor: grab; }
.plan-open { cursor: pointer; }
.plan-open .plan-open-gap { stroke: var(--card); stroke-width: 16; stroke-linecap: butt; }
.plan-open .plan-open-leaf { stroke: var(--ink); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.plan-open .plan-open-arc { fill: none; stroke: var(--ink-soft); stroke-width: 1px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.plan-open .plan-open-glass { stroke: #3B82C4; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.plan-open .plan-open-garage { stroke: var(--ink-soft); stroke-width: 6; stroke-dasharray: 12 6; }
.plan-open.selected .plan-open-gap { stroke: var(--action-soft); }
.plan-open.selected .plan-open-leaf, .plan-open.selected .plan-open-glass { stroke: var(--action); }
.plan-open.orphan circle { fill: var(--danger); }

.lib-list { display: grid; gap: 12px; }
.lib-cat h3 { margin: 0 0 6px; font-size: .85rem; color: var(--ink-soft); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.lib-item { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: .86rem;
  border-radius: 10px; padding: .45rem .55rem; cursor: pointer; display: grid; grid-template-columns: 18px 1fr; column-gap: .5rem; text-align: left; }
.lib-item:hover { border-color: var(--line-strong); }
.lib-item.active { border-color: var(--action); background: var(--action-soft); font-weight: 700; }
.lib-swatch { width: 18px; height: 18px; grid-row: span 2; align-self: center; }
.lib-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.lib-dim { color: var(--ink-soft); font-size: .76rem; }

/* ---------- 3.3.0 : alerte vocale, ordre d'appel, application téléphone ---------- */
.warn-text { color: var(--warn-ink); font-weight: 600; }
.call-order { list-style: none; padding-left: 0; }
.order-badge { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-right: .5rem; border-radius: 50%;
  background: var(--warn-bg); color: var(--warn-ink); font-size: .8rem; font-weight: 700; }
.alert-live { border-color: var(--warn-edge); background: var(--warn-bg); }
.phone-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; counter-reset: step; }
.phone-step { display: grid; grid-template-columns: 2rem 1fr; gap: .75rem; align-items: start; }
.phone-step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 2rem; height: 2rem;
  border-radius: 50%; border: 2px solid currentColor; font-weight: 700; }
.phone-step.done::before { content: "✓"; color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); border-color: transparent; }
.phone-step h3 { margin: .2rem 0 .3rem; font-size: 1rem; }
.phone-qr { max-width: 220px; }
.ios-share { display: inline-block; padding: 0 .3rem; border: 1px solid currentColor; border-radius: .3rem; font-size: .85em; }
.cat-list { display: grid; gap: .4rem; }
.cat-hint { display: block; font-size: .85rem; }

/* ---------- 3.4.0 : assistance ---------- */
.support-bar { position: sticky; top: 0; z-index: 49; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 10px max(16px, env(safe-area-inset-left, 0px)); background: var(--warn-bg); color: var(--warn-ink); border-bottom: 2px solid var(--warn-edge); }
.support-bar span { flex: 1 1 240px; }
.support-msg { white-space: pre-wrap; margin: 0; }
.support-replies { border-left: 3px solid var(--warn-edge); padding-left: 10px; }
.support-replies p { margin: .2rem 0; }
.support-list > li + li { border-top: 1px solid var(--line, rgba(127,127,127,.25)); padding-top: .75rem; }
textarea.prose { font-family: inherit; font-size: inherit; line-height: 1.5; }

/* ---------- 3.5.0 : vidéosurveillance ---------- */
.vid-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 1.2rem; }
.vid-facts { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.vid-fact { display: inline-flex; align-items: center; gap: 6px; padding: .35rem .75rem; border-radius: var(--r-pill); background: var(--card);
  border: 1px solid var(--line); font-weight: 700; font-size: .85rem; }
.vid-fact .ic { width: 16px; height: 16px; }
.vid-fact.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-edge); }
.vid-fact.rec { color: var(--danger); }
.vid-fact .meter { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.vid-fact .meter > span { display: block; height: 100%; background: var(--action); }
.privacy-btn { display: inline-flex; align-items: center; gap: 10px; text-align: left; padding: .55rem .95rem; border-radius: var(--r-ctl);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.privacy-btn .ic { width: 22px; height: 22px; flex: none; }
.privacy-btn span { display: flex; flex-direction: column; }
.privacy-btn small { color: var(--ink-soft); font-size: .78rem; }
.privacy-btn.on { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }
.privacy-btn.on small { color: rgba(255,255,255,.75); }
.rec-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #E5484D; box-shadow: 0 0 0 3px rgba(229,72,77,.22);
  animation: rec-blink 1.6s ease-in-out infinite; }
@keyframes rec-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.cam-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.cam-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow); min-width: 0; }
.cam-tile.alert { border-color: #E5484D; box-shadow: 0 0 0 2px rgba(229,72,77,.35); }
.cam-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.cam-frame { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: #0A0F1C; display: grid; place-items: center; color: #9AA4B8; }
.cam-frame.off { gap: 6px; align-content: center; font-weight: 700; font-size: .88rem; }
.cam-frame.off .ic { width: 28px; height: 28px; }
.cam-frame .cam-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-frame .cam-wait { font-size: .85rem; }
.cam-frame.ready .cam-wait { display: none; }
.cam-frame[data-error]::after { content: attr(data-error); position: absolute; inset: auto 10px 10px; color: #FFB4B0; font-size: .82rem; text-align: center; }
dialog .cam-frame, video.cam-img.big { width: 100%; border-radius: var(--r-ctl); background: #000; }
video.cam-img.big { max-height: 70vh; display: block; }
.cam-meta { padding: 10px 14px 12px; display: grid; gap: 4px; }
.cam-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.cam-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-meta p { margin: 0; }
.cam-chip { display: inline-flex; align-items: center; gap: 6px; padding: .15rem .6rem; border-radius: var(--r-pill); font-size: .76rem; font-weight: 800;
  background: var(--sunken); color: var(--ink-soft); white-space: nowrap; }
.cam-chip.rec { background: var(--danger-soft); color: var(--danger); }
.cam-chip.watch { background: var(--action-soft); color: var(--action-strong); }
.cam-tile.alert .cam-chip { background: #E5484D; color: #fff; }
.empty-cams { align-items: center; text-align: center; padding-block: 2rem; }
.empty-cams .big-icon .ic { width: 44px; height: 44px; color: var(--action); }
.ev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ev-day { font-weight: 800; color: var(--ink-soft); text-transform: capitalize; padding-top: .6rem; }
.ev-open { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ev-open:hover { border-color: var(--action); }
.ev-thumb { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #0A0F1C; flex: none; }
.ev-thumb.none { display: grid; place-items: center; color: #9AA4B8; }
.ev-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.timeline { position: relative; height: 46px; border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); cursor: pointer; overflow: hidden; }
.tl-seg { position: absolute; top: 6px; height: 18px; background: var(--action); opacity: .85; }
.tl-ticks { position: absolute; inset: auto 0 2px 0; height: 14px; pointer-events: none; }
.tl-tick { position: absolute; bottom: 0; padding-left: 3px; border-left: 1px solid var(--line-strong); font-size: .7rem; line-height: 1; color: var(--ink-soft); white-space: nowrap; }
.vid-pick select, .vid-pick input[type=date] { width: auto; max-width: 100%; min-height: 40px; padding: .4rem .7rem; border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl); background: var(--card); color: var(--ink); font: inherit; }
.page-head .seg { max-width: 100%; overflow-x: auto; }
.page-head a.seg-btn { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.range-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-ctl); }
.range-row .days { display: flex; flex-wrap: wrap; gap: 4px; }
.day-chip { display: inline-flex; align-items: center; gap: 3px; padding: .15rem .45rem; border-radius: var(--r-pill); background: var(--sunken); font-size: .8rem; font-weight: 700; }
.cam-form fieldset { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 12px; display: grid; gap: 10px; min-width: 0; }
.cam-form legend { font-weight: 800; padding: 0 6px; }
.fov-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.fov-row > .stack { flex: 1 1 220px; }
.fov-preview { width: 120px; height: 120px; flex: none; }
.fov-ring { fill: var(--sunken); stroke: var(--line-strong); }
.fov-cone { fill: color-mix(in srgb, var(--action) 35%, transparent); stroke: var(--action); stroke-width: 1.5; }
.fov-dot { fill: var(--action); }
.fov-n { font-size: 8px; fill: var(--ink-soft); }
.plan-cam-cone { fill: color-mix(in srgb, var(--action) 18%, transparent); stroke: color-mix(in srgb, var(--action) 55%, transparent); stroke-width: 1px; pointer-events: none; }
.plan-cam-cone.live { fill: color-mix(in srgb, var(--action) 26%, transparent); }
.plan-cam-cone.alert { fill: rgba(229,72,77,.32); stroke: #E5484D; }
.plan-cam-cone.off { fill: rgba(127,127,127,.12); stroke: rgba(127,127,127,.35); stroke-dasharray: 3 3; }
@media (max-width: 640px) {
  .privacy-btn { width: 100%; }
  .ev-thumb { width: 84px; }
}

/* ---------- 3.6.0 : témoins de raccordement des caméras ---------- */
.cam-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cam-badge { display: inline-flex; align-items: center; gap: 5px; padding: .12rem .55rem; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--sunken); color: var(--ink); font-size: .76rem; font-weight: 800; white-space: nowrap; }
.cam-badge .ic { width: 15px; height: 15px; }
.cam-badge.good { color: var(--ok); }
.cam-badge.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-edge); }
.cam-badge.bad { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.cam-badge.muted { color: var(--ink-soft); font-weight: 700; }
.cam-badge-sub { font-weight: 600; color: var(--ink-soft); }
.cam-badge.warn .cam-badge-sub, .cam-badge.bad .cam-badge-sub { color: inherit; opacity: .85; }
.wifi-bars svg { width: 16px; height: 13px; display: block; }
.wifi-bars .bar { fill: currentColor; opacity: .22; }
.wifi-bars .bar.on { opacity: 1; }
.batt-ico { position: relative; display: inline-flex; }
.batt-ico .batt-fill { position: absolute; left: 3px; top: 6px; height: 4px; border-radius: 1px; background: currentColor; }
.area-row .cam-badges { margin-left: 6px; }
.module .face .cam-badges { margin-bottom: 4px; }

/* ---------- 3.7.0 : alarme intrusion ---------- */
.ia-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .ia-grid { grid-template-columns: 1fr; } }
.ia-status { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; padding: 18px; border-radius: var(--r-card); border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow); }
.ia-status .stack { flex: 1 1 240px; min-width: 0; gap: 4px; }
.ia-status p { margin: 0; }
.ia-icon svg { width: 40px; height: 40px; }
.ia-title { font-size: 1.5rem; letter-spacing: -.01em; }
.ia-status.off .ia-icon { color: var(--ok); }
.ia-status.armed { background: color-mix(in srgb, var(--action) 12%, var(--card)); border-color: var(--action); }
.ia-status.armed .ia-icon { color: var(--action); }
.ia-status.pending { background: var(--warn-bg); border-color: var(--warn-edge); color: var(--warn-ink); }
.ia-status.alarm { background: #B42318; border-color: #8F1B12; color: #fff; animation: ia-pulse 1.2s ease-in-out infinite; }
.ia-status.alarm .hint { color: rgba(255,255,255,.85); }
@keyframes ia-pulse { 50% { box-shadow: 0 0 0 6px rgba(180, 35, 24, .25); } }
@media (prefers-reduced-motion: reduce) { .ia-status.alarm { animation: none; } }
.ia-captures { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.ia-captures img { width: 160px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 2px solid rgba(255,255,255,.6); }
.ia-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ia-big { min-height: 52px; padding: .6rem 1.2rem; font-size: 1rem; display: inline-flex; align-items: center; gap: 8px; }
.ia-big .ic { width: 20px; height: 20px; }
.pin-pad { display: grid; gap: 12px; justify-items: center; outline: none; }
.pin-dots { display: flex; gap: 10px; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); }
.pin-dot.on { background: var(--ink); border-color: var(--ink); }
.pin-keys { display: grid; grid-template-columns: repeat(3, 64px); gap: 10px; }
.pin-key { height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--sunken); color: var(--ink); font: inherit;
  font-size: 1.35rem; font-weight: 800; cursor: pointer; }
.pin-key:active { background: var(--action-soft); }
.pin-pad.big .pin-keys { grid-template-columns: repeat(3, min(96px, 26vw)); }
.pin-pad.big .pin-key { height: min(80px, 18vw); font-size: 1.8rem; }
.ia-kiosk { display: grid; gap: 18px; justify-items: center; max-width: 560px; margin: 0 auto; }
.ia-kiosk .ia-status { width: 100%; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 4px 12px; max-height: 220px; overflow: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: var(--r-ctl); }
.ia-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ia-log li { padding: 4px 8px; border-left: 3px solid var(--line); }
.ia-log .lvl-alarme { border-color: var(--danger); font-weight: 700; }
.ia-log .lvl-defaut { border-color: var(--warn-edge); }
.ia-bar { background: #B42318; color: #fff; }

/* ---------- 3.7.1 : piles des équipements de l'alarme ---------- */
.batt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.batt-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.batt-list li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.det-item .cam-badge { justify-self: start; }

/* 3.8.0 : import de plans (image, PDF, SVG, DXF, maquette 3D) */
.plan-import { gap: 12px; }
.plan-import > p:empty { display: none; }
.plan-import-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%;
  min-height: 120px; padding: 18px; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--sunken);
  color: var(--ink); font: inherit; cursor: pointer; }
.plan-import-drop svg { width: 28px; height: 28px; color: var(--action); }
.plan-import-drop span { color: var(--ink-soft); font-size: .9em; }
.plan-import-drop:hover, .plan-import-drop.over { border-color: var(--action); background: var(--action-soft); }
.plan-import-drop:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
.plan-import-drop:disabled { opacity: .6; cursor: progress; }
.plan-import-formats { width: 100%; border-collapse: collapse; font-size: .9em; }
.plan-import-formats th, .plan-import-formats td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.plan-import-formats thead th { color: var(--ink-soft); font-weight: 600; }
.plan-import-formats tbody th { white-space: nowrap; }
.plan-import-help summary { cursor: pointer; color: var(--action); font-weight: 600; }
.plan-import-help ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: .9em; }
.plan-import-preview, .plan-import-canvas canvas { display: block; max-width: 100%; max-height: 46vh; margin: 0 auto;
  border: 1px solid var(--line); border-radius: 10px; background: #FFFFFF; }
.plan-import-canvas { overflow: auto; }
.plan-import-layers { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 0; }
.plan-import-layers legend { padding: 0 4px; font-weight: 600; }
.plan-import-layer-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 10px; max-height: 180px; overflow: auto; margin-top: 6px; }
.plan-import-layer-list .menu-item { min-width: 0; overflow-wrap: anywhere; }
.plan-model-preview { position: relative; width: 100%; height: clamp(240px, 38vh, 420px); border-radius: 12px; overflow: hidden;
  background: var(--sunken); border: 1px solid var(--line); }
