/* Maison connectée — Académie de Bordeaux */

:root {
  --bg: #e8eef4;
  --surface: #ffffff;
  --desk: #f4f7fa;
  --border: #c5d0dc;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --ok: #16a34a;
  --err: #dc2626;
  --warn: #d97706;
  --light: #fbbf24;
  --app: #f3f8fc;
  --app-card: #ffffff;
  --app-accent: #13a3d8;
  --app-text: #13293d;
  --cat-user: #7c3aed;
  --cat-data: #ea580c;
  --cat-object: #2563eb;
  --cat-env: #16a34a;
  --font: "Instrument Sans", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --desk: #273449;
  --border: #475569;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-soft: #1e3a5f;
  --app: #0f1d2b;
  --app-card: #182b3d;
  --app-text: #e6f1fa;
}

*, *::before, *::after { box-sizing: border-box; }

body.mc-app {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
}

button { font-family: inherit; }
[hidden] { display: none !important; }

/* ---------- En-tête ---------- */
.mc-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 3px solid var(--accent);
}

.mc-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.mc-brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
  color: #fff;
  font-size: 0.95rem;
}

.mc-steps {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--desk);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.mc-step {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.9rem 0.3rem 0.35rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.mc-step__num {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: var(--border);
  color: var(--surface);
  font-weight: 700;
  font-size: 0.85rem;
}

.mc-step__text {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.15;
}

.mc-step__text small { font-weight: 400; font-size: 0.7rem; }

.mc-step.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.mc-step.is-active .mc-step__num { background: var(--accent); }

.mc-header-actions {
  justify-self: end;
  display: flex;
  gap: 0.4rem;
}

.mc-btn {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

.mc-btn:hover { border-color: var(--accent); }
.mc-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.mc-btn--sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.mc-btn--icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

.mc-menu { position: relative; }

.mc-menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 300;
  min-width: 15rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.mc-menu__list button,
.mc-menu__list a {
  display: block;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 0.86rem;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.mc-menu__list button:hover,
.mc-menu__list a:hover { background: var(--desk); }

.mc-menu__list hr { margin: 0.3rem 0; border: none; border-top: 1px solid var(--border); }

/* ---------- Missions ---------- */
.mc-mission {
  margin: 0.75rem 1rem 0;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.mc-mission__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.mc-mission__tag {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.mc-mission__title { margin: 0.1rem 0 0.2rem; font-size: 1.1rem; }
.mc-mission__intro { margin: 0; font-size: 0.85rem; color: var(--muted); line-height: 1.45; }

.mc-mission__score {
  flex-shrink: 0;
  margin: 0;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--desk);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.mc-mission__score strong { color: var(--text); }

.mc-mission__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.mc-m {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--desk);
  font-size: 0.82rem;
  line-height: 1.35;
}

.mc-m__num {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--border);
  color: var(--surface);
  font-size: 0.75rem;
  font-weight: 700;
}

.mc-m.is-done {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
}

.mc-m.is-done .mc-m__num { background: var(--ok); }

/* ---------- Disposition ---------- */
.mc-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 1rem;
  padding: 0.75rem 1rem 1.5rem;
  align-items: start;
}

.mc-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.mc-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.6rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--desk);
}

.mc-tab {
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.mc-tab.is-active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  margin-bottom: -1px;
}

.mc-view { padding: 0.9rem; }
.mc-view-intro { margin: 0 0 0.6rem; font-size: 0.84rem; color: var(--muted); }

/* ---------- La maison ---------- */
.mc-house-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.mc-location {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.mc-location button {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.mc-location button.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.mc-power { margin: 0; font-size: 0.84rem; color: var(--muted); }
.mc-power strong { color: var(--text); font-variant-numeric: tabular-nums; }

.mc-away {
  margin: 0 0 0.7rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border));
  font-size: 0.82rem;
  color: var(--text);
}

.mc-house {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.6rem;
  padding: 0.6rem;
  border-radius: 10px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--border) 30%, transparent) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(color-mix(in srgb, var(--border) 30%, transparent) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--desk);
}

