/* BesenVakt on a computer (desk.js, 900 px and wider; design/besenvakt-redesign/rev-c.html, "On a computer"): a sidebar
   with the tabs and you at its foot, the page beside it. The sidebar's items sit --side-pad inside the window's corner
   (--r-win, a desktop window's), so their corner is r-win minus that padding: the user card in the bottom corner is
   concentric with the window's. The page's cards keep the app's own chain (app.css).
   The lab (the admin's live map, devices and furniture) is the old map with its floating panel, inside the page: the
   panel is derived from what it holds: the app's own cards (r-card) sit pad-sheet inside it, so its corner is
   r-card + pad-sheet + bw, and inside it r-insheet is r-card. */
html:has(.dshell), html:has(.dshell) body { overflow: hidden; height: 100%; }
#app:has(.dshell) { max-width: none; }
:root { --side-w: 248px; }
.dshell { --r-win: 18px; --side-pad: 10px; --r-sideitem: calc(var(--r-win) - var(--side-pad));
  --dpanel-w: clamp(360px, 28vw, 420px); --d-inset: 12px;
  position: fixed; inset: 0; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); background: var(--bg); }
/* the sidebar */
.dside { background: var(--surface); border-right: var(--bw) solid var(--line); padding: var(--side-pad); display: grid; grid-template-rows: auto 1fr auto; gap: 8px; min-height: 0; }
.dbrand { display: flex; gap: 10px; align-items: center; padding: 14px 8px 16px; font: 700 19px/1 var(--display); letter-spacing: -.01em; }
.dbrand img { width: 32px; height: 32px; }
.dnav { display: grid; gap: 2px; align-content: start; }
.dnav button { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: var(--r-sideitem); border: 0; background: none; color: var(--ink-2); font: 600 16px/1.2 var(--sans); cursor: pointer; text-align: left; }
.dnav button > span:first-of-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnav button svg { width: 20px; height: 20px; flex: none; }
.dnav button:hover { background: var(--surface-2); color: var(--ink); }
.dnav button[aria-current="page"] { background: var(--accent-wash); color: var(--accent-ink); }
/* the Vakt item's state: a pill (half its height round) */
.dnav .st { margin-left: auto; flex: none; font: 600 12.5px/1 var(--sans); padding: 0 8px; height: 22px; display: inline-flex; align-items: center; border-radius: 11px; background: var(--surface-2); color: var(--ink-2); }
.dnav .st:empty { display: none; }
.dnav .st.armed { background: var(--armed-wash); color: var(--armed-ink); } .dnav .st.bad { background: var(--bad-wash); color: var(--bad); }
.duser { --avatar: 36px; display: flex; gap: 10px; align-items: center; padding: 8px; border: 0; border-radius: var(--r-sideitem); background: var(--surface-2); color: inherit; font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.duser:hover { background: color-mix(in oklab, var(--ink) 6%, var(--surface-2)); }
.duser .av { font-size: 15px; } .duser .tx { display: grid; min-width: 0; }
.duser b { font: 600 15px/1.2 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .duser small { font: 400 13px/1.2 var(--sans); color: var(--ink-2); }
/* the page: it scrolls on its own, under a top edge that fades what passes beneath it */
.dstage { position: relative; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.dshell.haslab .dstage { overflow: hidden; }
.dpage { min-height: 100%; padding: 28px 36px 36px; display: flex; flex-direction: column; gap: 22px; }
.dstage::before { content: ""; position: sticky; top: 0; z-index: 6; display: block; height: 14px; margin-bottom: -14px; background: linear-gradient(var(--bg), color-mix(in oklab, var(--bg) 0%, transparent)); pointer-events: none; }
.dshell.haslab .dstage::before { display: none; }
.dhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none; }
.dhead .ltitle { font-size: 34px; }
.dhead .tr { display: flex; gap: 10px; align-items: center; }
.dhead .pbtn svg { width: 18px; height: 18px; }
.dgrid { display: grid; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); gap: 32px; align-items: start; }
.dcol { display: flex; flex-direction: column; gap: var(--gap-l); min-width: 0; }
.dnarrow { max-width: 640px; width: 100%; display: grid; gap: var(--gap); align-content: start; }
.dnarrow.vdeep { gap: var(--gap-l); }
.dnarrow.vdeep > .navbar + .ltitle { margin-top: calc(-1 * var(--gap-l) + var(--gap-s)); }
.dnarrow.tools > .navbar + .ltitle { margin-top: calc(-1 * var(--gap) + var(--gap-s)); }
/* Vakt: the button beside the house; the history fills the left column down to the page's bottom padding (app.js
   fitVakt keeps as many rows as fit, "All activity" always shows) */
.dpage:has(.dvakt) { height: 100%; }
.dvakt { flex: 1 1 0; min-height: 0; align-items: stretch; }
.dvakt > .vfit { min-height: 0; overflow: hidden; gap: 16px; }
.dvakt > .vfit > * { flex: none; }
.dvakt > .vfit > .actfit { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.dvakt .vhero { padding: 10px 0 2px; }
.dvakt > [data-dhouse] { overflow: auto; }
.dvakt .urgent.inline { flex: none; }
/* the house with both floors: each named under its plan; what the marks mean under the card */
.dfloors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: end; }
.dfloors figure { margin: 0; display: grid; gap: 8px; min-width: 0; }
.dfloors figcaption { font: 500 14px/1.2 var(--sans); color: var(--ink-2); text-align: center; }
.plegend { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 500 13.5px/1.3 var(--sans); color: var(--ink-2); padding: 0 4px; }
.plegend span { display: inline-flex; align-items: center; gap: 6px; }
.plegend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.plegend i.you { box-shadow: inset 0 0 0 2px var(--accent); } .plegend i.said { background: var(--ink-2); } .plegend i.trig { background: var(--bad-fill); }
/* narrower windows: one column, the house under the rest; Vakt then scrolls like any page */
@media (max-width: 1180px) {
  .dgrid { grid-template-columns: minmax(0, 1fr); }
  .dpage:has(.dvakt) { height: auto; } .dvakt { flex: none; }
  .dvakt > .vfit { overflow: visible; } .dvakt > .vfit > .actfit { flex: none; }
}
/* sheets of their own: a dialog over the page; toasts over the page, near its top */
body:has(.dshell) .sheet { left: calc(var(--side-w) + (100vw - var(--side-w)) / 2); bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - var(--side-w) - 48px)); max-height: 84dvh; animation: deskin .22s ease-out; }
body:has(.dshell) .sheet .grab { display: none; }
body:has(.dshell) .toast { left: calc(var(--side-w) + (100vw - var(--side-w)) / 2); bottom: auto; top: 24px; }

