:root {
  --bg-0: #07090d;
  --bg-1: #10151d;
  --text: #eef3f9;
  --text-2: rgba(238, 243, 249, .66);
  --text-3: rgba(238, 243, 249, .42);
  --line: rgba(255, 255, 255, .14);
  --line-strong: rgba(255, 255, 255, .26);
  --glass-top: rgba(255, 255, 255, .13);
  --glass-bottom: rgba(255, 255, 255, .035);
  --ok: #7ee2b8;
  --warn: #ffc56b;
  --crit: #ff7a6b;
  --cold: #6fb8ff;
  --accent: #b9dcff;
  --radius: 12px;
  --radius-s: 8px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: "Ranade", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Ranade", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(120% 90% at 70% 10%, #1b2533 0%, var(--bg-1) 38%, var(--bg-0) 100%);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: .005em;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* barely visible particles drifting behind everything (js/background.js) */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#scene { position: fixed; inset: 0; }
#scene canvas { display: block; outline: none; }

/* ---------------------------------------------------------------- liquid glass */
.glass {
  position: relative;
  /* a faint dark tint under the frost keeps text readable over a bright or blue room */
  background: linear-gradient(150deg, var(--glass-top), var(--glass-bottom) 60%), rgba(12, 16, 23, .38);
  backdrop-filter: blur(26px) saturate(170%) brightness(1.04);
  -webkit-backdrop-filter: blur(26px) saturate(170%) brightness(1.04);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, .38),
    0 2px 8px rgba(0, 0, 0, .25),
    inset 0 1px 0 rgba(255, 255, 255, .28),
    inset 0 -1px 0 rgba(255, 255, 255, .06),
    inset 0 0 0 1px rgba(255, 255, 255, .02);
  isolation: isolate;
}
/* the light catching the top edge of the glass */
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255,255,255,.55), rgba(255,255,255,.08) 30%, rgba(255,255,255,0) 55%, rgba(255,255,255,.18));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: -1;
}
/* a soft sheen inside */
.glass::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 60% at 20% 0%, rgba(255,255,255,.10), transparent 60%);
  pointer-events: none;
  z-index: -1;
}
/* In panels that scroll, the edge layers would scroll with the content and leave a line across it.
   The border and inset shadows above still draw the edge there. */
.drawer.glass::before, .drawer.glass::after,
.auth-card.glass::before, .auth-card.glass::after { display: none; }

