/* BesenPose on a computer (desk.js, 900 px and wider): the plan fills the window, a side panel floats at its right.
   The panel is derived from what it holds: the app's own cards (r-card, their controls r-ctl, app.css) sit pad-sheet
   inside it, so its corner is r-card + pad-sheet + bw, and inside it r-insheet is r-card. The recording card at its
   bottom takes r-insheet, its buttons that minus the card's padding; the avatar in its top corner is a circle of
   r-insheet. The map's floating controls sit on the open map (square window corners): their corners only nest their
   own buttons. */
html:has(.desk), html:has(.desk) body { overflow: hidden; height: 100%; }
#app:has(.desk) { max-width: none; }
.desk { --dpanel-w: clamp(360px, 28vw, 420px); --d-inset: 12px; --d-glass: color-mix(in oklab, var(--surface) 82%, transparent);
  position: fixed; 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 .seg button[aria-pressed="true"] { background: var(--surface); }
.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; }
.dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dwho { display: grid; gap: 2px; padding: 2px 0 0 4px; }
/* the avatar in the panel's top corner: a circle of r-insheet, concentric with the corner */
.dme { width: calc(2 * var(--r-insheet)); height: calc(2 * var(--r-insheet)); border-radius: 50%; border: 0; color: #fff; font: 700 15px/1 var(--display); display: grid; place-items: center; cursor: pointer; flex: none; position: relative; padding: 0; }
.dme[aria-current="page"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.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; }
.dtab > .t-large:first-child, .dtab > .row:first-child { margin-top: 0 !important; }
.dtab > .t-large, .dtab > .row > .t-large { font-size: 24px; }
.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); }
/* 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); }

/* ---------- sheets of their own (pick a Wi-Fi device, change times, ...): a dialog over the map ---------- */
body:has(.desk) .sheet { left: calc((100vw - clamp(360px, 28vw, 420px) - 12px) / 2); bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 440px)); max-height: 84dvh; animation: deskin .22s ease-out; }
body:has(.desk) .sheet .grab { display: none; }
@keyframes deskin { from { opacity: 0; scale: .97; } }
body:has(.desk) .toast { left: calc((100vw - clamp(360px, 28vw, 420px) - 12px) / 2); bottom: auto; 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(.desk) .sheet { animation: none; } }