/* ---------- the lab: the map fills the page, the panel floats at its right ---------- */
.desk { --d-glass: color-mix(in oklab, var(--surface) 82%, transparent); position: absolute; inset: 0; background: var(--bg); }
/* ---------- the map ---------- */
.dmap { position: absolute; inset: 0 calc(var(--dpanel-w) + var(--d-inset)) 0 0; overflow: hidden; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.dmap.panning, .dmap.panning * { cursor: grabbing !important; }
.dmap.picking svg, .dmap.moving svg { cursor: crosshair; }
.dmapin { position: absolute; transform-origin: 0 0; }
.dmapin.ease { transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
.dmapin > svg { display: block; width: 100%; height: auto; }
.dmap .rm, .dmap .spot, .dmap .radio { cursor: pointer; }
.desk.editing .dmap .radio { cursor: grab; } .desk.editing .dmap .radio:active { cursor: grabbing; }
.dmap .radio:focus-visible { outline: none; } .dmap .radio:focus-visible .ring { opacity: 1; }
.dmap .spot[data-draggable] { cursor: grab; }
/* glass on the map */
.dtop, .dzoom, .dlegend, .dpick { position: absolute; z-index: 5; cursor: default; }
.dtop { top: 16px; left: 24px; right: 72px; display: flex; align-items: center; gap: var(--gap-s); pointer-events: none; }
.dtop > * { pointer-events: auto; }
.dtop .seg, .dtop .live, .dzoom, .dlegend, .dpick { background: var(--d-glass); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); box-shadow: 0 0 0 var(--bw) var(--line), 0 6px 20px rgba(0, 0, 0, .10); }
.dtop .seg button { padding-inline: 14px; white-space: nowrap; }
.dtop .live { border: 0; height: calc(var(--h-tap) + 2 * var(--seg-pad)); padding-inline: 14px 16px; }
/* the zoom buttons: a column at the map's right; each button sits --seg-pad inside it (r-ctl minus that) */
.dzoom { top: 16px; right: 16px; display: grid; gap: var(--seg-pad); padding: var(--seg-pad); border-radius: var(--r-ctl); }
.dzoom button { width: 38px; height: 38px; border: 0; border-radius: calc(var(--r-ctl) - var(--seg-pad)); background: none; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.dzoom button:hover:not(:disabled) { background: var(--surface); }
.dzoom button:disabled { color: var(--ink-3); opacity: .5; cursor: default; }
/* the legend: the outside row's chips (r-ctl) may reach its corner, so its corner is r-ctl plus its padding */
.dlegend { --lg-pad: 10px; left: 24px; bottom: 16px; max-width: calc(100% - 48px); display: grid; gap: var(--gap-s); padding: var(--lg-pad); border-radius: calc(var(--r-ctl) + var(--lg-pad)); }
.dlegend .legend { padding: 0; }
.dlegend .chips.outside { padding: 0; }
/* "click where you are now": a pill over the map; its Cancel is a pill --pick-pad inside it, so both ends share a centre */
.dpick { --pick-pad: 5px; top: 70px; left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 12px; padding: var(--pick-pad) var(--pick-pad) var(--pick-pad) 18px; border-radius: 999px; font: 650 15px/1.2 var(--sans); box-shadow: 0 0 0 1.5px var(--accent), 0 8px 24px rgba(0, 0, 0, .14); }
.dpick button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--ink); font: 600 14px/1 var(--sans); cursor: pointer; }