.mc-room {
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.mc-room--salon { grid-column: span 4; }
.mc-room--cuisine { grid-column: span 2; }
.mc-room--chambre { grid-column: span 3; }
.mc-room--bureau { grid-column: span 3; }
.mc-room--entree { grid-column: span 6; }

.mc-room h3 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.mc-room__lamps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.mc-lamp {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 9.5rem;
  padding: 0.5rem 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--desk);
  transition: background 0.3s, box-shadow 0.3s;
}

.mc-lamp.is-lit {
  background: color-mix(in srgb, var(--light) 16%, var(--surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--light) 50%, transparent), 0 6px 18px color-mix(in srgb, var(--light) 25%, transparent);
}

.mc-lamp__num {
  position: absolute;
  top: 0.35rem;
  left: 0.4rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  font-size: 0.8rem;
  font-weight: 700;
}

.mc-lamp__name { margin: 0; font-size: 0.8rem; font-weight: 700; }
.mc-lamp__name small { font-weight: 400; color: var(--muted); }

.mc-bulb { width: 3.4rem; height: 3.4rem; overflow: visible; }
.mc-bulb__halo { fill: var(--light); opacity: 0; transition: opacity 0.3s; }
.mc-bulb.is-lit .mc-bulb__halo { opacity: calc(var(--glow) * 0.35); }
.mc-bulb__glass { fill: color-mix(in srgb, var(--border) 50%, var(--surface)); stroke: var(--muted); stroke-width: 1.5; transition: fill 0.3s; }
.mc-bulb.is-lit .mc-bulb__glass { fill: color-mix(in srgb, var(--light) calc(var(--glow) * 100%), #fff8dc); stroke: #d4a00b; }
.mc-bulb__base { fill: #94a3b8; }

.mc-socket {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border: 2px dashed var(--border);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  line-height: 1.1;
}

.mc-switch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.55rem 0.25rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.74rem;
  color: var(--text);
  cursor: pointer;
}

.mc-switch:disabled { cursor: not-allowed; opacity: 0.55; }

.mc-switch__rocker {
  position: relative;
  width: 1rem;
  height: 1.5rem;
  border: 1px solid var(--muted);
  border-radius: 3px;
  background: var(--desk);
}

.mc-switch__rocker::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 45%;
  border-radius: 2px;
  background: var(--muted);
  transition: transform 0.15s;
}

.mc-switch.is-on .mc-switch__rocker::after {
  transform: translateY(calc(-100% - 2px));
  background: var(--ok);
}

.mc-plug {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--app-accent) 12%, var(--surface));
  font-size: 0.7rem;
  color: var(--text);
  text-align: center;
}

.mc-plug.is-on .mc-ico { color: var(--ok); }

.mc-link {
  padding: 0;
  border: none;
  background: none;
  font-size: 0.72rem;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.mc-ico { width: 1.6rem; height: 1.6rem; }
.mc-ico--sm { width: 1rem; height: 1rem; }

.mc-boxnet {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 12.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.78rem;
}

.mc-boxnet__body { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; }

.mc-boxnet__led {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--err);
}

.mc-boxnet__led.is-ok { background: var(--ok); }
.mc-boxnet__led.is-warn { background: var(--warn); }

.mc-boxnet.is-busy .mc-boxnet__led { animation: mc-blink 0.25s steps(2) 4; }

@keyframes mc-blink { 50% { background: #fff; } }

.mc-boxnet__sticker {
  margin: 0;
  padding: 0.3rem 0.45rem;
  border: 1px dashed var(--border);
  border-radius: 4px;
  background: var(--desk);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.45;
}

.mc-boxnet__ctrl { display: flex; gap: 0.3rem; }

.mc-chip {
  flex: 1;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--desk);
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
}

.mc-chip.is-on { border-color: var(--ok); color: var(--ok); font-weight: 600; }

.mc-flow { margin-top: 0.8rem; }

.mc-flow h2 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.mc-flow__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
}

