#home-map { --hm-line: #becdc6; --hm-board: #eff3ef; --hm-wall: #536c63; }
.hm-toolbar, .hm-layout-actions, .hm-modes { display: flex; align-items: center; }
.hm-toolbar { justify-content: space-between; gap: .7rem 1rem; flex-wrap: wrap; margin-bottom: .95rem; }
.hm-layout-actions { gap: .45rem; flex-wrap: wrap; }
#home-map button, #home-map select { font: inherit; }
.hm-toolbar button, .hm-plan-head button, .hm-section-head button, .hm-sheet-top button {
  min-height: 2.75rem; border: 1px solid var(--line); border-radius: .55rem;
  padding: .45rem .78rem; font-weight: 600 !important; background: white; color: var(--ink);
}
.hm-toolbar button:hover, .hm-section-head button:hover { border-color: #789383; }
.hm-modes { padding: .18rem; border: 1px solid #d4ddd2; border-radius: .65rem; background: #e9eee6; }
.hm-modes button { background: none; border-color: transparent; }
.hm-modes [aria-pressed="true"] { background: var(--ink); color: white; }
.hm-layout-actions [data-editor="add-room"] { background: #f3f6e7; }
.hm-workspace { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(18rem,.9fr); gap: clamp(.75rem,1.6vw,1.35rem); align-items: stretch; }
.hm-workspace.hm-list-mode { grid-template-columns: minmax(0,42rem); }
.hm-drawing, .hm-inspector { min-width: 0; border: 1px solid var(--hm-line); border-radius: 1rem; overflow: hidden; }
.hm-drawing { display: flex; flex-direction: column; background: var(--hm-board); }
.hm-plan-head { display: flex; align-items: center; justify-content: space-between; gap: .45rem; min-height: 3.6rem; padding: .4rem 1rem; border-bottom: 1px solid var(--hm-line); }
.hm-plan-head h2 { font-size: clamp(1.08rem,1.6vw,1.35rem); }
.hm-plan-head button { background: white; padding-inline: .75rem; font-size: .88rem !important; }
.hm-board {
  width: 100%; aspect-ratio: 26/18; position: relative; overflow: hidden; isolation: isolate;
  background-color: #eaf0ec; background-image: radial-gradient(#bccbc3 1px, transparent 1px); background-size: .65rem .65rem;
}
.hm-region, .hm-pin { position: absolute; margin: 0; }
.hm-region {
  display: grid; place-items: center; min-width: 0; padding: 0; border-radius: 0; overflow: hidden;
  border: 2px solid var(--hm-wall); background-color: #fafbf5; color: var(--ink);
  transition: top .23s ease, left .23s ease, width .23s ease, height .23s ease, background-color .15s;
}
.hm-region[data-selected="true"] { background: #e2edba; }
.hm-region:disabled { opacity: 1; cursor: default; }
.hm-region > svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: #e8ede4; stroke: #95a99d; stroke-width: .8; }
.hm-region > svg path { fill: none; }
.hm-region-name {
  max-width: 100%; padding: .12rem .25rem; position: relative; border-radius: .27rem; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; line-height: 1.18; font-weight: 650; font-size: clamp(.78rem,1.25vw,1.02rem);
  background-color: #fafbf5ea; pointer-events: none;
}
.hm-region[data-selected="true"] .hm-region-name { background-color: #2a4d3e; color: white; }
.hm-region:hover { border-color: #163e30; }
.hm-region:focus-visible { z-index: 2; outline-offset: -4px; }
.hm-pin {
  transform: translate(-50%,-50%); width: 44px; height: 44px; display: grid; place-content: center;
  background: transparent; border: 0; color: #3d5149; z-index: 1; border-radius: 50%;
  transition: left .23s ease, top .23s ease;
}
.hm-pin .icon, .hm-lamp-row .icon { background: #f8faf6; border: 1px solid #637a6b; border-radius: 50%; padding: .33rem; width: 1.9rem; height: 1.9rem; box-shadow: 0 1px 3px #13311d24; }
.hm-pin[data-on="true"] .icon, .hm-lamp-row[data-on="true"] .icon { background: #e6efaa; color: #234333; border-color: #637a48; }
.hm-pin:hover .icon { outline: 2px solid #53715f; }
.hm-cluster { border: 2px solid #4c7054; background: #e6efaa; color: #183c32; font-weight: 730 !important; }
.hm-empty { position: absolute; inset: 0; display: grid; place-content: center; padding: 1rem; }
.hm-inspector { background: white; padding: clamp(1rem,2vw,1.6rem); display: flex; flex-direction: column; gap: 1.1rem; }
#map-room-title { font-size: clamp(1.55rem,2.5vw,2.4rem); line-height: 1.05; }
.hm-inspector [data-room-picker] { display: grid; gap: .3rem; }
.hm-inspector label { color: var(--muted); font-size: .88rem; }
.hm-inspector select { width: 100%; min-height: 2.75rem; border: 1px solid #aabbb0; padding: .4rem .7rem; background: white; color: var(--ink); border-radius: .5rem; }
.hm-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.hm-metrics div + div { border-left: 1px solid var(--line); padding-left: .85rem; }
.hm-metrics dt { color: var(--muted); font-size: .85rem; }
.hm-metrics dd { margin: 0; font-weight: 620; font-size: clamp(1.15rem,1.7vw,1.55rem); }
.hm-lamps { border-top: 1px solid var(--line); padding-top: .65rem; }
.hm-section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .3rem; }
.hm-section-head h3 { font-size: 1rem; letter-spacing: -.025em; }
.hm-section-head button { border-color: transparent; color: #305a42; padding-inline: .2rem; font-size: .9rem !important; }
.hm-lamp-row { display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 2.9rem; padding: .45rem .5rem; background: #f4f7ef; color: var(--ink); border: 1px solid transparent; border-radius: .55rem; text-align: left; }
.hm-lamp-row + .hm-lamp-row { margin-top: .3rem; }
.hm-lamp-row:hover { border-color: var(--hm-line); }
.hm-lamp-row .icon { width: 1.55rem; height: 1.55rem; padding: .19rem; box-shadow: none; }
.hm-lamp-name { font-weight: 610; overflow-wrap: anywhere; flex: 1; }
.hm-lamp-value,.hm-muted { color: var(--muted); font-size: .85rem; }
.hm-inspector [data-room-directory], [data-lamp-power] { color: white; background: var(--ink); border: 1px solid var(--ink); border-radius: .55rem; min-height: 2.75rem; padding: .45rem .8rem; font-weight: 650 !important; }
.hm-inspector [data-room-directory] { margin-top: auto; }
:is(#home-lamp-menu,#home-lamp-choice) {
  box-sizing: border-box; position: fixed; margin: auto max(1rem,calc((100vw - 72rem) / 2)) auto auto;
  width: min(22rem,94vw); max-height: 88dvh; inset: 0 0 0 auto; overflow: auto; background: #fff;
  color: var(--ink); border: 1px solid var(--hm-line); border-radius: 1rem; padding: 1.35rem; box-shadow: 0 1.1rem 4rem #173b3536;
}
:is(#home-lamp-menu,#home-lamp-choice)::backdrop { background: #19352d33; }
#home-choice-title { font-size: 1.3rem; }
[data-group-list] { margin-top: 1rem; max-height: 50vh; overflow: auto; }
.hm-sheet-top, .hm-operation { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.hm-sheet-top { color: var(--muted); font-size: .92rem; }
#home-lamp-title { font-size: 1.65rem; margin: .7rem 0 1.2rem; overflow-wrap: anywhere; }
#home-lamp-title:focus { outline: none; }
.hm-operation { border-top: 1px solid var(--line); padding-top: .85rem; }
.hm-dimmer { border-top: 1px solid var(--line); padding-top: .85rem; margin-top: 1rem; display: grid; grid-template-columns: 1fr auto; }
.hm-dimmer input { grid-column: 1/-1; width: 100%; height: 2.75rem; margin: 0; accent-color: var(--ink); }
@media (max-width: 810px) { .hm-workspace { grid-template-columns: minmax(0,1.35fr) minmax(14rem,.9fr); } }
@media (max-width: 680px) {
  .hm-workspace { grid-template-columns: minmax(0,1fr); gap: .55rem; }
  .hm-toolbar { gap: .35rem .5rem; margin-bottom: .55rem; }
  .hm-toolbar button { font-size: .86rem !important; min-height: 2.75rem; padding: .34rem .54rem; }
  .hm-layout-actions { gap: .28rem; }
  .hm-plan-head { min-height: 2.85rem; padding: .18rem .75rem; }
  .hm-board { aspect-ratio: 2.14; }
  .hm-board.hm-zoomed { aspect-ratio: 1.65; }
  .hm-region { border-width: 1.5px; }
  .hm-inspector { gap: .67rem; padding: .85rem; }
  .hm-lamps { padding-top: .32rem; }
  .hm-section-head { margin: 0; }
  :is(#home-lamp-menu,#home-lamp-choice) { inset: auto 0 0; width: 100%; max-width: none; margin: 0; padding: 1rem 1.2rem calc(1.25rem + env(safe-area-inset-bottom)); border-radius: 1.2rem 1.2rem 0 0; }
}
@media (prefers-reduced-motion: reduce) { .hm-region, .hm-pin { transition: none; } }