/* ---------- the side panel ---------- */
.dpanel { --r-insheet: var(--r-card); --r-inblockctl: calc(var(--r-card) - var(--inblock-pad)); --r-dpanel: calc(var(--r-card) + var(--pad-sheet) + var(--bw));
  --dc-pad: 8px; --r-dcitem: calc(var(--r-card) - var(--dc-pad) - var(--bw));
  position: absolute; top: var(--d-inset); right: var(--d-inset); bottom: var(--d-inset); width: var(--dpanel-w); display: flex; flex-direction: column; gap: 12px;
  padding: var(--pad-sheet); border-radius: var(--r-dpanel); background: var(--surface); border: var(--bw) solid var(--line); box-shadow: 0 10px 40px rgba(0, 0, 0, .10); z-index: 10; }
.dtabs button { height: auto; min-height: var(--h-tap); padding: 6px 4px; flex-direction: column; gap: 3px; font-size: 12px; min-width: 0; }
.dtabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtabs button svg { width: 18px; height: 18px; flex: none; }
.dbody { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-inline: calc(-1 * var(--pad-sheet)); padding: 2px var(--pad-sheet) 4px; scrollbar-width: thin; }
.dtab, .ddetail { display: grid; align-content: start; gap: 12px; }
.dtab > .t-sec, .ddetail > .t-sec { margin-top: 6px; margin-bottom: -4px; }
.dsum { font: 650 19px/1.25 var(--display); letter-spacing: -.01em; padding: 2px 4px 0; }
/* cards, lists, banners and buttons keep the app's own chain (r-card, r-ctl inside); the detail's blocks are r-insheet */
.dpanel .devpanel { gap: 12px; }
.dpanel .devpanel .titlerow .t-title { font-size: 18px; }
/* a room's, spot's or device's details: the sheet's header, in the panel */
.ddetail .hd { display: flex; align-items: center; gap: 10px; }
.ddetail .hd .t-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ddetail .grab { display: none; }

/* ---------- the recording card: the phone's dock (app.css) at the panel's bottom ----------
   Its cards take r-insheet where the phone's take --r-tab, and the chains inside are derived again from it: the dock
   card's buttons and chips --dock-pad inside (r-dockitem), a bar's buttons --rec-pad inside (r-recitem). The idle card
   is the desktop's own: its chips sit --dc-pad + border inside (r-dcitem). */
.drec { --r-tab: var(--r-insheet); --r-recitem: calc(var(--r-insheet) - var(--rec-pad)); --r-dockitem: calc(var(--r-insheet) - var(--dock-pad));
  display: grid; gap: var(--gap-s); }
.drec:empty { display: none; }
.drec > * { box-shadow: none; }
.drec > .reccard.light { box-shadow: 0 0 0 var(--bw) var(--line); }   /* the ring the phone's card has, without its shadow */
.drec .favrow { flex-wrap: wrap; overflow: visible; }   /* the panel is wide enough to show them all */
.dcard { --r-dockitem: var(--r-dcitem); display: grid; gap: var(--dc-pad); padding: var(--dc-pad); border-radius: var(--r-insheet); border: var(--bw) solid var(--line); }
.dcard > .t-small, .dcard > .t-sec, .dcard > .hint { padding: 4px 6px 0; }
.dcard.idle { background: var(--surface-2); border-color: transparent; }
.dcard.idle > .t-sec { padding-top: 6px; }
.dcard.idle .fchip { background: var(--surface); color: var(--ink); }
.dcard.idle .fchip:hover:not(:disabled) { background: var(--accent-wash); }
.dcard.idle .rbtn { height: var(--h-tap); border-radius: var(--r-dockitem); background: var(--surface); color: var(--ink); justify-content: center; min-width: 0; }   /* No one home: the chips' shape */
.dcard.idle .rbtn:hover:not(:disabled) { background: var(--accent-wash); }
/* Stop's "when" in the panel (app.js stopSheet): "Don't remember" apart, as in a sheet of its own */
.ddetail > .apart { margin-top: calc(var(--gap-l) - 12px); }

/* ---------- in the lab: a sheet is a dialog over the map, a toast under the floor switch ---------- */
body:has(.desk) .sheet { left: calc(var(--side-w) + (100vw - var(--side-w) - clamp(360px, 28vw, 420px) - 12px) / 2); }
@keyframes deskin { from { opacity: 0; scale: .97; } }
body:has(.desk) .toast { left: calc(var(--side-w) + (100vw - var(--side-w) - clamp(360px, 28vw, 420px) - 12px) / 2); top: 76px; }   /* under the floor switch, clear of the legend */
body:has(.dmap.picking) .toast { top: 124px; }   /* below the "click where you are now" pill */
body:has(.desk) .carry { z-index: 70; }
@media (prefers-reduced-motion: reduce) { .dmapin.ease { transition: none; } body:has(.dshell) .sheet { animation: none; } }
.dpanel > .navbar { margin-bottom: -6px; }