.mc-flow__list li {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1.3fr) minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--desk);
}

.mc-flow__list time { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.mc-flow__data { color: var(--cat-data); font-weight: 600; }
.mc-flow__list small { color: var(--cat-env); }
.mc-flow__list .mc-flow__empty { display: block; color: var(--muted); border: none; }

/* ---------- Schéma ---------- */
.mc-schema svg { width: 100%; height: auto; display: block; }

.mc-node rect { stroke-width: 2; }
.mc-node--user rect { fill: color-mix(in srgb, var(--cat-user) 12%, var(--surface)); stroke: var(--cat-user); }
.mc-node--object rect { fill: color-mix(in srgb, var(--cat-object) 10%, var(--surface)); stroke: var(--cat-object); }
.mc-node--env rect { fill: color-mix(in srgb, var(--cat-env) 12%, var(--surface)); stroke: var(--cat-env); }
.mc-node.is-dim { opacity: 0.35; }

.mc-node__t { font: 700 14px var(--font); fill: var(--text); text-anchor: middle; }
.mc-node__s { font: 12px var(--font); fill: var(--muted); text-anchor: middle; }

.mc-arrow { fill: none; stroke-width: 2.5; }
.mc-arrow--data { stroke: var(--cat-data); }
.mc-arrow--back { stroke: var(--cat-data); stroke-dasharray: 6 5; }
.mc-arrow--energy { stroke: var(--cat-env); }
.mc-head--data { fill: var(--cat-data); }
.mc-head--env { fill: var(--cat-env); }

.mc-arrow__label { font: 600 12px var(--font); text-anchor: middle; }
.mc-arrow__label--data { fill: var(--cat-data); }
.mc-arrow__label--env { fill: var(--cat-env); }

.mc-schema.is-anim-wifi .flow-wifi,
.mc-schema.is-anim-wifi .flow-both,
.mc-schema.is-anim-internet .flow-internet,
.mc-schema.is-anim-internet .flow-both {
  stroke-width: 4;
  stroke-dasharray: 10 8;
  animation: mc-dash 0.6s linear infinite;
}

@keyframes mc-dash { to { stroke-dashoffset: -18; } }

.mc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
}

.mc-legend li { display: flex; align-items: center; gap: 0.35rem; }
.mc-dot { width: 0.8rem; height: 0.8rem; border-radius: 3px; }
.mc-dot--user { background: var(--cat-user); }
.mc-dot--data { background: var(--cat-data); }
.mc-dot--object { background: var(--cat-object); }
.mc-dot--env { background: var(--cat-env); }

/* ---------- Boutique ---------- */
.mc-cdc {
  margin-bottom: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--desk);
}

.mc-cdc summary {
  padding: 0.55rem 0.75rem;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
}

.mc-cdc__body { padding: 0 0.75rem 0.75rem; }

.mc-cdc__root {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0 auto 0.6rem;
  max-width: 30rem;
  padding: 0.45rem 0.7rem;
  border: 2px solid #7aa7d8;
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.8rem;
  text-align: center;
}

.mc-cdc__branches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.mc-cdc__b {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--surface);
  border: 2px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.4;
}