/* ---------------------------------------------------------------- loader */
.loader {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-content: center; gap: 18px; justify-items: center;
  background: radial-gradient(80% 80% at 50% 40%, #141b25, #06080b);
  transition: opacity .9s var(--ease), visibility .9s;
}
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-mark { font-weight: 300; letter-spacing: .5em; font-size: 13px; color: var(--text-2); padding-left: .5em; }
.loader-bar { width: 220px; height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6fb8ff, #e8f3ff); transition: width .3s var(--ease); }
.loader-text { font-size: 12px; color: var(--text-3); }

/* ---------------------------------------------------------------- brand */
.brand {
  position: fixed; top: 20px; left: 20px; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px 12px 14px;
  border-radius: 12px;
}
.brand-name { font-weight: 500; font-size: 14px; letter-spacing: .02em; }
.brand-sub { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
/* the data mode: just a coloured word */
.chip { font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
.chip.demo { color: #cdb6ff; }
.chip.live { color: var(--ok); }
.chip.preview { color: var(--warn); }

@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.7); opacity: .6; } }

/* ---------------------------------------------------------------- HUD */
.hud { position: fixed; top: 20px; right: 20px; z-index: 10; width: 300px; display: grid; gap: 10px; }
.hud-main { padding: 18px 20px 16px; }
.hud-device { display: grid; gap: 6px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.hud-device select { padding: 7px 10px; font-size: 13px; }
.hud-label, .mini-label, .dock-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 500; }
.hud-temp { display: flex; align-items: flex-start; gap: 4px; margin: 4px 0 6px; font-weight: 300; font-size: 64px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hud-unit { font-size: 22px; font-weight: 300; margin-top: 8px; color: var(--text-2); }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.trend { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.trend.down { color: var(--cold); }
.trend.up { color: var(--warn); }
/* status: just the word, in its colour */
.status { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; transition: color .5s var(--ease); }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.crit { color: var(--crit); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .55; } }
.hud-forecast { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text); }
.hud-forecast b { font-weight: 500; }
.hud-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini { padding: 10px 12px; border-radius: 10px; }
.mini-label { font-size: 9.5px; }
.mini-value { font-size: 15px; font-weight: 400; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- toasts */
.toasts { display: grid; gap: 8px; }
.toast { padding: 12px 14px 12px 16px; border-radius: 10px; cursor: pointer; }
.toast-kind { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; }
.toast-kind.WARNING { color: var(--warn); }
.toast-kind.CRITICAL { color: var(--crit); }
.toast-kind.INFO { color: var(--accent); }
.toast-msg { font-size: 12.5px; color: var(--text); margin-top: 3px; }
.toast-advice { font-size: 12px; color: var(--text-2); margin-top: 6px; }

/* ---------------------------------------------------------------- rail */
.rail { position: fixed; left: 20px; top: 50%; transform: translateY(-50%); z-index: 11; display: grid; gap: 6px; padding: 8px; border-radius: 12px; }
.rail-btn { position: relative; width: 44px; height: 44px; border-radius: 10px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; transition: background .35s var(--ease), border-color .35s, transform .35s var(--ease); }
.rail-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--text-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: stroke .3s; }
.rail-btn:hover { background: rgba(255,255,255,.08); transform: scale(1.05); }
.rail-btn:hover svg, .rail-btn.active svg { stroke: var(--text); }
.rail-btn.active { background: rgba(255,255,255,.16); border-color: var(--line-strong); }
.rail-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rail-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.rail-badge { position: absolute; top: 3px; right: 5px; color: var(--crit); font-size: 11px; font-weight: 700; }

/* ---------------------------------------------------------------- drawers */
.drawer {
  position: fixed; z-index: 10; left: 90px; top: 92px; bottom: 176px;
  width: 360px; padding: 18px 18px 20px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer h2 { margin: 0; font-size: 20px; font-weight: 300; letter-spacing: -.01em; }
.drawer-sub { color: var(--text-2); font-size: 13px; margin: 6px 0 16px; }
.drawer-note { color: var(--text-3); font-size: 12px; margin-top: 16px; }
.icon-btn { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-size: 18px; line-height: 1; color: var(--text-2); transition: background .3s; }
.icon-btn:hover { background: rgba(255,255,255,.14); color: var(--text); }

.sensor-list, .issue-list { display: grid; gap: 10px; }
.sensor-card, .issue-card { padding: 14px; border-radius: var(--radius-s); background: rgba(255,255,255,.06); border: 1px solid var(--line); text-align: left; transition: background .35s var(--ease), border-color .35s, transform .35s var(--ease); }
.sensor-card:hover { background: rgba(255,255,255,.11); border-color: var(--line-strong); transform: translateX(3px); }
.sensor-top { display: flex; justify-content: space-between; align-items: baseline; }
.sensor-name { font-weight: 500; }
.sensor-temp { font-size: 22px; font-weight: 300; font-variant-numeric: tabular-nums; }
.sensor-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--text-3); font-size: 12px; margin-top: 4px; }
.sensor-meta .bad { color: var(--crit); }
.issue-card .issue-kind { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; }
.issue-card .issue-kind.WARNING { color: var(--warn); }
.issue-card .issue-kind.CRITICAL { color: var(--crit); }
.issue-card .issue-kind.INFO { color: var(--accent); }
.issue-msg { margin-top: 4px; font-size: 13px; }
.issue-advice { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,.07); font-size: 13px; }
.issue-advice::before { content: "What to do"; display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
.issue-time { color: var(--text-3); font-size: 11px; margin-top: 8px; }
.empty { color: var(--text-3); font-size: 13px; padding: 24px 6px; text-align: center; }

/* charts */
.chart-card { margin-top: 14px; padding: 12px 12px 10px; border-radius: var(--radius-s); background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.chart-title { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.muted { color: var(--text-3); }
.chart { width: 100%; height: 150px; display: block; overflow: visible; }
#chart-rate { height: 104px; }
.chart text { fill: var(--text-3); font: 9px var(--mono); }
/* legends: the series name in its own colour, no swatch */
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: 11px; font-weight: 500; color: var(--text-2); }

/* controls */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 8px; background: rgba(0,0,0,.22); border: 1px solid var(--line); position: relative; }
.segmented button { border: 0; background: transparent; padding: 7px 13px; border-radius: 8px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; transition: color .35s var(--ease), background .45s var(--ease), box-shadow .45s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { color: #0b0f15; background: linear-gradient(180deg, #ffffff, #dfe8f3); box-shadow: 0 4px 14px rgba(0,0,0,.25), inset 0 1px 0 #fff; font-weight: 500; }
.segmented.small button { padding: 5px 11px; font-size: 12px; }
.segmented:focus-within { outline: none; }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.toggle { display: flex; align-items: center; gap: 12px; padding: 10px 2px; cursor: pointer; color: var(--text); font-size: 14px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { width: 40px; height: 24px; border-radius: 8px; background: rgba(255,255,255,.14); border: 1px solid var(--line); position: relative; transition: background .4s var(--ease); flex: none; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .45s var(--ease); }
.toggle input:checked + span { background: linear-gradient(180deg, #8cc8ff, #4a8fd6); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.field { margin-top: 14px; }
.field-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.field-head b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, rgba(111,184,255,.8), rgba(255,255,255,.3) 50%, rgba(255,160,90,.8)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, rgba(111,184,255,.8), rgba(255,255,255,.3) 50%, rgba(255,160,90,.8)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4), inset 0 -2px 0 rgba(0,0,0,.08); transition: transform .3s var(--ease); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.18); }
input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.scale { margin-top: 18px; }
.scale-bar { height: 10px; border-radius: 6px; background: linear-gradient(90deg, #2b6dff, #4dc3ff 25%, #dfeefa 50%, #ffb45c 75%, #ff5240); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.scale-labels { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--text-3); margin-top: 6px; }

.input { display: grid; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--text-2); }
.input input, .input select, select { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); outline: none; transition: border-color .3s; }
.input input:focus, select:focus { border-color: rgba(185,220,255,.6); }
select option { background: #141a22; }
.primary { margin-top: 16px; width: 100%; padding: 12px 16px; border-radius: 10px; border: 0; background: linear-gradient(180deg, #ffffff, #dbe6f3); color: #0b0f15; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.3), inset 0 1px 0 #fff; transition: transform .3s var(--ease), box-shadow .3s; }
.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(0,0,0,.35), inset 0 1px 0 #fff; }
.primary:disabled { opacity: .5; transform: none; }
.ghost { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-size: 12.5px; color: var(--text-2); transition: background .3s, color .3s; white-space: nowrap; }
.ghost:hover { background: rgba(255,255,255,.14); color: var(--text); }

/* ---------------------------------------------------------------- dock */
.dock { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 10; display: grid; gap: 10px; justify-items: center; width: min(1180px, calc(100vw - 40px)); }
.dock-row { display: flex; align-items: flex-end; gap: 18px; padding: 12px 16px; border-radius: 12px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.dock-row::-webkit-scrollbar { display: none; }
.dock-group { display: grid; gap: 6px; flex: none; }
.dock-group.grow { flex: 1 1 170px; min-width: 160px; }
.dock-label b { color: var(--text); font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 12px; margin-left: 4px; }
.dock-inline { display: flex; gap: 6px; align-items: center; }
.dock-inline select { width: 150px; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; }
.views { padding: 6px; gap: 4px; border-radius: 8px; align-items: center; }
.views button { border: 0; background: transparent; padding: 9px 18px; border-radius: 8px; font-size: 13px; color: var(--text-2); letter-spacing: .02em; transition: color .35s var(--ease), background .45s var(--ease), box-shadow .45s; white-space: nowrap; }
.views button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.views button.active { color: #0b0f15; background: linear-gradient(180deg, #fff, #dfe8f3); box-shadow: 0 6px 18px rgba(0,0,0,.28), inset 0 1px 0 #fff; font-weight: 500; }
.views button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.credit { position: fixed; right: 20px; bottom: 10px; z-index: 5; font-size: 10.5px; color: var(--text-3); }
.credit a { color: var(--text-2); }

/* ---------------------------------------------------------------- 3D labels */
.label3d { pointer-events: auto; cursor: pointer; transform: translateY(-26px); }
.label3d .pill {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 11px; border-radius: 8px;
  background: linear-gradient(150deg, rgba(255,255,255,.2), rgba(255,255,255,.06)), rgba(12, 16, 23, .42);
  backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 8px 24px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.35);
  white-space: nowrap; transition: transform .4s var(--ease), background .4s;
}
.label3d:hover .pill { transform: scale(1.06); background: linear-gradient(150deg, rgba(255,255,255,.3), rgba(255,255,255,.1)); }
.label3d .lname { font-size: 11px; color: var(--text-2); }
.label3d .lvalue { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.label3d.bad .lvalue { color: var(--crit); }
.labels-hidden .label3d { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- scene states */
#scene { transition: filter .9s var(--ease), transform .9s var(--ease); }
body.signing-in #scene { filter: brightness(.72) saturate(.9); }
/* 2D: the whole room melts into a soft blur behind the plan. The slight zoom hides the blur's
   faded edges, and the blurred room can't be dragged. */
body.plan-mode #scene { filter: blur(28px) brightness(.5) saturate(.8); transform: scale(1.08); pointer-events: none; }

/* The interface glides in with CSS transitions (run by the browser, so it never gets stuck). */
[data-reveal] { transition: opacity .9s var(--ease), translate .9s var(--ease); }
.hud[data-reveal] { transition-delay: .08s; }
.rail[data-reveal] { transition-delay: .16s; }
.dock[data-reveal] { transition-delay: .24s; }
body.ui-hidden [data-reveal], body.ui-hidden .credit { opacity: 0; translate: 0 14px; pointer-events: none; transition-delay: 0s; }

/* ---------------------------------------------------------------- sign in */
.auth {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; padding: 24px 0 24px clamp(20px, 7vw, 120px);
  background: linear-gradient(90deg, rgba(5,7,10,.72) 0%, rgba(5,7,10,.35) 38%, rgba(5,7,10,0) 62%);
}
.auth[hidden], .gate[hidden] { display: none; }
.auth-card { animation: auth-in .9s var(--ease) .15s both; }
.auth.leaving { transition: opacity .5s ease-in; opacity: 0; }
.auth.leaving .auth-card { transition: translate .5s ease-in; translate: -24px 0; }
@keyframes auth-in { from { opacity: 0; translate: -30px 0; } }
.auth-card { width: min(420px, calc(100vw - 40px)); padding: 30px 30px 24px; border-radius: 12px; max-height: calc(100vh - 48px); overflow-y: auto; scrollbar-width: none; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.auth h1 { margin: 6px 0 4px; font-size: 34px; font-weight: 300; letter-spacing: -.02em; }
.auth-sub { margin: 0 0 18px; color: var(--text-2); font-size: 14px; }
.auth .input { margin-top: 14px; }
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 64px; }
.reveal { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 500; padding: 5px 6px; }
.reveal:hover { text-decoration: underline; }
.auth .primary { margin-top: 18px; display: flex; justify-content: center; gap: 8px; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--text-2); text-align: center; }
.auth-switch button { border: 0; background: none; color: var(--accent); font-weight: 500; padding: 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(185,220,255,.4); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--text-3); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-foot { margin: 14px 0 0; font-size: 11.5px; color: var(--text-3); }
.form-msg { margin: 12px 0 0; font-size: 12.5px; color: var(--ok); }
.form-msg.error { color: var(--crit); }
.wide { width: 100%; padding: 10px 14px; border-radius: 10px; font-size: 13px; }

/* ---------------------------------------------------------------- onboarding and pairing */
.steps { margin: 4px 0 18px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.steps li { counter-increment: step; position: relative; padding-left: 26px; font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.steps li b { color: var(--text); font-weight: 500; }
.steps li::before { content: counter(step) "."; position: absolute; left: 0; top: 0; font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
.steps.small li { font-size: 12.5px; padding-left: 22px; }
.waiting { display: flex; align-items: center; gap: 10px; margin: 2px 0 4px; font-size: 12.5px; color: var(--text-2); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(185,220,255,.25); border-top-color: var(--accent); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.serial-card { margin: 14px 0 6px; padding: 18px; border-radius: 10px; text-align: center; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.serial-label { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.serial { margin: 6px 0; font: 500 26px var(--mono); letter-spacing: .06em; color: var(--text); word-break: break-all; }
.serial-hint { font-size: 12px; color: var(--text-2); }
.wide-buttons { margin-top: 18px; }
.wide-buttons .primary { margin-top: 0; flex: 1; }
.wide-buttons .ghost { padding: 12px 16px; border-radius: 10px; }
.hud-note { display: block; width: 100%; margin-top: 12px; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--accent); font-size: 12.5px; text-align: left; }
.hud-note:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- devices panel */
.device-cards { display: grid; gap: 12px; }
.device-card { padding: 14px; border-radius: var(--radius-s); background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.device-card.current { border-color: rgba(185,220,255,.45); box-shadow: 0 0 0 1px rgba(185,220,255,.2) inset; }
.device-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.device-serial { font: 11.5px var(--mono); color: var(--text-3); }
.device-card .input { margin-top: 10px; }
.device-limits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.device-limits .input span { font-size: 11px; }
.device-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-device { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.add-device .steps { margin-top: 12px; }
.add-device summary { cursor: pointer; }

/* ---------------------------------------------------------------- account panel */
.account-card { display: flex; align-items: center; gap: 12px; padding: 14px; margin-top: 6px; border-radius: var(--radius-s); background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-weight: 500; font-size: 14px; color: #0b0f15; background: linear-gradient(140deg, #e8f3ff, #8cc0f0); box-shadow: inset 0 1px 0 #fff; flex: none; }
.account-email { font-weight: 500; word-break: break-all; }
.account-server { font-size: 12px; color: var(--text-3); word-break: break-all; }
.form-title { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 500; }
.account-form, .danger-zone { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.account-form .ghost.wide { margin-top: 14px; }
.danger-zone .drawer-note { margin-top: 6px; }
.ghost.danger { color: #ffb3a8; border-color: rgba(255,122,107,.35); }
.ghost.danger:hover { background: rgba(255,122,107,.14); color: #ffd2cb; }
.row-buttons { display: flex; gap: 8px; margin-top: 8px; }
.signout { margin-top: 22px; }

/* ---------------------------------------------------------------- 3D / 2D switch */
.dim-switch { display: inline-flex; padding: 3px; border-radius: 8px; background: rgba(0,0,0,.28); border: 1px solid var(--line); }
.dim-switch button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 500; letter-spacing: .06em; color: var(--text-2); transition: color .35s var(--ease), background .45s var(--ease); }
.dim-switch button.active { color: #0b0f15; background: linear-gradient(180deg, #fff, #dfe8f3); box-shadow: 0 4px 14px rgba(0,0,0,.25), inset 0 1px 0 #fff; }
.views-sep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--line); }
body.plan-mode #view-row [data-view] { display: none; }
body.plan-mode .views-sep { display: none; }

/* ---------------------------------------------------------------- 2D plan */
.plan { position: fixed; z-index: 9; left: 96px; right: 340px; top: 92px; bottom: 176px; display: grid; place-items: center; pointer-events: none; }
.plan[hidden] { display: none; }
.plan-card { pointer-events: auto; width: 100%; height: 100%; padding: 18px 22px 16px; display: flex; flex-direction: column; border-radius: 12px; }
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.plan-head h2 { margin: 0; font-size: 20px; font-weight: 300; display: flex; align-items: baseline; gap: 10px; }
.plan-head h2 .chip { color: var(--text-3); }
.plan-sub { margin: 4px 0 0; color: var(--text-3); font-size: 12.5px; }
.plan-actions { display: flex; gap: 8px; }
.plan-actions .ghost.on { background: rgba(185,220,255,.18); color: var(--text); border-color: rgba(185,220,255,.45); }
.plan-stage { position: relative; flex: 1; min-height: 0; margin: 14px 26px 22px 6px; }
.plan-floor { position: absolute; border-radius: 10px; overflow: hidden; background: #0d1219; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 20px 50px rgba(0,0,0,.35); }
#plan-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: auto; }
.plan-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.plan-dim { position: absolute; font: 11px var(--mono); color: var(--text-3); white-space: nowrap; }
.plan-sensors { position: absolute; pointer-events: none; }
.plan-sensors .plan-marker { pointer-events: auto; }
.plan-marker.below .pill { top: 22px; }
.plan-marker.at-left .pill { left: -6px; transform: none; }
.plan-marker.at-right .pill { left: auto; right: -6px; transform: none; }
.plan-marker { position: absolute; transform: translate(-50%, -50%); border: 0; background: none; padding: 0; cursor: pointer; touch-action: none; }
/* where the sensor is: a small neutral ring */
.plan-marker .dot { display: block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; background: rgba(13,18,25,.6); margin: 0 auto; }
.plan-marker .pill { position: absolute; left: 50%; top: -34px; transform: translateX(-50%); }
.plan-marker .pill { display: flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 8px; white-space: nowrap;
  background: linear-gradient(150deg, rgba(255,255,255,.2), rgba(255,255,255,.06)), rgba(12,16,23,.5);
  backdrop-filter: blur(12px) saturate(160%); -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid rgba(255,255,255,.24); box-shadow: 0 6px 18px rgba(0,0,0,.35); font-size: 11px; color: var(--text-2); }
.plan-marker .pill b { color: var(--text); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.plan-marker.bad .pill b { color: var(--crit); }
.plan.editing .plan-marker { cursor: grab; }
.plan.editing .plan-marker:active { cursor: grabbing; }
.plan.editing .plan-marker .dot { animation: pulse 1.6s ease-in-out infinite; }
.plan-marker:focus-visible .dot { outline: 2px solid var(--accent); outline-offset: 3px; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--text-3); }
.plan-legend { display: flex; align-items: center; gap: 8px; font: 11px var(--mono); }
.plan-legend i { width: 140px; height: 8px; border-radius: 5px; background: linear-gradient(90deg, #2b6dff, #4dc3ff 25%, #dfeefa 50%, #ffb45c 75%, #ff5240); }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 820px) {
  .brand { top: 12px; left: 12px; padding: 9px 12px; }
  .brand-name { font-size: 13px; }
  .hud { top: 76px; left: 12px; right: 12px; width: auto; gap: 8px; }
  .hud-main { padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; column-gap: 14px; }
  .hud-label { flex-basis: 100%; font-size: 10px; }
  .hud-temp { font-size: 40px; margin: 0; }
  .hud-unit { font-size: 15px; margin-top: 4px; }
  .hud-row { margin-left: auto; flex-direction: column; align-items: flex-end; gap: 6px; }
  .hud-forecast { flex-basis: 100%; margin-top: 8px; padding-top: 8px; font-size: 12px; }
  .hud-mini { display: none; }
  .toasts { display: none; }
  .rail { left: 12px; top: auto; bottom: 150px; transform: none; grid-auto-flow: column; }
  .rail-sep { width: 1px; height: auto; margin: 6px 2px; }
  .drawer { left: 12px; right: 12px; width: auto; top: auto; bottom: 214px; max-height: 52vh; }
  .dock { bottom: 12px; width: calc(100vw - 24px); }
  .dock-row { gap: 12px; padding: 10px 12px; }
  .views button { padding: 8px 12px; font-size: 12px; }
  .credit { display: none; }
  .auth { padding: 16px; justify-content: center; background: rgba(5,7,10,.55); }
  .plan { left: 12px; right: 12px; top: 150px; bottom: 214px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
