/* Dashboard maison v2 - design "Mindscope" : pastels, colonnes verticales, typo large. */
@font-face { font-family: "Lexend Exa"; src: url(../fonts/lexend-exa-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Lexend Exa"; src: url(../fonts/lexend-exa-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url(../fonts/poppins-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url(../fonts/poppins-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url(../fonts/poppins-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url(../fonts/poppins-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #d9e3df;
  --frame: #eef2f0;
  --card: #ffffff;
  --card-2: #f1f4f2;
  --line: #e3e8e5;
  --text: #161816;
  --muted: #6f7772;
  --card-2-b: #f1f4f2;
  --line-b: #e3e8e5;
  --text-b: #161816;
  --muted-b: #6f7772;
  --faint: #a5ada8;
  --dark: #1b1c1b;
  --on-dark: #f5f7f6;
  --hero: #1b1c1b;
  --mint: #bfe6d3;
  --peach: #f5cfc3;
  --yellow: #f4da98;
  --on: #e9a23b;
  --on-soft: #fbecc9;
  --hot: #e5534b;
  --ok: #2fa66a;
  --hc: #7cc8a6;
  --hp: #ee9f86;
  --car-hc: #6fb3e8;
  --car-hp: #2a62a8;
  --radius: 26px;
  --radius-sm: 16px;
  --shadow: none;
  --side: 250px;
  --wide: "Lexend Exa", "Poppins", sans-serif;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #090b0a;
  --frame: #121514;
  --card: #1c201e;
  --card-2: #262b28;
  --line: #2b312e;
  --text: #eef2f0;
  --muted: #9aa39e;
  --card-2-b: #262b28;
  --line-b: #2b312e;
  --text-b: #eef2f0;
  --muted-b: #9aa39e;
  --faint: #6b746f;
  --dark: #eef2f0;
  --on-dark: #161816;
  --hero: #000000;
  --mint: #9fd4bb;
  --peach: #e8b9aa;
  --yellow: #e6c87d;
  --on-soft: #3a2f17;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Poppins", -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.hidden { display: none !important; }
svg.i { width: 1em; height: 1em; fill: currentColor; flex: none; display: block; }
[data-icon] { display: inline-flex; }

/* ---------- Cadre ---------- */
.frame { padding: 16px; height: 100%; }
.app { display: flex; height: 100%; background: var(--frame); border-radius: 34px; overflow: hidden; }

/* ---------- Menu lateral ---------- */
.sidebar { width: var(--side); flex: none; display: flex; flex-direction: column; padding: 30px 22px 22px; gap: 4px; overflow-y: auto; }
.logo { padding: 0 10px 30px; }
.logo-text { font-family: var(--wide); font-weight: 600; font-size: 19px; line-height: 1.3; letter-spacing: .02em; }
#logo-sub { font-size: 12px; letter-spacing: .14em; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-settings, .shortcut {
  display: flex; align-items: center; gap: 14px; padding: 11px 12px; border-radius: 16px;
  color: var(--muted); font-weight: 500; text-align: left; transition: background .15s, color .15s;
}
.nav a i, .nav-settings i { font-size: 21px; }
.nav a:hover, .nav-settings:hover, .shortcut:hover { color: var(--text); }
.nav a.active, .nav-settings.active { background: var(--card); color: var(--text); font-weight: 600; }
.nav a.active i, .nav-settings.active i { color: var(--text); }
.side-sep { border-top: 2px dashed var(--line); margin: 16px 12px; }
.side-shortcuts { display: flex; flex-direction: column; gap: 2px; }
.shortcut .ic { font-size: 21px; display: flex; }
.shortcut .lbl { flex: 1; min-width: 0; }
.shortcut small { display: block; color: var(--faint); font-weight: 400; font-size: 12px; margin-top: -2px; }
.shortcut.on, .shortcut.on .ic { color: var(--on); }
.shortcut.on .lbl { color: var(--text); }
.side-info { margin-top: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.side-info:empty { display: none; }
.side-stat { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 20px; padding: 12px 14px; cursor: default; }
.ss-ic { width: 40px; height: 40px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--card-2); color: var(--muted); }
.ss-txt { min-width: 0; }
.ss-txt small { display: block; color: var(--muted); font-size: 11.5px; }
.ss-txt b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-stat.al-disarmed .ss-ic { background: var(--mint); color: #1b1c1b; }
.side-stat.al-armed .ss-ic { background: var(--peach); color: #1b1c1b; }
.side-stat.heat.on .ss-ic { background: var(--yellow); color: #1b1c1b; }
.side-promo {
  margin-top: 0; background: var(--card); border-radius: 24px; padding: 18px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.side-promo:empty { display: none; }
.promo-ic { width: 54px; height: 54px; border-radius: 50%; background: var(--yellow); color: #1b1c1b; display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 4px; }
.side-promo b { font-size: 15px; }
.side-promo small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.side-promo .btn { margin-top: 8px; }
.nav-settings { margin-top: 2px; }

/* ---------- Zone principale ---------- */
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 28px 28px 0 6px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 0 4px 22px; }
.topbar h1 { font-family: var(--wide); font-weight: 600; font-size: 32px; letter-spacing: .01em; line-height: 1.1; }
.sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.clock { font-weight: 600; font-size: 20px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.pill {
  position: relative; display: inline-flex; align-items: center; gap: 10px; height: 46px;
  padding: 0 5px 0 18px; border-radius: 999px; border: 1.5px solid var(--text); font-weight: 500; font-size: 14px;
}
.pill-ic { width: 36px; height: 36px; border-radius: 50%; background: var(--dark); color: var(--on-dark); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.dot { position: absolute; top: 4px; right: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--hot); border: 2px solid var(--frame); }
.round { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.avatar {
  position: relative; width: 46px; height: 46px; border-radius: 50%; background: var(--peach); color: #1b1c1b;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px;
}
.live { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: var(--faint); border: 2px solid var(--frame); }
.live.ok { background: var(--ok); }
.live.ko { background: var(--hot); }
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 0 4px 28px; -webkit-overflow-scrolling: touch; }

/* ---------- Colonnes verticales ---------- */
.cols { display: flex; gap: 18px; align-items: flex-start; }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.cols-3 > .col:nth-child(2) { flex-grow: 1.25; }
.grid { display: grid; gap: 16px; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 22px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-h-wrap { flex-wrap: wrap; row-gap: 8px; }
.card-h h3 { font-size: 17px; font-weight: 600; margin-right: auto; }
.card-h .muted { font-size: 13px; }
.arrow {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid currentColor; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 18px; opacity: .85;
}
.arrow:hover { background: var(--dark); color: var(--on-dark); border-color: var(--dark); opacity: 1; }
.muted { color: var(--muted); }
.big { font-weight: 600; font-size: 32px; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.big.xl { font-size: 46px; margin: 4px 0 6px; }
.unit { font-family: "Poppins", sans-serif; font-size: .45em; color: var(--muted); font-weight: 600; margin-left: 4px; letter-spacing: 0; }
.sheet .section-title:first-child { margin-top: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 2px 12px; }
.section-title h2 { font-size: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--card-2); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.chip.hp { background: var(--peach); color: #1b1c1b; }
.chip.warn { background: rgba(229, 83, 75, .14); color: var(--hot); }
.chip.ok { background: var(--mint); color: #1b1c1b; }
.link-btn { color: var(--muted); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

/* Cartes pastel (texte toujours sombre) */
.c-mint, .c-peach, .c-yellow { color: #1b1c1b; --muted: rgba(27, 28, 27, .6); --card-2: rgba(255, 255, 255, .5); --line: rgba(27, 28, 27, .1); --text: #1b1c1b; --dark: #1b1c1b; --on-dark: #f5f7f6; }
.c-mint { background: var(--mint); }
.c-peach { background: var(--peach); }
.c-yellow { background: var(--yellow); }
.c-mint .unit, .c-peach .unit, .c-yellow .unit { color: rgba(27, 28, 27, .6); }
.house.c-mint { --card: rgba(255, 255, 255, .78); --faint: rgba(27, 28, 27, .42); }
.house.c-mint .hs-row { background: rgba(255, 255, 255, .5); }
.house.c-mint .hs-flag { color: rgba(27, 28, 27, .6); }

/* ---------- Carte sombre ---------- */
.hero { background: var(--hero); color: #f5f7f6; position: relative; overflow: hidden; --muted: rgba(245, 247, 246, .55); --card-2: rgba(255, 255, 255, .08); --line: rgba(255, 255, 255, .1); --text: #f5f7f6; }
.hero .unit { color: rgba(245, 247, 246, .55); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero .big { font-size: 42px; line-height: 1.1; margin: 8px 0 4px; }
.hero .big.xl { font-size: 46px; }
.hero .chip { background: rgba(255, 255, 255, .12); color: inherit; }
.hero .arrow:hover { background: #f5f7f6; color: #1b1c1b; border-color: #f5f7f6; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.hero-stat { background: rgba(255, 255, 255, .08); border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
/* Variante claire du hero : meme mise en page, fond de carte ordinaire.
   Les sous-blocs du hero sont teintes en blanc translucide pour un fond sombre, on les repasse sur --card-2. */
.hero.hero-light {
  background: var(--card); color: var(--text-b);
  --muted: var(--muted-b); --card-2: var(--card-2-b); --line: var(--line-b); --text: var(--text-b);
}
.hero.hero-light .unit { color: var(--muted); }
.hero.hero-light .chip { background: var(--card-2); color: var(--text); }
.hero.hero-light .empty { color: var(--muted); }
.hero.hero-light .arrow { color: var(--text); border-color: var(--line); }
.hero.hero-light .arrow:hover { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.hero.hero-light .seg { background: var(--card-2); }
.hero.hero-light .seg button { color: var(--muted); }
.hero.hero-light .seg button.active { background: var(--dark); color: var(--on-dark); }
.hero.hero-light .hero-stat, .hero.hero-light .act-cell, .hero.hero-light .act-bar,
.hero.hero-light .gauge, .hero.hero-light .sub-it { background: var(--card-2); }
.hero.hero-light .sub-bar { background: var(--card-2); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .08); }
.hero.hero-light .sub-it.free .sub-dot { background: var(--card); color: var(--muted); }
.hero-stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-stat span { font-size: 12px; opacity: .6; }
.gauge { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .14); overflow: hidden; margin-top: 14px; }
.gauge > i { display: block; height: 100%; border-radius: 99px; background: var(--mint); transition: width .6s; }
.spark { height: 70px; margin: 14px -22px 4px; color: var(--mint); opacity: .55; }
.act-title { font-size: 14px; font-weight: 600; margin: 16px 0 10px; }
.act + .act { margin-top: 12px; }
.act-h { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.act-h span { opacity: .65; }
.act-bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.act-bar > i { display: block; height: 100%; border-radius: 99px; transition: width .6s; }

/* ---------- Petites cartes accueil ---------- */
.cost-split { display: flex; gap: 10px; margin-top: 14px; }
.cost-split > div { flex: 1; background: rgba(255, 255, 255, .5); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.cost-split small { display: block; font-size: 11px; opacity: .65; }
.cost-split b { font-size: 15px; white-space: nowrap; }
.cost-split .unit { font-size: .8em; }
.pill-count { min-width: 32px; height: 32px; padding: 0 10px; border-radius: 99px; background: #1b1c1b; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .6); font-size: 13px; font-weight: 500; }
.chip-btn svg { color: var(--on); }
.temp-pair { display: flex; gap: 12px; margin-bottom: 12px; }
.temp-pair > div { flex: 1; background: var(--card-2); border-radius: 18px; padding: 12px 14px; }
.temp-pair small { color: var(--muted); font-size: 12px; }
.temp-pair .big { font-size: 26px; }
.muted svg.i { display: inline-block; vertical-align: -2px; }
.btn.wide { width: 100%; }

/* ---------- Listes verticales (pieces, prises) ---------- */
.rtiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rtile { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 14px; border-radius: 22px; background: rgba(255,255,255,.55); color: inherit; min-width: 0; transition: background .15s; }
.rtile:hover { background: rgba(255,255,255,.8); }
.rt-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.rt-ic { width: 46px; height: 46px; border-radius: 16px; background: rgba(255, 255, 255, .6); display: flex; align-items: center; justify-content: center; font-size: 23px; color: #1b1c1b; }
.rtile.lit .rt-ic, .rtile.lit .rt-ic.tap { background: var(--yellow); box-shadow: 0 0 0 4px rgba(242,213,140,.35); }
.rtile b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtile .room-meta { gap: 2px 8px; font-size: 12px; margin-top: 2px; }
.rtile .room-badges { gap: 4px; }
.rtile .badge { width: 24px; height: 24px; border-radius: 8px; font-size: 14px; background: rgba(255,255,255,.7); }
.rtile .badge.on { background: var(--yellow); }
.rtile .badge.presence { background: var(--mint); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.rtile.off { opacity: .5; }
.tap { cursor: pointer; transition: transform .1s; }
.tap:hover { outline: 2px solid rgba(27,28,27,.18); outline-offset: 2px; }
.tap:active { transform: scale(.9); }
.vlist { display: flex; flex-direction: column; gap: 6px; }
.vrow {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px 8px 8px; border-radius: 18px;
  background: var(--card-2); text-align: left; transition: transform .1s, background .2s;
}
button.vrow:active { transform: scale(.985); }
.v-ic { width: 38px; height: 38px; border-radius: 13px; background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.c-mint .v-ic, .c-peach .v-ic, .c-yellow .v-ic { background: rgba(255, 255, 255, .75); }
.vrow.lit .v-ic { background: var(--yellow); color: #1b1c1b; }
.v-main { flex: 1; min-width: 0; }
.v-main b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-main small { color: var(--muted); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-val { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v-go { color: var(--muted); font-size: 18px; }
.vrow.off { opacity: .5; }
.vrow.pending { opacity: .65; }

/* ---------- Meteo (calendrier) ---------- */
.wx-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; }
.wx-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border-radius: 22px; font-size: 13px; }
.wx-day small { opacity: .55; font-size: 12px; }
.wx-day .d { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; }
.wx-day.today { background: rgba(255, 255, 255, .08); }
.wx-day.today .d { background: var(--mint); color: #1b1c1b; }
.wx-day .wx-ic { font-size: 22px; color: var(--yellow); }
.wx-day b { font-variant-numeric: tabular-nums; }
.wx-now { display: flex; align-items: center; gap: 16px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed rgba(255, 255, 255, .18); }
.wx-now .wx-ic { font-size: 50px; color: var(--yellow); }
.wx-now .big { font-size: 32px; margin: 0; }

/* ---------- Voiture ---------- */
.car-mini { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.car-row { display: flex; align-items: center; gap: 14px; }
.car-row .ring .txt b { font-size: 24px; }
.car-row .kv div { padding: 8px 12px; }
.car-row .kv b { font-size: 16px; }
.ring { position: relative; width: 110px; height: 110px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .txt b { font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
.ring .txt small { color: var(--muted); font-size: 11px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1; }
.kv div { background: var(--card-2); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.kv small { display: block; color: var(--muted); font-size: 13px; }
.kv b { font-size: 19px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ---------- Pieces ---------- */
.rooms { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.room {
  width: 100%; padding: 18px;
  display: flex; flex-direction: column; gap: 12px; text-align: left; 
  transition: transform .12s;
}
.room:active { transform: scale(.98); }
.room-top { display: flex; align-items: center; justify-content: space-between; }
.room-ic {
  width: 44px; height: 44px; border-radius: 14px; background: var(--card-2);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.room.lit .room-ic { background: var(--yellow); color: #1b1c1b; }
.room.lit { background: var(--on-soft); }
.room h4 { font-size: 16px; }
.room-meta { display: flex; gap: 10px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.room-meta span { display: inline-flex; align-items: center; gap: 3px; }
.room-meta .heat { color: var(--hot); }
.room-badges { display: flex; gap: 6px; }
.badge { width: 26px; height: 26px; border-radius: 9px; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--muted); }
.badge.on { background: var(--yellow); color: #1b1c1b; }
.badge.presence { background: var(--mint); color: #1b1c1b; }
.room.off { opacity: .5; }

/* ---------- Elements pilotables (tuiles) ---------- */
.tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile {
  background: var(--card); border-radius: 18px; padding: 14px; text-align: left;
  display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); min-height: 112px;
  transition: background .2s, color .2s, transform .12s;
}
.tile:active { transform: scale(.97); }
.tile .t-top { display: flex; justify-content: space-between; align-items: center; }
.tile .t-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.tile .t-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.tile .t-state { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tile.on { background: var(--dark); color: var(--on-dark); }
.tile.on .t-ic { background: rgba(255, 255, 255, .14); color: var(--on); }
.tile.on .t-state { color: inherit; opacity: .7; }
.tile.ro { cursor: default; }
.tile.unavail { opacity: .45; }
.tile.pending { opacity: .6; }

.switch { width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch.on { background: var(--ok); }
.switch.on::after { transform: translateX(18px); }

/* ---------- Listes ---------- */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .r-ic { width: 36px; height: 36px; border-radius: 11px; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 19px; flex: none; }
.row .r-main { flex: 1; min-width: 0; }
.row .r-main b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-main small { color: var(--muted); font-size: 12px; }
.row .r-val { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 6px; border-radius: 99px; background: var(--card-2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--dark); border-radius: 99px; }
.bar.low > i { background: var(--hot); }
.bar.mid > i { background: var(--on); }
.bar.good > i { background: var(--ok); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 999px; background: var(--card-2); font-weight: 600; font-size: 14px;
}
.btn.dark { background: var(--dark); color: var(--on-dark); }
.btn.danger { background: rgba(239, 68, 68, .12); color: var(--hot); }
.btn:active { transform: scale(.97); }
.btn i { font-size: 18px; }
.seg { display: flex; background: var(--card-2); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 8px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.active { background: var(--dark); color: var(--on-dark); }
.hero .seg { background: rgba(255,255,255,.1); }
.hero .seg button { color: rgba(250,250,250,.7); }
.hero .seg button.active { background: #f5f7f6; color: #1b1c1b; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 46px; height: 46px; border-radius: 50%; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.stepper b { font-size: 34px; min-width: 96px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 34px; border-radius: 12px; background: linear-gradient(90deg, var(--on) var(--p, 50%), var(--card-2) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 6px; height: 22px; margin-top: 6px; border-radius: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.1); }
input[type=range]::-moz-range-track { height: 34px; border-radius: 12px; background: var(--card-2); }
input[type=range]::-moz-range-progress { height: 34px; border-radius: 12px; background: var(--on); }
input[type=range]::-moz-range-thumb { width: 6px; height: 22px; border: 0; border-radius: 3px; background: #fff; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; height: 220px; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .area { fill: url(#gArea); }
.chart .line { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; }
.chart .b-hc { fill: var(--hc); }
.chart .b-hp { fill: var(--hp); }
.chart .b-whc { fill: var(--car-hc); }
.chart .b-whp { fill: var(--car-hp); }
.chart .b-sel { opacity: .35; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-tip { font-size: 13px; color: var(--muted); min-height: 20px; margin-top: 6px; }
.chart-tip b { color: var(--text); }

/* ---------- Pneus ---------- */
.tires { display: grid; grid-template-columns: 1fr 90px 1fr; gap: 10px; align-items: center; }
.tires .car-body { grid-row: span 2; grid-column: 2; height: 170px; border-radius: 40px 40px 30px 30px; border: 3px solid var(--line); position: relative; }
.tires .car-body::before { content: ""; position: absolute; left: 12px; right: 12px; top: 38px; height: 34px; border-radius: 12px 12px 4px 4px; background: var(--card-2); }
.tire { background: var(--card-2); border-radius: 14px; padding: 10px; text-align: center; }
.tire b { font-size: 20px; display: block; font-variant-numeric: tabular-nums; }
.tire small { color: var(--muted); font-size: 11px; }
.tire.low { background: rgba(239, 68, 68, .12); color: var(--hot); }

/* ---------- Alarme ---------- */
.alarm-state { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.alarm-state .a-ic { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; background: var(--card-2); }
.alarm-state.armed .a-ic { background: var(--peach); color: #1b1c1b; }
.alarm-state.disarmed .a-ic { background: var(--mint); color: #1b1c1b; }
.alarm-btns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.alarm-btns .btn.active { background: var(--dark); color: var(--on-dark); }

/* ---------- Media ---------- */
.media-row { display: flex; align-items: center; gap: 12px; }
.media-row .m-main { flex: 1; min-width: 0; }
.media-row .m-main b { display: block; font-size: 14px; }
.media-row .m-main small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.media-ctl { display: flex; gap: 6px; }
.media-ctl button { width: 38px; height: 38px; border-radius: 50%; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 19px; }
.media-ctl button.on { background: var(--dark); color: var(--on-dark); }
.media + .media { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
select {
  font: inherit; font-size: 13px; color: var(--text); background: var(--card-2);
  border: 0; border-radius: 10px; padding: 8px 10px; margin-top: 10px; width: 100%;
}

/* ---------- Modale ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; animation: fade .15s; }
.sheet { background: var(--frame); border-radius: 30px; width: min(760px, 100%); max-height: 92vh; overflow-y: auto; padding: 24px; animation: pop .18s; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.sheet-h h2 { font-size: 24px; display: flex; align-items: center; gap: 10px; }
.sheet .card { box-shadow: none; }
.sheet .card + .card { margin-top: 12px; }
.light-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.sheet .light-grid > .card { margin: 0; }
.light-card { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; transition: background .2s, transform .1s; }
.light-card:active { transform: scale(.985); }
.light-card.on { background: var(--yellow); color: #1b1c1b; }
.light-card.on .muted { color: rgba(27, 28, 27, .6); }
.light-card.unavail { cursor: default; opacity: .55; }
.light-card.pending { opacity: .75; }
.light-card .lr-top { display: flex; align-items: center; gap: 12px; }
.light-card .lr-top b { flex: 1; font-weight: 600; }
.light-card .lr-top small { font-weight: 500; }
.light-card .room-ic { width: 40px; height: 40px; font-size: 21px; flex: none; }
.light-card.on .room-ic { background: #1b1c1b; color: var(--yellow); }
.light-card.on input[type=range]::-webkit-slider-runnable-track { background: linear-gradient(90deg, #1b1c1b var(--p, 50%), rgba(255,255,255,.55) var(--p, 50%)); }
.light-card input[type=range] { margin-top: 14px; width: 100%; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }

/* ---------- Alertes ---------- */
.popover {
  position: fixed; top: 86px; right: 40px; width: 360px; max-height: 70vh; overflow-y: auto;
  background: var(--card); border-radius: 22px; padding: 16px; z-index: 40;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
}
.popover h3 { font-size: 16px; margin-bottom: 8px; }

/* ---------- PIN ---------- */
.gate { position: fixed; inset: 0; background: var(--frame); z-index: 100; display: flex; align-items: center; justify-content: center; }
.gate-box { text-align: center; width: 300px; }
.gate-box h2 { font-size: 18px; font-weight: 500; color: var(--muted); }
.gate-brand { font-family: var(--wide); font-weight: 600; font-size: 28px; letter-spacing: .06em; margin-bottom: 10px; }
.pin-display { display: flex; justify-content: center; gap: 12px; margin: 22px 0 8px; min-height: 16px; }
.pin-display i { width: 14px; height: 14px; border-radius: 50%; background: var(--text); }
.pin-error { color: var(--hot); min-height: 20px; font-size: 14px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.keypad button { height: 66px; border-radius: 50%; width: 66px; margin: 0 auto; background: var(--card); font-size: 26px; font-weight: 600; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.keypad button:active { background: var(--card-2); }
.keypad button.ghost { background: transparent; box-shadow: none; font-size: 22px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--dark); color: var(--on-dark); padding: 12px 22px; border-radius: 999px;
  font-weight: 600; z-index: 200; max-width: 90vw; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.toast.err { background: var(--hot); color: #fff; }

.empty { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 14px; }
.skeleton { background: linear-gradient(90deg, var(--card-2), var(--line), var(--card-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; height: 220px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .cols-3 { flex-wrap: wrap; }
  .cols-3 > .col { flex: 1 1 calc(50% - 9px); }
  .cols-3 > .col:nth-child(3) { flex-basis: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 1100px) {
  :root { --side: 86px; }
  .sidebar { align-items: center; padding: 26px 10px 18px; }
  .logo-text { font-size: 10.5px; }
  #logo-sub, .nav span, .nav-settings span, .shortcut .lbl, .side-promo small, .side-promo b, .ss-txt { display: none; }
  .side-stat { padding: 6px; background: transparent; }
  .side-sep { width: 40px; margin: 14px auto; }
  .side-promo { padding: 10px; background: transparent; }
  .side-promo .btn { display: none; }
  .promo-ic { width: 46px; height: 46px; }
  .pill > span:first-child { display: none; }
  .pill { padding: 0 4px; }
}
@media (max-width: 760px) {
  .frame { padding: 0; }
  .app { border-radius: 0; flex-direction: column-reverse; }
  .sidebar { width: auto; flex-direction: row; padding: 8px; justify-content: space-around; overflow: visible; }
  .logo, .side-shortcuts, .side-sep, .side-promo, .side-info { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-settings { margin: 0; }
  .main { padding: 16px 14px 0; }
  .topbar h1 { font-size: 22px; }
  .clock, #btn-theme { display: none; }
  .cols { flex-direction: column; align-items: stretch; }
  .cols > .col, .cols-3 > .col:nth-child(3) { flex-basis: auto; display: flex; }
  .popover { left: 12px; right: 12px; width: auto; }
}
.keypad button.ok { background: var(--dark); color: var(--on-dark); font-size: 20px; }

.mini-stats { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; align-items: stretch; }
.sheet .mini-stats > .card { margin: 0; }
.sheet .mini-stats .big { font-size: 22px !important; }

/* ---------- Historique Tesla (recharges / trajets) ---------- */
.tm-cols > .col:first-child { flex-grow: 1; }
.tm-cols > .col:nth-child(2) { flex-grow: 1.55; }
.tm-cols > .col:empty { display: none; }
.hero .seg { background: rgba(255, 255, 255, .1); }
.hero .seg button { color: rgba(255, 255, 255, .65); }
.hero .seg button.active { background: var(--on-dark); color: var(--dark); }
.hero .card-h h3 { font-size: 19px; }
.hero .arrow { color: var(--on-dark); border-color: rgba(255, 255, 255, .25); }
.hero .chip { background: rgba(255, 255, 255, .12); color: #f5f7f6; }
.hero .empty { color: rgba(255, 255, 255, .6); }
.tm-tabs button { padding: 11px 8px; }
.seg button[data-act^="tm-"] { font-size: 13px; padding: 9px 4px; }

.tm-list { display: flex; flex-direction: column; gap: 8px; }
.tm-item { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius-sm); background: var(--card-2); color: inherit; text-decoration: none; transition: transform .15s, background .15s; }
.tm-item:hover { background: var(--line); }
.tm-item:active { transform: scale(.99); }
.tm-ic { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--mint); color: #1b1c1b; font-size: 22px; }
.tm-ic.dc { background: var(--yellow); }
.tm-ic.drive { background: var(--peach); }
.tm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tm-main b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-main small, .tm-right small, .tm-route small { font-size: 12.5px; color: var(--muted); }
.tm-tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 99px; background: var(--card); font-size: 11px; font-weight: 600; color: var(--muted); vertical-align: 1px; }
.tm-tag.est { background: rgba(245, 158, 11, .16); color: #b7791f; }
.tm-right { flex: none; text-align: right; display: flex; flex-direction: column; gap: 3px; }
.tm-right b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tm-soc { position: relative; height: 5px; border-radius: 99px; background: var(--line); margin-top: 6px; max-width: 320px; overflow: hidden; }
.tm-soc i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; }
.tm-soc .s0 { background: var(--faint); }
.tm-soc .s1 { background: var(--ok); }

.tm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tm-stat { background: var(--card-2); border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
.c-mint .tm-stat, .c-peach .tm-stat, .c-yellow .tm-stat { background: rgba(255, 255, 255, .5); }
.tm-stat b { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-stat span { font-size: 12px; color: var(--muted); }

.chart .tm-a { fill: none; stroke: var(--on); stroke-width: 2.2; stroke-linejoin: round; }
.chart .tm-a-fill { fill: var(--on); opacity: .12; }
.chart .tm-b { fill: none; stroke: var(--ok); stroke-width: 2; stroke-dasharray: 5 4; }
.chart .tm-bar-a { fill: var(--ok); }
.chart .tm-bar-b { fill: var(--on); }
.chart .tm-v { fill: var(--text); font-weight: 600; }

.map-slot { position: relative; z-index: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--card-2); }
.map-slot > .map { position: absolute; inset: 0; }
.map-slot .leaflet-container { background: var(--card-2); font-family: inherit; }
.tm-route { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.tm-route b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.tm-mini.m4 { grid-template-columns: repeat(2, 1fr); }
.dnav { display: flex; align-items: center; gap: 8px; }
.dnav .arrow:disabled { opacity: .3; pointer-events: none; }
.tm-mini > div { background: var(--card-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.tm-mini small { display: block; font-size: 11.5px; color: var(--muted); }
.tm-mini b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-mini .unit { font-size: 12px; font-weight: 500; color: var(--muted); }
@media (max-width: 760px) {
  .tm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tm-soc { max-width: none; }
}

:root { --gas: #f4b860; }
.chart .b-gas { fill: var(--gas); }
.chart .b-car { fill: var(--hc); }
.card-h .seg + .seg { margin-left: auto; }

/* Classement par appareil */
.dev-rank .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--dc); margin-right: 8px; vertical-align: 1px; }
.dev-rank .bar { height: 8px; }
.dev-rank .bar > i { background: var(--dc); }
.dev-rank .pct { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700; color: var(--text); background: color-mix(in srgb, var(--dc) 35%, transparent); }

/* Infobulle des barres */
#bar-tip { position: fixed; z-index: 200; display: none; pointer-events: none; background: #1b1c1b; color: #fff; border-radius: 12px; padding: 8px 12px; font-size: 13px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.18); white-space: nowrap; }
#bar-tip b { color: #fff; font-weight: 700; }
#bar-tip > b { display: block; margin-bottom: 2px; }
#bar-tip span { display: block; color: rgba(255,255,255,.85); }
#bar-tip span i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
#bar-tip span.tip-sub { padding-left: 14px; font-size: 12px; color: rgba(255,255,255,.62); }
.chart .bar-hot rect:not([fill="transparent"]) { filter: brightness(.88); }

/* Listes et tuiles colorees sur fond blanc */
.tint-list .v-ic { background: var(--card); color: var(--muted); }
.tint-list .vrow.lit .v-ic { background: var(--dc); color: #1b1c1b; }
.tint-list .vrow.lit .v-val { padding: 2px 9px; border-radius: 99px; background: color-mix(in srgb, var(--dc) 35%, transparent); }
.cost-split.tinted > div { background: var(--card-2); }
.cost-split.tinted small { opacity: .7; }

/* Multimedia : fond blanc, icone coloree si allume */
.media-card .room-ic { background: var(--card-2); color: var(--muted); }
.media-card .media.on .room-ic { background: var(--yellow); color: #1b1c1b; }

.hero.wb-orange { background: var(--yellow); color: #1b1c1b; --muted: rgba(27, 28, 27, .6); --text: #1b1c1b; --line: rgba(27, 28, 27, .1); --card-2: rgba(255, 255, 255, .5); }
.hero.wb-orange .unit { color: rgba(27, 28, 27, .6); }
.hero.wb-orange .hero-stat, .hero.wb-orange .seg { background: rgba(255, 255, 255, .5); }
.hero.wb-orange .chip { background: rgba(255, 255, 255, .6); color: #1b1c1b; }
.hero.wb-orange .seg button { color: rgba(27, 28, 27, .7); }
.hero.wb-orange .seg button.active { background: #1b1c1b; color: #fff; }
.hero.wb-orange .hero-stat span { opacity: .7; }

.avatar.has-pic { background-size: cover; background-position: center; }
.avatar.has-pic span { visibility: hidden; }

button.side-stat { cursor: pointer; border: 0; width: 100%; text-align: left; font: inherit; color: inherit; transition: transform .12s; }
button.side-stat:active { transform: scale(.98); }
.alarm-sheet .alarm-btns .btn { min-height: 56px; font-size: 15px; }
.th-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.th-actions .btn { min-height: 52px; justify-content: center; }
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.sheet .th-grid .card + .card { margin-top: 0; }
.th-tile { display: flex; flex-direction: column; gap: 10px; }
.th-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-top b { font-size: 15px; min-width: 0; }
.th-tile .chip.warn { flex: none; order: 3; width: 100%; justify-content: center; gap: 5px; font-size: 11px; padding: 3px 8px; white-space: nowrap; }
.home-th .th-tile .chip.warn { font-size: 10px; padding: 2px 6px; }
.th-ic { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--card-2); color: var(--muted); font-size: 18px; }
.th-tile.on .th-ic { background: var(--mint); color: #1b1c1b; }
.th-tile.heating .th-ic { background: var(--yellow); color: #1b1c1b; }
.th-cur { font-size: 28px; font-weight: 600; line-height: 1; }
.th-cur small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 6px; }
.th-seg { width: 100%; }
.th-seg button { flex: 1; }
.th-step { justify-content: space-between; width: 100%; }
.th-tile.unavail { opacity: .55; }
.th-step b { font-size: 24px; min-width: 0; }
.th-step button { width: 42px; height: 42px; }

.act-title { display: flex; justify-content: space-between; align-items: baseline; color: #ff9f43; }
.act-cost { font-size: 20px; font-weight: 600; color: #ff9f43; }
.act-cost .unit { font-size: 13px; color: inherit; opacity: .8; }
.tap-card { cursor: pointer; }
.tap-card .arrow { display: flex; align-items: center; justify-content: center; }
.rtile .room-badges { gap: 6px; }
.rtile .badge { width: 32px; height: 32px; border-radius: 10px; font-size: 19px; color: rgba(27, 28, 27, .7); background: rgba(255,255,255,.85); }
.rtile .badge.on { background: var(--yellow); color: #1b1c1b; }
.act-h .unit { font-size: inherit; margin-left: 2px; }

.home-th .th-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
.home-th .th-tile { background: var(--card-2); box-shadow: none; padding: 12px; margin: 0; gap: 8px; }
.home-th .th-cur { font-size: 22px; }
.home-th .th-seg button, .home-th .th-step button { min-height: 38px; }
.home-th .th-actions .btn { min-height: 44px; }

.home-th .th-top { align-items: center; gap: 6px; }
.home-th .th-top b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.home-th .th-tog { flex: none; border: 0; cursor: pointer; width: 36px; height: 36px; }
.home-th .th-tile.unavail .chip { display: none; }
.home-th .th-step { padding: 2px; }
.home-th .th-actions .btn { white-space: nowrap; font-size: 14px; padding: 0 10px; }
.home-th .th-grid { grid-template-columns: repeat(3, 1fr); }
.side-stat.ok .ss-ic { background: var(--mint); color: #1b1c1b; }
.side-stat.warn .ss-ic { background: var(--peach); color: #1b1c1b; }
.side-stat.sched .ss-ic { background: var(--yellow); color: #1b1c1b; }
.th-mini { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.th-mini b { font-size: 15px; font-weight: 700; min-width: 42px; text-align: center; }
.th-mini button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0,0,0,.06); color: inherit; display: flex; align-items: center; justify-content: center; font-size: 16px; cursor: pointer; }
.th-mini button:active { transform: scale(.92); }
.th-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.th-row > span:first-child { min-width: 0; }
.th-row .th-mini { margin-top: 0; gap: 2px; flex: none; }
.th-row .th-mini b { font-size: 14px; min-width: 38px; }
.th-row .th-mini button { width: 26px; height: 26px; font-size: 15px; }

/* Accueil : Pièces + Chauffage fusionnés */
.home-grid .cols-3 > .col:nth-child(2) { flex-grow: 1.7; }
.rooms-heat .th-actions { margin-bottom: 14px; }
.rooms-heat .th-actions .btn { min-height: 48px; background: rgba(255,255,255,.7); }
.rooms-heat .th-actions .btn.dark { background: var(--dark); }
.rh-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rtile.rh { cursor: pointer; padding: 16px; gap: 4px; }
.rtile.rh .rt-top { margin-bottom: 8px; }
.rh-name { font-size: 16px !important; }
.rh-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 34px; }
.rh-temp { font-size: 28px; font-weight: 600; line-height: 1; letter-spacing: -.5px; }
.rh-row .th-mini { margin: 0; gap: 3px; flex: none; }
.rh-row .th-mini b { font-size: 15px; min-width: 42px; }
.rh-row .th-mini button { width: 30px; height: 30px; background: rgba(255,255,255,.85); }
.rtile.rh .room-meta { font-size: 12.5px; gap: 4px 10px; margin-top: 6px; }
.rtile.rh .room-meta .heat { color: #c4721f; font-weight: 600; }
.rtile .badge.rad { border: 0; cursor: pointer; font: inherit; font-size: 19px; }
.rtile .badge.rad.armed { background: var(--card); color: #1b1c1b; box-shadow: inset 0 0 0 2px var(--mint); }
.rtile .badge.rad.on { background: var(--yellow); color: #1b1c1b; }
.rtile .badge.na { opacity: .4; }
.rtile.rh.heating { box-shadow: inset 0 0 0 2px var(--yellow); }
@media (max-width: 1300px) { .rh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rh-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
@media (max-width: 1300px) { .rh-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
/* Ouvertures (fenêtres / portes) */
.rtile .badge.open, .badge.open { background: #ff9f43; color: #fff; }
/* Liste des lampes (popup pièce) */
.bulb-list { display: flex; flex-direction: column; gap: 8px; }
.bulb-row { display: grid; grid-template-columns: 44px minmax(120px, 1fr) minmax(140px, 1.2fr); align-items: center; gap: 14px; }
.bulb-row .b-ic { width: 44px; height: 44px; border: 0; border-radius: 14px; background: var(--card-2); color: var(--muted); font-size: 20px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.bulb-row.on .b-ic { background: var(--yellow); color: #1b1c1b; }
.bulb-row input[type=range] { margin: 0; }
.bulb-row .b-bar { height: 34px; border-radius: 12px; background: var(--card-2); opacity: .5; }
.bulb-row .b-name { display: flex; flex-direction: column; min-width: 0; }
.bulb-row .b-name b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulb-row .b-name small { color: var(--muted); font-size: 12px; }
.bulb-row.unavail { opacity: .45; }
.bulb-row.pending { opacity: .7; }
/* Réglages d'une lampe (appui long) */
[data-light], [data-id^="light."] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.lm-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.lm-row b { font-size: 16px; }
.lm-lab { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin: 18px 0 10px; }
.lm-lab .muted { margin-left: auto; font-weight: 400; }
.lm input[type=range] { width: 100%; height: 44px; margin: 0; }
.lm input[type=range]::-webkit-slider-runnable-track { height: 44px; border-radius: 14px; }
.lm input[type=range]::-webkit-slider-thumb { width: 8px; height: 32px; margin-top: 6px; }
.lm input.lm-ct::-webkit-slider-runnable-track { background: linear-gradient(90deg, #ffa94d, #ffe7c2 45%, #f4f8ff 70%, #b9d4ff); }
.lm input.lm-hue::-webkit-slider-runnable-track { background: linear-gradient(90deg, hsl(0,100%,55%), hsl(60,100%,55%), hsl(120,100%,45%), hsl(180,100%,45%), hsl(240,100%,60%), hsl(300,100%,55%), hsl(360,100%,55%)); }
.lm input.lm-ct::-moz-range-track { background: linear-gradient(90deg, #ffa94d, #ffe7c2 45%, #f4f8ff 70%, #b9d4ff); }
.lm input.lm-hue::-moz-range-track { background: linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red); }
.lm input.lm-ct::-moz-range-progress, .lm input.lm-hue::-moz-range-progress { background: transparent; }
.lm-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.lm-sw { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.lm-sw button { width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.lm-sw button.sel { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px #1b1c1b; }
/* Activité du jour : HC / HP / Gaz */
.act-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.act-cell { background: rgba(255,255,255,.06); border-radius: 14px; padding: 12px 14px; border-top: 3px solid var(--ac); display: flex; flex-direction: column; gap: 4px; }
.act-cell small { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .65; }
.act-cell small i, .act-cell small svg { width: 14px; height: 14px; color: var(--ac); }
.act-cell b { font-size: 20px; font-weight: 600; }
.act-cell b .unit, .act-cell span .unit { font-size: 12px; margin-left: 3px; opacity: .7; }
.act-cell > span { font-size: 14px; opacity: .85; }
.act-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.act-cell { padding: 10px 12px; min-width: 0; }
.act-cell small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-cell small svg, .act-cell small i { flex: none; }
.act-cell b { font-size: 18px; white-space: nowrap; }
.v-sw { border: 0; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); transition: transform .15s; }
.v-sw:active { transform: scale(.9); }
.vrow[data-act="plug-info"] { cursor: pointer; }
/* Popup thermostat */
.th-tile[data-act="th-info"] { cursor: pointer; }
.th-curves { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.th-curve { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 99px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--card-2); color: var(--muted); }
.th-curve i { width: 12px; height: 12px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 2px var(--cc); }
.th-curve.on { color: var(--text); background: color-mix(in srgb, var(--cc) 18%, var(--card-2)); }
.th-curve.on i { background: var(--cc); }
/* Limite de charge sur la jauge */
.climit { position: relative; margin-top: 14px; }
.climit .gauge { height: 14px; margin-top: 0; overflow: visible; position: relative; }
.climit .gauge > i { border-radius: 99px; }
.climit-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: #fff; opacity: .9; }
.climit-in { position: absolute; inset: -12px 0; width: 100%; height: 38px !important; margin: 0; background: transparent; cursor: pointer; touch-action: none; }
.climit-in::-webkit-slider-runnable-track { height: 38px !important; background: transparent !important; }
.climit-in::-webkit-slider-thumb { width: 26px !important; height: 26px !important; margin-top: 6px !important; border-radius: 50% !important; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35) !important; }
.climit-in::-moz-range-track { background: transparent !important; }
.climit-in::-moz-range-progress { background: transparent !important; }
.climit-in::-moz-range-thumb { width: 26px !important; height: 26px !important; border-radius: 50% !important; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }

.wb-cur-h { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 8px; font-size: 13px; }
.wb-cur-h b { font-size: 18px; font-weight: 650; }
.wb-cur-h + .climit { margin: 10px 0 6px; }

.subp { margin-top: 18px; }
.sub-bar { display: flex; gap: 3px; height: 16px; padding: 3px; border-radius: 99px; background: rgba(255, 255, 255, .07); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .4); }
.sub-bar > i { display: block; height: 100%; border-radius: 99px; transition: width .6s; min-width: 6px; }
.sub-bar > i.home { background: linear-gradient(90deg, #f7c35f, #f4da98); box-shadow: 0 0 12px rgba(244, 218, 152, .45); }
.sub-bar > i.wb { background: linear-gradient(90deg, #2fa66a, #5fd39a); box-shadow: 0 0 12px rgba(95, 211, 154, .5); }
.sub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.sub-it { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .05); }
.sub-it b { display: block; font-size: 17px; font-weight: 650; line-height: 1.1; }
.sub-it small { display: block; margin-top: 3px; font-size: 12px; opacity: .6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-it > div { min-width: 0; max-width: 100%; }
.sub-it { align-items: stretch; }
.sub-top { display: flex; align-items: center; justify-content: space-between; }
.sub-top em { font-style: normal; font-size: 12px; font-weight: 650; opacity: .7; }
.sub-dot { width: 32px; height: 32px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.sub-it.home .sub-dot { background: rgba(244, 218, 152, .16); color: #f4da98; }
.sub-it.wb .sub-dot { background: rgba(95, 211, 154, .16); color: #5fd39a; }
.sub-it.free .sub-dot { background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .6); }
.chip-btn { background: rgba(233, 162, 59, .14); border: 1px solid rgba(233, 162, 59, .32); color: var(--text); transition: background .2s; }
.chip-btn:hover { background: rgba(233, 162, 59, .24); }
.chip-btn svg { color: var(--on); filter: drop-shadow(0 0 4px rgba(233, 162, 59, .6)); }
.btn.lit-off { background: linear-gradient(135deg, #f2b553, #e9a23b); color: #1b1c1b; box-shadow: 0 6px 18px rgba(233, 162, 59, .25); }

/* ---------- Accueil compact : multimedia, NAS ---------- */
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.media-grid .media { background: var(--card-2); border-radius: 14px; padding: 8px 10px; min-width: 0; }
.media-grid .media + .media { margin-top: 0; padding-top: 8px; border-top: 0; }
.media-grid.one { grid-template-columns: 1fr; }
.media-grid .room-ic { width: 32px; height: 32px; font-size: 17px; background: var(--card); }
.media-grid .media-ctl button { width: 32px; height: 32px; font-size: 17px; background: var(--card); }
.media-grid .media-ctl button.on { background: var(--dark); }
.media-grid .media-row { gap: 8px; }
.media-grid select { width: auto; max-width: 150px; flex: none; padding: 6px 28px 6px 12px; font-size: 13px; background-color: var(--card); margin: 0; }
.media-card .card-h, .nas-card .card-h { margin-bottom: 10px; }
.btn.sm { padding: 6px 12px; font-size: 13px; min-height: 0; width: auto; }
.nas-card .card-h .chip { margin-left: auto; }
.nas-sum { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.nas-sum b { font-size: 20px; font-weight: 600; }
.nas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.nas-d { background: var(--card-2); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.nas-d .bar { margin: 5px 0 3px; height: 5px; background: var(--card); }
.nas-d small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.nas-d small b { color: var(--text); }
.nas-t { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.nas-ok, .nas-bad { display: flex; font-size: 15px; color: var(--ok); }
.nas-bad { color: var(--hot); }

/* Colonne droite de l'accueil : compacte pour tenir sans defilement */
.card.cc { padding: 16px 18px; }
.card.cc .card-h { margin-bottom: 10px; }
.card.cc .card-h .round { width: 34px; height: 34px; }
.cc .vlist { gap: 4px; }
.cc .vrow { padding-top: 5px; padding-bottom: 5px; }
.cc .v-ic { width: 32px; height: 32px; border-radius: 11px; font-size: 17px; }
.cc .media-row .m-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc .car-row .ring .txt b { font-size: 22px; }
.cc .car-row .kv { gap: 6px; }
.cc .car-row .kv div { padding: 6px 10px; }
.cc .car-row .kv small { font-size: 12px; }
.cc .car-row .kv b { font-size: 15px; }
.cc .car-row .chip { padding: 4px 10px; font-size: 12px; }
.nas-card .nas-grid { margin-top: 10px; gap: 6px; }
.nas-card .nas-d { padding: 6px 10px; }
.nas-card .nas-sum b { font-size: 17px; }

.nas-pw { width: 34px; height: 34px; border-radius: 50%; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.nas-pw.on { background: var(--dark); color: var(--on-dark); }
.nas-pw.pending { opacity: .6; }
.nas-pw:disabled { opacity: .4; }
.nas-card p .ic, .nas-card p svg { width: 14px; height: 14px; vertical-align: -2px; }

/* Carte voiture : stats avec icones */
.car-row { align-items: stretch; gap: 18px; }
.car-row .car-mini { justify-content: center; }
.car-stats { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  background: var(--card-2); border-radius: 18px; overflow: hidden; }
.car-stats .cs { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-width: 0; position: relative; }
.car-stats .cs:nth-child(odd)::after { content: ''; position: absolute; right: 0; top: 22%; bottom: 22%; width: 1px; background: var(--line, rgba(0,0,0,.08)); }
.car-stats .cs:nth-child(-n+2)::before { content: ''; position: absolute; left: 14px; right: 14px; bottom: 0; height: 1px; background: var(--line, rgba(0,0,0,.08)); }
.car-stats .cs > div { min-width: 0; }
.car-stats .cs-ic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--tc); }
.car-stats .cs-ic svg { width: 20px; height: 20px; }
.car-stats small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.car-stats b { display: block; font-size: 18px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-stats b small { display: inline; font-size: 12px; font-weight: 500; margin-left: 2px; }
.cs.c-blue { --tc: #3b82f6; --tint: rgba(59,130,246,.14); }
.cs.c-violet { --tc: #8b5cf6; --tint: rgba(139,92,246,.14); }
.cs.c-orange { --tc: #f59e0b; --tint: rgba(245,158,11,.16); }
.cs.c-green { --tc: #22a06b; --tint: rgba(34,160,107,.15); }
.cs.c-red { --tc: #e5484d; --tint: rgba(229,72,77,.14); }
/* Equilibre jauge / stats */
.car-row .ring .txt b, .cc .car-row .ring .txt b { font-size: 30px; }
.car-stats { border-radius: 16px; }
.car-stats .cs { gap: 10px; padding: 6px 12px; }
.car-stats .cs-ic { width: 30px; height: 30px; border-radius: 9px; }
.car-stats .cs-ic svg { width: 16px; height: 16px; }
.car-stats small { font-size: 11px; }
.car-stats b { font-size: 15px; }
.car-stats b small { font-size: 10px; }

/* Disques NAS cliquables */
button.nas-d { display: block; width: 100%; text-align: left; border: 0; font: inherit; color: inherit; cursor: pointer; transition: background .15s, opacity .15s; }
button.nas-d:not(.on) { opacity: .6; }
button.nas-d:not(.on) .nas-t b { color: var(--muted); }
button.nas-d:hover:not(:disabled) { background: var(--line); }
button.nas-d:disabled { cursor: default; }
button.nas-d.busy { opacity: 1; animation: nasPulse 1s ease-in-out infinite alternate; }
@keyframes nasPulse { to { background: var(--line); } }

/* ---------- Proxmox (iframe) ---------- */
.pve-wrap { position: relative; height: 100%; min-height: 420px; border-radius: 22px; overflow: hidden; background: var(--card, #1b1d1e); }
.pve-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.pve-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; pointer-events: none; }
.pve-open { position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); color: #fff; opacity: .55; transition: opacity .2s; }
.pve-open:hover { opacity: 1; }
.pve-open svg { width: 18px; height: 18px; }

/* Menu Domotique (groupe depliant) */
.nav-group .chev { margin-left: auto; font-size: 18px; transition: transform .2s; }
.nav-group.open .chev { transform: rotate(180deg); }
.nav-sub { display: none; flex-direction: column; gap: 2px; margin: 2px 0 4px 18px; padding-left: 10px; border-left: 2px solid var(--line); }
.nav-group.open .nav-sub { display: flex; }
.nav-sub a { padding: 8px 12px; gap: 12px; font-size: 14px; }
.nav-sub a i { font-size: 18px; }
@media (max-width: 1100px) {
  .nav-group .chev { display: none; }
  .nav-sub { margin: 2px 0; padding-left: 0; border-left: 0; }
}
@media (max-width: 760px) {
  .nav-group { display: flex; }
  .nav-group.open .nav-sub { flex-direction: row; }
}
.frame-local { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; pointer-events: auto; color: var(--muted); }
.frame-local svg { width: 34px; height: 34px; }
.frame-local b { color: var(--text); font-size: 17px; }
.frame-local .btn { margin-top: 6px; }

/* ---------- Reglages : mises a jour, serveur ---------- */
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.upd-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 6px; }
.upd-h b { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.upd-h .chip { padding: 2px 9px; font-size: 12px; }
.upd-ok { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 4px 0 0; }
.upd-sys-h { display: flex; align-items: center; gap: 7px; margin: 14px 0 6px; }
.upd-sys-h b { font-size: 13px; }
.upd-sys-h svg { color: var(--muted); }
.upd-sys-h small { color: var(--muted); font-size: 12px; }
.upd-ok svg { color: var(--ok); }
.upd-list .row { gap: 10px; }
.upd .r-main small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upd-v { color: var(--ok); font-weight: 600; }
.upd-link { color: var(--muted); font-size: 17px; padding: 6px; display: flex; }
.upd-st { font-size: 12px; white-space: nowrap; }
.upd-job { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.bar > i.indet { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
svg.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sys-btns { margin-top: 16px; }

.brand-h { display: flex; align-items: center; gap: 10px; }
.brand { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 19px; color: #fff; flex: none; }
.brand.ha { background: #18bcf2; }
.brand.pve { background: #e57000; font-size: 17px; }

.ha-st { display: inline-flex; align-items: center; gap: 8px; }
.led { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.led.ok { background: #2fd27a; box-shadow: 0 0 8px rgba(47, 210, 122, .7); }
.led.ko { background: #ff4d4d; box-shadow: 0 0 8px rgba(255, 77, 77, .7); }
.led.wait { background: #f2b53a; box-shadow: 0 0 8px rgba(242, 181, 58, .7); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }

.side-stat.ha-ko { background: rgba(229, 83, 75, .14); }
.side-stat.ha-ko .ss-ic { background: var(--hot); color: #fff; animation: blink 1.4s ease-in-out infinite; }
.side-stat.ha-ko b { color: var(--hot); }

.side-stat.upd .ss-ic { background: #18bcf2; color: #fff; }

.side-stat.rst { background: rgba(242, 181, 58, .14); }
.side-stat.rst .ss-ic { background: #f2b53a; color: #1b1c1b; }
.rst-box { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(242, 181, 58, .14); border: 1px solid rgba(242, 181, 58, .35); }
.rst-ic { width: 36px; height: 36px; border-radius: 11px; background: #f2b53a; color: #1b1c1b; display: grid; place-items: center; font-size: 19px; flex: none; }
.rst-t { flex: 1; min-width: 0; }
.rst-t b { display: block; font-size: 14px; }
.rst-t small { color: var(--muted); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ph-ranges { margin: 4px 0 12px; overflow-x: auto; }
.ph-ranges .seg { max-width: 100%; }
.ph-dates { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ph-dates label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.ph-dates input { font: inherit; color: var(--text); background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; color-scheme: inherit; }

/* ---------- Wallbox (carte unique) ---------- */
.wbx { position: relative; overflow: hidden; color: #1b1c1b; background: linear-gradient(145deg, #ffd27a 0%, #f7a94b 55%, #ef7f45 100%);
  --muted: rgba(27, 28, 27, .62); --text: #1b1c1b; --line: rgba(27, 28, 27, .12); --card-2: rgba(255, 255, 255, .45); }
.wbx > * { position: relative; }
.wbx .wbx-glow { position: absolute; width: 260px; height: 260px; right: -80px; top: -90px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 70%); pointer-events: none; }
.wbx .card-h h3 { display: flex; align-items: center; gap: 8px; }
.wbx .card-h h3 svg { font-size: 20px; }
.wbx .chip { background: rgba(255, 255, 255, .55); color: #1b1c1b; display: inline-flex; align-items: center; gap: 6px; }
.wbx-dot { width: 8px; height: 8px; border-radius: 50%; background: #1f9d55; box-shadow: 0 0 0 0 rgba(31, 157, 85, .6); animation: wbxPulse 1.6s infinite; }
@keyframes wbxPulse { 70% { box-shadow: 0 0 0 8px rgba(31, 157, 85, 0); } 100% { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0); } }
.wbx-main { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 14px; }
.wbx-p { font-size: 44px; font-weight: 650; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wbx-p .unit { font-size: 18px; color: rgba(27, 28, 27, .6); margin-left: 4px; }
.wbx-s { color: rgba(27, 28, 27, .65); font-size: 13px; margin-top: 2px; }
.wbx-bolt { width: 64px; height: 64px; border-radius: 22px; background: rgba(255, 255, 255, .5); display: grid; place-items: center; font-size: 34px; color: #c2410c; }
.wbx.charging .wbx-bolt { background: #1b1c1b; color: #ffd27a; animation: wbxBolt 1.8s ease-in-out infinite; }
@keyframes wbxBolt { 50% { transform: scale(1.06); } }
.wbx-seg { background: rgba(255, 255, 255, .45); }
.wbx-seg button { color: rgba(27, 28, 27, .7); }
.wbx-seg button.active { background: #1b1c1b; color: #fff; }
.wbx-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 14px; border-radius: 16px; overflow: hidden; background: rgba(27, 28, 27, .08); }
.wbx-stats > div { background: rgba(255, 255, 255, .42); padding: 11px 12px; min-width: 0; }
.wbx-stats b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.wbx-stats span { font-size: 11.5px; color: rgba(27, 28, 27, .6); }
.wbx-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.wbx-t { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: rgba(255, 255, 255, .62); border-radius: 14px; padding: 10px; min-width: 0; }
.wbx-t > div { min-width: 0; }
.wbx-t small { display: block; font-size: 11px; color: rgba(27, 28, 27, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wbx-t b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.wbx-ti { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; color: #fff; flex: none; }
.wbx-t.g .wbx-ti { background: #22a35a; }
.wbx-t.b .wbx-ti { background: #3b82f6; }
.wbx-t.v .wbx-ti { background: #8b5cf6; }
.wbx .wb-cur-h { margin-top: 16px; color: rgba(27, 28, 27, .7); }
.wbx .wb-cur-h b { color: #1b1c1b; }
.wbx .climit .gauge { background: rgba(255, 255, 255, .5); }
.wbx .climit .gauge > i { background: linear-gradient(90deg, #1f9d55, #1b1c1b); }
.wbx .climit-in::-webkit-slider-thumb { background: #1b1c1b; border: 3px solid #fff; }
.wbx .climit-in::-moz-range-thumb { background: #1b1c1b; border: 3px solid #fff; }
.wbx-scale { display: flex; justify-content: space-between; font-size: 11px; color: rgba(27, 28, 27, .55); margin-top: 6px; }

#theme-menu { position: fixed; z-index: 60; min-width: 230px; padding: 6px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0, 0, 0, .28); animation: pop .15s ease-out; }
#theme-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; text-align: left; }
#theme-menu button:hover { background: var(--card-2); }
#theme-menu button.on { background: var(--card-2); }
#theme-menu button > svg:first-child { font-size: 19px; color: var(--muted); }
#theme-menu button.on > svg:first-child { color: var(--text); }
#theme-menu span { flex: 1; }
#theme-menu b { display: block; font-size: 14px; font-weight: 600; }
#theme-menu small { display: block; font-size: 11.5px; color: var(--muted); }
#theme-menu button > svg:last-child:not(:first-child) { color: var(--ok); font-size: 17px; }
/* Cartes machine (Home Assistant / Proxmox) */
.host .list .row:last-child { border-bottom: 1px solid var(--line); }
.hgs { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.hg-h { display: flex; align-items: center; gap: 10px; }
.hg-h b { font-size: 14px; font-weight: 600; flex: 1; }
.hg-ic { width: 30px; height: 30px; border-radius: 10px; background: var(--card-2); display: grid; place-items: center; font-size: 17px; flex: none; }
.hg-v { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.hg .bar { height: 8px; margin-top: 8px; }
.host + .host { margin-top: 18px; }

.host-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip.conn { background: var(--card-2); color: var(--text); }
.chip.conn.ko { background: rgba(229, 83, 75, .14); color: var(--hot); }

.homelab-art { margin-top: 26px; height: 340px; background: url(../img/homelab.svg) center bottom / contain no-repeat; opacity: .9;
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 50% 55%, #000 45%, transparent 100%); mask-image: radial-gradient(ellipse 70% 75% at 50% 55%, #000 45%, transparent 100%); }
html:not([data-theme="dark"]) .homelab-art { opacity: .8; }
@media (max-width: 900px) { .homelab-art { display: none; } }

/* ---------- Accueil 2 : pieces + chauffage ---------- */
.house .card-h { margin-bottom: 6px; }
.hs-chips { display: flex; gap: 6px; }
.hs-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; background: var(--card-2); font-size: 13px; font-weight: 600; color: var(--muted); }
.hs-chip.heat { background: rgba(255, 138, 61, .15); color: #e8742a; }
.hs-chip.lit { background: var(--on-soft); color: #b77a12; }
.hs-acts { display: flex; gap: 8px; margin: 4px 0 14px; }
.hs-list { display: flex; flex-direction: column; gap: 10px; }
.hs-row { display: flex; align-items: stretch; gap: 10px; padding: 10px; border-radius: 22px; background: var(--card-2); cursor: pointer; transition: box-shadow .2s; }
.hs-row:hover { box-shadow: inset 0 0 0 1px var(--line); }
.hs-row.off { opacity: .5; }
.hs-left { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px 2px; }
.hs-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: var(--card); flex: none; transition: background .2s, box-shadow .2s; }
.hs-ic.tap { cursor: pointer; }
.hs-row.lit .hs-ic { background: var(--yellow); color: #1b1c1b; box-shadow: 0 0 0 4px rgba(242, 213, 140, .25); }
.hs-main { min-width: 0; }
.hs-main > b { display: flex; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.hs-vals { display: flex; align-items: baseline; gap: 12px; margin-top: 2px; }
.hs-temp { font-size: 26px; font-weight: 300; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hs-temp span { color: var(--muted); font-size: .6em; vertical-align: top; margin-left: 1px; }
.hs-hum, .hs-lit { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; color: var(--muted); }
.hs-hum svg { color: #6ab7e6; }
.hs-lit svg { color: #e0a93b; }
.hs-flag { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; font-size: 13px; background: var(--card); color: var(--muted); }
.hs-flag.pres { background: var(--mint); color: #1b1c1b; }
.hs-flag.badge.open { background: rgba(229, 83, 75, .16); color: var(--hot); }
.hs-flag.badge.na { opacity: .4; }
.hs-heat { flex: none; width: 196px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: var(--card); }
.hs-heat.none { background: transparent; }
.hs-heat.on { background: linear-gradient(135deg, rgba(255, 138, 61, .10), var(--card)); }
.hs-heat.heating { background: linear-gradient(135deg, rgba(255, 138, 61, .28), rgba(255, 138, 61, .08)); box-shadow: inset 0 0 0 1px rgba(255, 138, 61, .35); }
.hs-pw { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--card-2); color: var(--faint); flex: none; }
.hs-heat.on .hs-pw { color: #ff8a3d; }
.hs-heat.heating .hs-pw { background: #ff8a3d; color: #fff; box-shadow: 0 0 14px rgba(255, 138, 61, .5); }
button.hs-pw:active { transform: scale(.92); }
.hs-set { flex: 1; min-width: 0; }
.hs-set small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.hs-heat.heating .hs-set small { color: #e8742a; }
.hs-th { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.hs-th b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hs-heat.on .hs-th b { color: #e8742a; }
.hs-th button { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: var(--card-2); }
.hs-th button:active { transform: scale(.9); }
.hs-off { display: block; font-size: 14px; font-weight: 600; color: var(--faint); margin-top: 2px; }
/* Alerte Tado hors ligne (tete ou sonde) */
.hs-flag.ko { background: rgba(229, 83, 75, .18); color: var(--hot); }
.hs-row.off .hs-flag.ko, .hs-row.off .hs-off { opacity: 1; }
.hs-heat.na .hs-off { color: var(--hot); }
@media (max-width: 1350px) { .hs-heat { width: 168px; } .hs-temp { font-size: 22px; } }

.hs-main { flex: 1; overflow: hidden; }
.hs-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.hs-main > b .hs-flag { flex: none; }
.hs-flag { flex: none; }
.hs-vals { overflow: hidden; gap: 8px; }
.hs-hum, .hs-lit { white-space: nowrap; }
.hs-left { gap: 10px; }
.hs-ic { width: 38px; height: 38px; font-size: 19px; border-radius: 12px; }
.hs-heat { width: 150px; gap: 8px; padding: 7px 8px; }
.hs-pw { width: 32px; height: 32px; font-size: 18px; border-radius: 10px; }
.hs-th b { font-size: 15px; }
.hs-th button { width: 24px; height: 24px; font-size: 13px; }
.hs-set small { font-size: 10px; }
.hs-off { font-size: 13px; }
@media (max-width: 1350px) { .hs-heat { width: 140px; } .hs-temp { font-size: 22px; } }
@media (min-width: 1700px) { .hs-heat { width: 190px; } .hs-ic { width: 44px; height: 44px; font-size: 22px; } }
.hs-chip.open { background: rgba(229, 83, 75, .15); color: var(--hot); }
svg.has-sel g[data-i] { opacity: .35; transition: opacity .2s; }
svg.has-sel g.sel-bar { opacity: 1; }

.sel-chip { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; background: var(--dark); color: var(--on-dark); }
.sel-chip svg { font-size: 14px; opacity: .7; }

/* ---------- Selecteur de periode (Energie) ---------- */
.ebar { display: flex; align-items: center; gap: 6px; background: var(--card-2); border-radius: 999px; padding: 4px; }
.ebar-l { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.ebar-l svg { font-size: 18px; color: var(--muted); }
.ebar-l:hover { background: var(--card); }
.ebar-now { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(240, 154, 50, .18); color: #e8902d; }
.ebar-now.dis { opacity: .45; }
.ebar-a { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; }
.ebar-a:hover { background: var(--card); }
.ebar-a[disabled] { opacity: .3; pointer-events: none; }
#epick { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
#epick .ep-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }
.ep-box { position: relative; width: min(560px, 94vw); background: var(--card); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); overflow: hidden; animation: pop .15s ease-out; }
.ep-main { display: flex; }
.ep-presets { display: flex; flex-direction: column; padding: 10px 0; border-right: 1px solid var(--line); min-width: 170px; }
.ep-presets button { text-align: left; padding: 11px 22px; font-size: 14px; white-space: nowrap; }
.ep-presets button:hover { background: var(--card-2); }
.ep-presets button.on { color: #e8902d; font-weight: 600; }
.ep-cal { flex: 1; padding: 14px 16px; }
.ep-h { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ep-h b { flex: 1; text-align: center; font-size: 15px; font-weight: 600; }
.ep-h button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; }
.ep-h button:hover { background: var(--card-2); }
.ep-w, .ep-g { display: grid; grid-template-columns: repeat(7, 1fr); }
.ep-w span { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 0; }
.ep-d { height: 40px; display: grid; place-items: center; font-size: 14px; position: relative; }
.ep-d span { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; position: relative; z-index: 1; }
.ep-d:hover span { background: var(--card-2); }
.ep-d.out { color: var(--faint); }
.ep-d.fut { color: var(--faint); opacity: .5; }
.ep-d.today span { box-shadow: inset 0 0 0 1px #e8902d; }
.ep-d.mid { background: rgba(240, 154, 50, .16); }
.ep-d.s { background: linear-gradient(90deg, transparent 50%, rgba(240, 154, 50, .16) 50%); }
.ep-d.e { background: linear-gradient(90deg, rgba(240, 154, 50, .16) 50%, transparent 50%); }
.ep-d.end span { background: #f09a32; color: #fff; font-weight: 700; }
.ep-f { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ep-cancel { padding: 10px 18px; border-radius: 999px; color: #e8902d; font-weight: 600; }
.ep-ok { padding: 10px 22px; border-radius: 999px; background: #f09a32; color: #fff; font-weight: 600; }
@media (max-width: 600px) { .ep-main { flex-direction: column; } .ep-presets { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); } }

/* Pousse des barres au changement de periode */
svg.chart.grow g[data-i] { transform-box: fill-box; transform-origin: 50% 100%; animation: barGrow .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--d, 0ms); }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.dev-rank.grow .bar > i { animation: rankGrow .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--d, 0ms); transform-origin: 0 50%; }
@keyframes rankGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Deshumidificateur ---------- */
.dehum.on { background: linear-gradient(160deg, rgba(106, 183, 230, .16), var(--card) 60%); }
.dh-alert { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 14px; background: rgba(229, 83, 75, .15); color: var(--hot); font-weight: 600; font-size: 13px; margin-bottom: 12px; }
.dh-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dh-hum { display: flex; align-items: center; gap: 12px; }
.dh-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--card-2); color: #6ab7e6; }
.dehum.on .dh-ic { background: #6ab7e6; color: #fff; }
.dh-hum small, .dh-set small, .dh-lbl { display: block; font-size: 12px; color: var(--muted); }
.dh-hum b { font-size: 32px; font-weight: 300; line-height: 1; letter-spacing: -.02em; }
.dh-hum b span { font-size: .5em; color: var(--muted); margin-left: 2px; }
.dh-set { text-align: right; }
.dh-step { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.dh-step b { min-width: 48px; text-align: center; font-size: 18px; font-weight: 700; color: #6ab7e6; }
.dh-step button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); font-size: 16px; }
.dh-step button[disabled] { opacity: .35; }
.dh-sub { display: flex; gap: 16px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.dh-sub span { display: inline-flex; align-items: center; gap: 4px; }
.dh-lbl { margin: 14px 0 6px; }
.dh-seg button { font-size: 13px; padding: 8px 4px; }

.dh-set b { display: block; font-size: 24px; font-weight: 600; color: #6ab7e6; line-height: 1.1; margin-top: 2px; }
.dh-gauge { margin-top: 16px; }
.dh-gauge .gauge { background: var(--card-2); }
.dh-gauge .gauge > i { background: linear-gradient(90deg, #9fd3f2, #4a9fd8); }
.dh-gauge .climit-mark { background: var(--text); }
.dh-gauge.dis { opacity: .45; }
.dh-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 8px; }

/* Temperatures + Lumieres cote a cote */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: inherit; gap: 18px; align-items: stretch; }
.duo > .card { margin: 0; min-width: 0; }
.duo .temp-pair { grid-template-columns: 1fr; display: grid; gap: 10px; }
.duo .chips { gap: 6px; }
.duo .chip-btn { padding: 7px 11px; font-size: 12.5px; }
.duo .lit-off { padding: 11px 12px; font-size: 13px; }
@media (max-width: 700px) { .duo { grid-template-columns: 1fr; } }
.duo { gap: 12px; }
.duo > .card { padding: 16px; }
.duo .card-h { margin-bottom: 10px; }
.duo .card-h h3 { font-size: 15px; }
.duo .card-h .arrow { width: 30px; height: 30px; font-size: 16px; }
.duo .temp-pair { margin-bottom: 0; }
.duo .temp-pair > div { padding: 10px 12px; }
.duo .temp-pair .big { font-size: 24px; }
.duo .chip-btn { white-space: nowrap; }
.duo .lit-off { white-space: nowrap; }
.duo .pill-count { min-width: 26px; height: 26px; font-size: 13px; }
.dh-statbtn { margin-top: 14px; }
.dh-ms { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .dh-ms { grid-template-columns: repeat(2, 1fr); } }
.dev-eur { color: var(--muted); font-weight: 600; }
.unit-sw .seg { padding: 3px; }
.unit-sw .seg button { padding: 4px 8px; font-size: 12px; }
.legend .unit-sw { margin-left: 12px; }
.chart .b-eur { fill: #f4b860; }