.mc-cdc__b--prog { border-color: #f0a37a; }
.mc-cdc__b--net { border-color: #e9c84a; }
.mc-cdc__b--light { border-color: #7cc28a; }

.mc-shop {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.7rem;
}

.mc-product {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.mc-product__img {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0.8rem;
  background: var(--desk);
}

.mc-product__img .mc-bulb { width: 4.4rem; height: 4.4rem; }

.mc-product__num {
  position: absolute;
  top: 0.45rem;
  left: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 0.74rem;
  font-weight: 700;
}

.mc-product__body { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.65rem 0.75rem 0.75rem; }
.mc-product h3 { margin: 0; font-size: 0.92rem; }
.mc-product__brand { margin: 0; font-size: 0.78rem; color: var(--muted); }
.mc-product__extra { margin: 0; font-size: 0.76rem; color: var(--muted); }
.mc-product .mc-btn { align-self: flex-start; }

.mc-specs { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.mc-specs th { text-align: left; font-weight: 500; color: var(--muted); padding: 0.18rem 0.5rem 0.18rem 0; white-space: nowrap; }
.mc-specs td { padding: 0.18rem 0; font-weight: 600; }
.mc-specs tr + tr { border-top: 1px solid var(--desk); }

.mc-energy {
  display: inline-block;
  min-width: 1.6rem;
  padding: 0 0.4rem;
  border-radius: 3px 10px 10px 3px;
  color: #fff;
  font-weight: 800;
  text-align: center;
}

/* ---------- Tablette ---------- */
.mc-tablet-wrap { position: sticky; top: 0.75rem; }

.mc-tablet {
  padding: 0.9rem 0.75rem 1.2rem;
  border-radius: 28px;
  background: #1f2937;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28), inset 0 0 0 2px #374151;
}

.mc-tablet__status {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.6rem 0.45rem;
  font-size: 0.72rem;
  color: #cbd5e1;
}

.mc-net--ok { color: #86efac; }
.mc-net--remote { color: #93c5fd; }
.mc-net--off { color: #fca5a5; }

.mc-app-screen {
  min-height: 560px;
  max-height: 72vh;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 16px;
  background: var(--app);
  color: var(--app-text);
}

.mc-tablet-caption { margin: 0.5rem 0 0; font-size: 0.74rem; color: var(--muted); text-align: center; }

.mc-a-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.7rem; }
.mc-a-top h2 { margin: 0; font-size: 1.35rem; }
.mc-a-hello { margin: 0; font-size: 0.78rem; color: color-mix(in srgb, var(--app-text) 60%, transparent); }

.mc-a-add {
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 50%;
  background: var(--app-accent);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--app-accent) 40%, transparent);
}

.mc-a-chips {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}

.mc-a-chip {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  border: none;
  border-radius: 999px;
  background: var(--app-card);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--app-text);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.mc-a-chip.is-active { background: var(--app-accent); color: #fff; }

.mc-a-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: 12px;
  background: var(--app-card);
  font-size: 0.8rem;
}

.mc-a-group div { display: flex; gap: 0.3rem; }

.mc-a-groupbtn {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--app-accent);
  border-radius: 999px;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--app-accent);
  cursor: pointer;
}

.mc-a-groupbtn:disabled { opacity: 0.4; cursor: default; }

.mc-a-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.mc-dev {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 7.6rem;
  padding: 0.75rem;
  border-radius: 16px;
  background: var(--app-card);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  transition: background 0.2s;
}

.mc-dev.is-on { background: color-mix(in srgb, var(--app-accent) 14%, var(--app-card)); }
.mc-dev.is-offline { opacity: 0.6; }

.mc-dev__icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.25rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--app-accent) 12%, transparent);
  color: color-mix(in srgb, var(--app-accent) 60%, var(--app-text));
}

.mc-dev.is-on .mc-dev__icon { background: var(--app-accent); color: #fff; }

.mc-dev__name { font-weight: 700; font-size: 0.86rem; line-height: 1.2; }
.mc-dev__room { font-size: 0.72rem; color: color-mix(in srgb, var(--app-text) 55%, transparent); }
.mc-dev__state { margin-top: auto; font-size: 0.72rem; font-weight: 700; color: var(--app-accent); }
.mc-dev__state--off { color: var(--err); }

.mc-power-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--app-text) 10%, transparent);
  color: var(--app-text);
  font-size: 0.95rem;
  cursor: pointer;
}

.mc-power-btn.is-on { background: var(--app-accent); color: #fff; }

.mc-a-empty { margin: 2rem 0; text-align: center; font-size: 0.86rem; color: color-mix(in srgb, var(--app-text) 60%, transparent); }

.mc-a-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }

.mc-a-back {
  padding: 0.3rem 0.5rem;
  border: none;
  background: none;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--app-accent);
  cursor: pointer;
}

.mc-a-stepnum { font-size: 0.76rem; color: color-mix(in srgb, var(--app-text) 60%, transparent); }

.mc-a-detail { display: flex; flex-direction: column; align-items: center; text-align: center; }
.mc-a-detail h2 { margin: 0.5rem 0 0; font-size: 1.2rem; }
.mc-a-sub { margin: 0.2rem 0 0.8rem; font-size: 0.82rem; color: color-mix(in srgb, var(--app-text) 60%, transparent); line-height: 1.45; }

.mc-a-bigicon {
  display: grid;
  place-items: center;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--app-accent) 12%, transparent);
  color: color-mix(in srgb, var(--app-accent) 60%, var(--app-text));
}

.mc-a-bigicon .mc-ico { width: 2.6rem; height: 2.6rem; }
.mc-a-detail.is-on .mc-a-bigicon { background: var(--app-accent); color: #fff; box-shadow: 0 0 0 10px color-mix(in srgb, var(--app-accent) 18%, transparent); }

.mc-a-bigpower {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 5.5rem;
  height: 5.5rem;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--app-card);
  font-size: 1.6rem;
  color: var(--app-text);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.mc-a-bigpower span { font-size: 0.75rem; font-weight: 700; }
.mc-a-bigpower.is-on { background: var(--app-accent); color: #fff; }

.mc-a-dim {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: 100%;
  margin-top: 1rem;
  font-size: 0.82rem;
  text-align: left;
}

.mc-a-dim input { width: 100%; accent-color: var(--app-accent); }

.mc-a-offline { margin: 0.4rem 0; color: var(--err); font-weight: 700; }

.mc-a-tips {
  margin: 0 0 0.6rem;
  padding: 0.6rem 0.8rem 0.6rem 1.8rem;
  border-radius: 12px;
  background: var(--app-card);
  font-size: 0.8rem;
  text-align: left;
  line-height: 1.5;
}

.mc-a-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.8rem;
  width: 100%;
  margin: 1.1rem 0 0;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: var(--app-card);
  font-size: 0.78rem;
  text-align: left;
}

.mc-a-info dt { color: color-mix(in srgb, var(--app-text) 55%, transparent); }
.mc-a-info dd { margin: 0; font-weight: 600; }

.mc-a-h { margin: 0.2rem 0 0.2rem; font-size: 1.15rem; }

.mc-a-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.mc-a-field input,
.mc-a-field select {
  padding: 0.55rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--app-text) 18%, transparent);
  border-radius: 10px;
  background: var(--app-card);
  font: inherit;
  font-weight: 400;
  color: var(--app-text);
}

.mc-a-label { margin: 0 0 0.35rem; font-size: 0.8rem; font-weight: 600; }

.mc-a-icons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.mc-a-iconbtn {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--app-card);
  color: color-mix(in srgb, var(--app-accent) 60%, var(--app-text));
  cursor: pointer;
}

.mc-a-iconbtn.is-active { border-color: var(--app-accent); background: color-mix(in srgb, var(--app-accent) 14%, var(--app-card)); }

.mc-a-primary,
.mc-a-danger {
  display: block;
  width: 100%;
  padding: 0.7rem;
  border: none;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.mc-a-primary { background: var(--app-accent); color: #fff; margin-bottom: 0.6rem; }
.mc-a-primary:disabled { opacity: 0.5; cursor: default; }
.mc-a-danger { background: transparent; color: var(--err); }

.mc-a-types { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

.mc-a-types button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.1rem 0.5rem;
  border: none;
  border-radius: 16px;
  background: var(--app-card);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--app-text);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.mc-a-types .mc-ico { width: 2.2rem; height: 2.2rem; color: var(--app-accent); }

.mc-a-search { font-size: 0.84rem; color: var(--app-accent); font-weight: 600; text-align: center; }

.mc-a-found,
.mc-a-wifi {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin-bottom: 0.45rem;
  padding: 0.65rem 0.8rem;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--app-card);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--app-text);
  text-align: left;
  cursor: pointer;
}

.mc-a-found small,
.mc-a-wifi small { margin-left: auto; font-weight: 400; font-size: 0.74rem; color: color-mix(in srgb, var(--app-text) 55%, transparent); }
.mc-a-found .mc-ico { color: var(--app-accent); }
.mc-a-wifi.is-active { border-color: var(--app-accent); }
.mc-a-wifis { margin-bottom: 0.6rem; }

.mc-a-notfound {
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--err) 10%, var(--app-card));
  font-size: 0.8rem;
  line-height: 1.5;
}

.mc-a-notfound ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }

.mc-a-error {
  margin: -0.3rem 0 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--err) 12%, var(--app-card));
  color: var(--err);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.45;
}

/* ---------- Message, fenêtre ---------- */
.mc-toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  z-index: 600;
  max-width: min(92vw, 34rem);
  padding: 0.65rem 1rem;
  border-radius: 10px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.86rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
  transform: translateX(-50%);
}

.mc-toast--err { background: #991b1b; }

.mc-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.mc-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(3px); }

.mc-modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.mc-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.mc-modal__head h2 { margin: 0; font-size: 1.05rem; }

.mc-modal__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--desk);
  color: var(--muted);
  cursor: pointer;
}

.mc-modal__body { overflow-y: auto; padding: 1rem 1.1rem 1.2rem; font-size: 0.9rem; line-height: 1.5; }
.mc-modal__body p { margin: 0 0 0.8rem; }
.mc-muted { color: var(--muted); font-size: 0.84rem; }
.mc-bad { color: var(--err); }

.mc-q-lamps { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }

.mc-q-lamp {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--desk);
  cursor: pointer;
}

.mc-q-table { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.8rem; }

.mc-q-table label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.86rem;
}

.mc-q-table select {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
  font-size: 0.82rem;
  color: var(--text);
}

.mc-q-table select.is-wrong { border-color: var(--err); background: color-mix(in srgb, var(--err) 8%, var(--surface)); }
.mc-q-table select.is-right { border-color: var(--ok); }

.mc-q-radios { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.8rem; }

.mc-q-radios label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--desk);
  cursor: pointer;
}

.mc-q-result { padding: 0.6rem 0.75rem; border-radius: 8px; font-size: 0.86rem; }
.mc-q-result.is-ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); }
.mc-q-result.is-bad { background: color-mix(in srgb, var(--err) 10%, var(--surface)); color: var(--err); }
.mc-q-actions { display: flex; justify-content: flex-end; }

.mc-choice-list { display: flex; flex-direction: column; gap: 0.5rem; }

.mc-choice {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--desk);
  font-size: 0.86rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.mc-choice:hover { border-color: var(--accent); }
.mc-choice .mc-bulb { width: 2.6rem; height: 2.6rem; flex-shrink: 0; }

.mc-help { margin: 0 0 0.8rem; padding-left: 1.2rem; }
.mc-help li + li { margin-top: 0.4rem; }

.app-version {
  position: fixed;
  left: 0.6rem;
  bottom: 0.4rem;
  font-size: 0.7rem;
  color: var(--muted);
}

/* ---------- Écrans étroits (tablettes) ---------- */
@media (max-width: 1100px) {
  .mc-main { grid-template-columns: 1fr; }
  .mc-tablet-wrap { position: static; max-width: 460px; margin: 0 auto; width: 100%; }
}

@media (max-width: 760px) {
  .mc-header { grid-template-columns: 1fr auto; }
  .mc-steps { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .mc-step__text small { display: none; }
  .mc-house { grid-template-columns: 1fr 1fr; }
  .mc-room { grid-column: span 2 !important; }
  .mc-cdc__branches { grid-template-columns: 1fr; }
  .mc-q-table label { grid-template-columns: 1fr; }
  .mc-flow__list li { grid-template-columns: 1fr; gap: 0.1rem; }
}
