:root {
  color-scheme: dark;
  --bg: #06080b;
  --surface: #0c1116;
  --surface-2: #111820;
  --surface-3: #18212a;
  --surface-4: #202b35;
  --line: rgba(231, 240, 245, 0.10);
  --line-strong: rgba(231, 240, 245, 0.20);
  --text: #f5f8fa;
  --muted: #8897a4;
  --muted-strong: #afbbc4;
  --ice: #65ddff;
  --ice-rgb: 101, 221, 255;
  --mint: #4fe2a4;
  --mint-rgb: 79, 226, 164;
  --amber: #ffbd69;
  --coral: #ff7d68;
  --violet: #b89aff;
  --danger: #ff7266;
  --radius: 8px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  scrollbar-gutter: stable;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 40px 40px;
  font-family: "SF Pro Display", "SF Pro Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0 0 auto;
  z-index: -1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--ice-rgb), 0.55), rgba(var(--mint-rgb), 0.45), transparent);
  content: "";
}

button,
input,
select {
  font: inherit;
}

button,
input,
select,
.chip,
.pill,
.tab,
.switch {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: wait;
  opacity: 0.55;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 14px 0 64px;
}

/* Header and navigation */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 74px;
  margin-bottom: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 8, 11, 0.88);
  backdrop-filter: blur(20px) saturate(130%);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 46px;
  height: 46px;
  overflow: hidden;
  border: 1px solid rgba(var(--ice-rgb), 0.38);
  border-radius: var(--radius);
  background: #0b1319;
  box-shadow: inset 0 0 24px rgba(var(--ice-rgb), 0.12), 0 12px 28px rgba(0, 0, 0, 0.3);
}

.brand-mark span {
  position: relative;
  z-index: 2;
  color: #f7fbfd;
  font-size: 23px;
  font-weight: 850;
}

.brand-mark i {
  position: absolute;
  width: 70px;
  height: 2px;
  background: var(--ice);
  box-shadow: 0 0 18px rgba(var(--ice-rgb), 0.8);
  transform: rotate(-48deg);
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand-eyebrow,
.section-overline,
.schedule-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

h1 {
  font-size: 21px;
  font-weight: 760;
  line-height: 1.1;
}

#statusLine {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  width: min(610px, 57vw);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 18, 23, 0.94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 720;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.tab svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
}

.tab:hover {
  color: var(--text);
}

.tab:active {
  transform: scale(0.98);
}

.tab.active {
  color: var(--text);
  background: var(--surface-4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.tab.active::before {
  position: absolute;
  right: 12px;
  bottom: 5px;
  left: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ice), transparent);
  content: "";
}

/* Page and shared surfaces */

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
  animation: page-in 260ms ease both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.device-view-nav {
  position: sticky;
  top: 75px;
  z-index: 42;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(620px, 100%);
  margin: 0 auto 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 12, 16, 0.94);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px) saturate(130%);
}

.device-view-tab {
  position: relative;
  min-width: 0;
  min-height: 42px;
  padding: 0 8px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 730;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease;
}

.device-view-tab:hover {
  color: var(--text);
}

.device-view-tab.active {
  background: var(--surface-4);
  color: var(--text);
}

.device-view-tab.active::after {
  position: absolute;
  right: 15%;
  bottom: 3px;
  left: 15%;
  height: 2px;
  border-radius: 1px;
  background: var(--ice);
  box-shadow: 0 0 12px rgba(var(--ice-rgb), 0.55);
  content: "";
}

[data-deck-nav="xiaomi"] .device-view-tab.active::after {
  background: var(--mint);
  box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.55);
}

.device-deck {
  display: flex;
  align-items: flex-start;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  transition: height 220ms ease;
  -webkit-overflow-scrolling: touch;
}

.device-deck::-webkit-scrollbar {
  display: none;
}

.device-deck:focus-visible {
  outline: 2px solid rgba(var(--ice-rgb), 0.65);
  outline-offset: 3px;
}

.device-panel {
  min-width: 0;
  flex: 0 0 100%;
  padding: 0 1px 2px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.device-panel > .card,
.device-panel > .schedule-mount {
  width: 100%;
}

.schedule-panel .schedule-workspace {
  margin-top: 0;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(360px, 0.95fr);
  align-items: stretch;
  gap: 12px;
}

.card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 17, 22, 0.96);
  box-shadow: var(--shadow);
}

.card-title {
  color: var(--text);
  font-size: 19px;
  font-weight: 730;
  line-height: 1.2;
  text-transform: none;
}

.card-head,
.deck-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.deck-head {
  display: grid;
  justify-content: stretch;
  gap: 3px;
  padding-bottom: 16px;
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.badge.ok {
  border-color: rgba(var(--mint-rgb), 0.35);
  color: var(--mint);
  background: rgba(var(--mint-rgb), 0.08);
}

.badge.bad {
  border-color: rgba(255, 114, 102, 0.35);
  color: var(--danger);
  background: rgba(255, 114, 102, 0.08);
}

/* Premium stages */

.hero-card {
  position: relative;
  isolation: isolate;
  min-height: 690px;
  overflow: hidden;
}

.climate-stage {
  --mode-rgb: 101, 221, 255;
  display: flex;
  flex-direction: column;
  border-color: rgba(var(--mode-rgb), 0.20);
  background: #091015;
  box-shadow: inset 0 0 130px rgba(var(--mode-rgb), 0.045), var(--shadow);
  transition: border-color 320ms ease, box-shadow 320ms ease;
}

.climate-stage[data-mode="auto"] { --mode-rgb: 97, 232, 197; }
.climate-stage[data-mode="cool"] { --mode-rgb: 90, 210, 255; }
.climate-stage[data-mode="dry"] { --mode-rgb: 181, 151, 255; }
.climate-stage[data-mode="fan"] { --mode-rgb: 163, 232, 189; }
.climate-stage[data-mode="heat"] { --mode-rgb: 255, 151, 91; }
.climate-stage[data-powered="true"] { border-color: rgba(var(--mode-rgb), 0.42); }

.purifier-stage {
  --quality-rgb: 128, 145, 162;
  display: flex;
  flex-direction: column;
  border-color: rgba(var(--quality-rgb), 0.20);
  background: #0b0f12;
  box-shadow: inset 0 0 130px rgba(var(--quality-rgb), 0.04), var(--shadow);
  transition: border-color 320ms ease, box-shadow 320ms ease;
}

.purifier-stage[data-quality="verygood"] { --quality-rgb: 79, 231, 166; }
.purifier-stage[data-quality="good"] { --quality-rgb: 160, 225, 95; }
.purifier-stage[data-quality="moderate"] { --quality-rgb: 255, 194, 92; }
.purifier-stage[data-quality="bad"] { --quality-rgb: 255, 117, 93; }
.purifier-stage[data-quality="verybad"] { --quality-rgb: 255, 82, 132; }
.purifier-stage[data-powered="true"] { border-color: rgba(var(--quality-rgb), 0.42); }

.environment-canvas,
.stage-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.environment-canvas {
  z-index: -1;
}

.stage-grid {
  z-index: -2;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 72%);
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

.hero-head {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.stage-device {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.section-overline {
  color: rgba(var(--mode-rgb, var(--ice-rgb)), 0.82);
}

.purifier-stage .section-overline {
  color: rgba(var(--quality-rgb), 0.82);
}

.device-picker {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
}

.device-picker .empty {
  max-width: 420px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}

.device-chip {
  display: grid;
  min-width: 150px;
  max-width: 280px;
  gap: 2px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(6, 10, 13, 0.72);
  color: var(--muted-strong);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.device-chip:hover {
  border-color: var(--line-strong);
}

.device-chip:active {
  transform: scale(0.985);
}

.device-chip strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-chip small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-chip.active {
  border-color: rgba(var(--mode-rgb, var(--ice-rgb)), 0.52);
  background: rgba(var(--mode-rgb, var(--ice-rgb)), 0.09);
  box-shadow: inset 3px 0 0 rgb(var(--mode-rgb, var(--ice-rgb)));
}

.purifier-stage .device-chip.active {
  border-color: rgba(var(--quality-rgb), 0.52);
  background: rgba(var(--quality-rgb), 0.09);
  box-shadow: inset 3px 0 0 rgb(var(--quality-rgb));
}

.device-chip.error {
  border-color: rgba(255, 114, 102, 0.48);
}

.power-cluster {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 5px;
}

.power-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.switch {
  position: relative;
  display: inline-block;
  width: 49px;
  height: 28px;
  flex: 0 0 auto;
}

.switch.big {
  width: 67px;
  height: 38px;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch > span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #131a21;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.switch > span::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #82909b;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  content: "";
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.switch.big > span::before {
  width: 30px;
  height: 30px;
}

.switch input:checked + span {
  border-color: rgba(var(--mint-rgb), 0.62);
  background: rgba(var(--mint-rgb), 0.19);
  box-shadow: 0 0 26px rgba(var(--mint-rgb), 0.14);
}

.switch input:checked + span::before {
  background: var(--mint);
  box-shadow: 0 0 16px rgba(var(--mint-rgb), 0.62);
  transform: translateX(21px);
}

.switch.big input:checked + span::before {
  transform: translateX(29px);
}

/* Climate instrument */

.climate-instrument {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 72px minmax(250px, 1fr) 72px;
  align-items: center;
  gap: 18px;
  width: min(100%, 620px);
  margin: 22px auto 18px;
}

.round {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(var(--mode-rgb), 0.28);
  border-radius: 50%;
  background: rgba(7, 12, 16, 0.76);
  color: rgb(var(--mode-rgb));
  cursor: pointer;
  box-shadow: inset 0 0 22px rgba(var(--mode-rgb), 0.06), 0 14px 30px rgba(0, 0, 0, 0.28);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.round:hover {
  border-color: rgba(var(--mode-rgb), 0.65);
  background: rgba(var(--mode-rgb), 0.09);
}

.round:active {
  transform: scale(0.92);
}

.climate-halo {
  position: relative;
  display: grid;
  place-items: center;
  width: 330px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  border: 1px solid rgba(var(--mode-rgb), 0.23);
  border-radius: 50%;
  background:
    conic-gradient(from 205deg, rgba(var(--mode-rgb), 0.05), rgba(var(--mode-rgb), 0.45) 33%, rgba(var(--mode-rgb), 0.08) 67%, rgba(var(--mode-rgb), 0.05)),
    #091116;
  box-shadow: inset 0 0 70px rgba(var(--mode-rgb), 0.08), 0 0 70px rgba(var(--mode-rgb), 0.08);
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

.climate-halo::before {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(var(--mode-rgb), 0.16);
  border-radius: 50%;
  background: #091015;
  content: "";
}

.climate-halo::after {
  position: absolute;
  inset: 26px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  content: "";
}

.climate-stage[data-powered="true"] .climate-halo {
  animation: instrument-breathe 4.8s ease-in-out infinite;
}

@keyframes instrument-breathe {
  0%, 100% { box-shadow: inset 0 0 70px rgba(var(--mode-rgb), 0.07), 0 0 58px rgba(var(--mode-rgb), 0.07); }
  50% { box-shadow: inset 0 0 90px rgba(var(--mode-rgb), 0.13), 0 0 86px rgba(var(--mode-rgb), 0.13); }
}

.halo-scale {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(var(--mode-rgb), 0.42) 0deg 0.6deg, transparent 0.6deg 9deg);
  -webkit-mask-image: radial-gradient(circle, transparent 0 78%, black 79% 81%, transparent 82%);
  mask-image: radial-gradient(circle, transparent 0 78%, black 79% 81%, transparent 82%);
  opacity: 0.58;
}

.temp-readout {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  gap: 3px;
  text-align: center;
}

.visual-caption {
  min-height: 15px;
  color: rgb(var(--mode-rgb));
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.temp-value {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 116px;
  font-variant-numeric: tabular-nums;
}

.temp-value strong {
  min-width: 145px;
  color: #f8fbfd;
  font-size: 100px;
  font-weight: 260;
  line-height: 1;
  text-shadow: 0 0 34px rgba(var(--mode-rgb), 0.22);
}

.temp-unit {
  margin-top: 15px;
  color: rgb(var(--mode-rgb));
  font-size: 23px;
  font-weight: 500;
}

.temp-label {
  color: var(--muted);
  font-size: 11px;
}

.stat-strip {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(6, 10, 13, 0.52);
  backdrop-filter: blur(10px);
}

.telemetry-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.telemetry-strip > div {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 13px 14px;
  border-left: 1px solid var(--line);
}

.telemetry-strip > div:first-child {
  border-left: 0;
}

.telemetry-strip span,
.stat-mini span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
}

.telemetry-strip strong,
.stat-mini strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-control-block {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding-top: 17px;
}

.control-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.control-caption small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: none;
}

.control-caption.compact {
  margin-top: 11px;
}

.chip-group {
  display: grid;
  gap: 7px;
  margin: 0;
}

.mode-dock {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.fan-dock {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 46px;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(15, 22, 28, 0.88);
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 690;
  text-overflow: ellipsis;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.chip svg {
  flex: 0 0 auto;
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.chip:active {
  transform: scale(0.975);
}

[data-group] .chip.active {
  border-color: rgba(var(--mode-rgb), 0.52);
  background: rgba(var(--mode-rgb), 0.11);
  color: rgb(var(--mode-rgb));
  box-shadow: inset 0 -2px 0 rgba(var(--mode-rgb), 0.82), 0 0 20px rgba(var(--mode-rgb), 0.07);
}

[data-xgroup] .chip.active,
#xiaomiFanGroup .chip.active {
  border-color: rgba(var(--mint-rgb), 0.50);
  background: rgba(var(--mint-rgb), 0.10);
  color: var(--mint);
  box-shadow: inset 0 -2px 0 rgba(var(--mint-rgb), 0.8), 0 0 20px rgba(var(--mint-rgb), 0.07);
}

.chip-group.small .chip {
  min-height: 40px;
  font-size: 11.5px;
}

/* Control decks */

.control-deck {
  min-height: 690px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.016), transparent 40%), var(--surface);
}

.control-section {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.control-section-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  text-transform: uppercase;
}

.pill-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.pill {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 11.5px;
  line-height: 1.2;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.pill input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 0;
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #090d11;
  cursor: pointer;
}

.pill input:checked {
  border-color: var(--mint);
  background-color: var(--mint);
  background-image:
    linear-gradient(45deg, transparent 42%, #07110d 43% 54%, transparent 55%),
    linear-gradient(-45deg, transparent 46%, #07110d 47% 58%, transparent 59%);
  background-position: 1px 2px, 7px -2px;
  background-size: 8px 12px;
  background-repeat: no-repeat;
}

.pill:has(input:checked) {
  border-color: rgba(var(--mint-rgb), 0.38);
  background: rgba(var(--mint-rgb), 0.075);
  color: var(--text);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted-strong);
  font-size: 11.5px;
}

.field.grow {
  flex: 1;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: #090e13;
  color: var(--text);
  font-size: 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input::placeholder {
  color: #5d6a74;
}

input:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus {
  border-color: rgba(var(--ice-rgb), 0.64);
  box-shadow: 0 0 0 3px rgba(var(--ice-rgb), 0.08);
  background: #0b1117;
}

.slider-row {
  display: flex;
  align-items: end;
  gap: 9px;
}

.slider-row .field {
  margin-bottom: 0;
}

input[type="range"] {
  min-height: 34px;
  padding: 0;
  border: 0;
  box-shadow: none;
  appearance: none;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--ice), var(--mint));
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  appearance: none;
  border: 3px solid #071017;
  border-radius: 50%;
  background: var(--ice);
  box-shadow: 0 0 0 1px rgba(var(--ice-rgb), 0.7), 0 0 15px rgba(var(--ice-rgb), 0.35);
}

button.primary,
button.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 15px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 760;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

button.primary {
  border: 1px solid rgba(var(--ice-rgb), 0.7);
  background: var(--ice);
  color: #031016;
  box-shadow: 0 8px 24px rgba(var(--ice-rgb), 0.15);
}

button.primary:hover {
  background: #91e8ff;
  box-shadow: 0 10px 28px rgba(var(--ice-rgb), 0.22);
}

button.ghost {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted-strong);
}

button.ghost:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

button.primary:active,
button.ghost:active {
  transform: scale(0.975);
}

button.danger {
  border-color: rgba(255, 114, 102, 0.25);
  color: var(--danger);
}

button.danger:hover {
  border-color: rgba(255, 114, 102, 0.55);
  background: rgba(255, 114, 102, 0.08);
}

/* Purifier visualization */

.purifier-scene {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(170px, 0.75fr) minmax(270px, 1.25fr);
  align-items: center;
  min-height: 455px;
  gap: 12px;
  padding: 12px 8px 0;
}

.air-quality-copy {
  display: grid;
  align-content: center;
  justify-items: start;
  min-width: 0;
  gap: 7px;
}

.aqi-label {
  display: block;
  max-width: 280px;
  color: rgb(var(--quality-rgb));
  font-size: 38px;
  font-weight: 350;
  line-height: 1.05;
  text-shadow: 0 0 28px rgba(var(--quality-rgb), 0.15);
}

.aqi-label.q-verygood { color: #4fe7a6; }
.aqi-label.q-good { color: #a0e15f; }
.aqi-label.q-moderate { color: #ffc25c; }
.aqi-label.q-bad { color: #ff755d; }
.aqi-label.q-verybad { color: #ff5284; }

.purifier-machine-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 430px;
  perspective: 900px;
}

.purifier-machine-shadow {
  position: absolute;
  bottom: 12px;
  width: 230px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  filter: blur(8px);
}

.purifier-machine {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: 46px 1fr 17px;
  width: 214px;
  height: 368px;
  filter: drop-shadow(0 28px 28px rgba(0, 0, 0, 0.48));
  transform: rotateY(-4deg);
  transition: filter 300ms ease, transform 300ms ease;
}

.purifier-stage[data-powered="true"] .purifier-machine {
  filter: drop-shadow(0 30px 35px rgba(var(--quality-rgb), 0.14));
  animation: purifier-float 5s ease-in-out infinite;
}

@keyframes purifier-float {
  0%, 100% { transform: translateY(0) rotateY(-4deg); }
  50% { transform: translateY(-5px) rotateY(-2deg); }
}

.purifier-top {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 0;
  border-radius: 8px 8px 4px 4px;
  background: #1b2024;
  box-shadow: inset 0 8px 18px rgba(255, 255, 255, 0.035);
}

.purifier-top span {
  border-radius: 2px;
  background: #060708;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.purifier-body {
  position: relative;
  display: grid;
  place-items: start center;
  padding-top: 50px;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  border-left: 1px solid rgba(255, 255, 255, 0.4);
  background: linear-gradient(90deg, #dce2e3, #f7f9f8 48%, #cbd2d3);
}

.purifier-body::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.5), transparent 35%, rgba(0, 0, 0, 0.05));
  content: "";
}

.aqi-ring {
  --ring-color: var(--mint);
  --ring-pct: 0%;
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  padding: 5px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) var(--ring-pct), rgba(255, 255, 255, 0.13) var(--ring-pct));
  box-shadow: 0 0 28px rgba(var(--quality-rgb), 0.18), inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  transition: background 400ms ease, box-shadow 400ms ease;
}

.aqi-inner {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  align-content: center;
  border-radius: 50%;
  background: #080c0f;
  box-shadow: inset 0 0 24px rgba(var(--quality-rgb), 0.08);
}

.aqi-inner strong {
  color: #f7faf9;
  font-size: 48px;
  font-weight: 300;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.aqi-inner span {
  margin-top: 5px;
  color: rgb(var(--quality-rgb));
  font-size: 10px;
  font-weight: 760;
}

.aqi-inner small {
  color: #8d9a9f;
  font-size: 9px;
}

.purifier-intake {
  position: absolute;
  right: 24px;
  bottom: 26px;
  left: 24px;
  height: 112px;
  opacity: 0.34;
  background-image: radial-gradient(circle, #5f6668 1px, transparent 1.4px);
  background-size: 7px 7px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 25% 80%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 25% 80%, transparent);
}

.purifier-base {
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-top: 0;
  border-radius: 2px 2px 8px 8px;
  background: linear-gradient(90deg, #bac2c4, #eef2f1 48%, #abb4b6);
}

.air-telemetry {
  z-index: 3;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: auto;
}

.purifier-controls .air-mode-dock {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#xiaomiFanGroup {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-pills {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.purifier-display-controls .compact-pills {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.display-control-grid {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
}

.display-preview {
  --display-color: var(--mint);
  position: relative;
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: #080c0f;
  color: var(--text);
  box-shadow: inset 0 0 70px color-mix(in srgb, var(--display-color) 10%, transparent);
  transition: border-color 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}

.display-preview::before {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 6px;
  content: "";
}

.display-preview-ring {
  position: relative;
  width: 92px;
  height: 92px;
  border: 2px solid color-mix(in srgb, var(--display-color) 78%, white 8%);
  border-radius: 50%;
  box-shadow: 0 0 22px color-mix(in srgb, var(--display-color) 35%, transparent), inset 0 0 18px color-mix(in srgb, var(--display-color) 20%, transparent);
  transition: opacity 220ms ease, filter 220ms ease, box-shadow 220ms ease;
}

.display-preview-ring::before,
.display-preview-ring::after,
.display-preview-ring span {
  position: absolute;
  border-radius: 50%;
  background: var(--display-color);
  box-shadow: 0 0 9px color-mix(in srgb, var(--display-color) 65%, transparent);
  content: "";
}

.display-preview-ring::before { top: 15px; left: 43px; width: 4px; height: 4px; }
.display-preview-ring::after { right: 18px; bottom: 25px; width: 3px; height: 3px; }
.display-preview-ring span { bottom: 19px; left: 22px; width: 5px; height: 5px; }

.display-preview strong {
  position: relative;
  font-size: 15px;
}

.display-preview small {
  position: relative;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.display-preview[data-screen-level="off"],
.display-preview[data-screen-level="unknown"] {
  border-color: var(--line);
  box-shadow: none;
}

.display-preview[data-screen-level="off"] .display-preview-ring,
.display-preview[data-screen-level="unknown"] .display-preview-ring {
  opacity: 0.16;
  filter: grayscale(1);
  box-shadow: none;
}

.display-preview[data-screen-level="dim"] .display-preview-ring {
  opacity: 0.55;
}

.display-preview[data-screen-level="bright"] {
  border-color: color-mix(in srgb, var(--display-color) 34%, var(--line));
}

.display-preview[data-screen-level="bright"] .display-preview-ring {
  box-shadow: 0 0 34px color-mix(in srgb, var(--display-color) 52%, transparent), inset 0 0 24px color-mix(in srgb, var(--display-color) 28%, transparent);
}

.screen-levels {
  display: grid;
  align-content: center;
  gap: 7px;
}

.screen-levels button {
  min-height: 58px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted-strong);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 720;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.screen-levels button:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.screen-levels button.active {
  border-color: rgba(var(--mint-rgb), 0.48);
  background: rgba(var(--mint-rgb), 0.09);
  color: var(--mint);
  box-shadow: inset 3px 0 0 var(--mint);
}

.display-color-status {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.display-color-status strong {
  color: var(--text);
  font-size: 11px;
}

.quality-swatches {
  display: flex;
  align-items: center;
  gap: 4px;
}

.quality-swatches i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 7px rgba(74, 222, 128, 0.35);
}

.quality-swatches i:nth-child(2) { background: #a3e635; }
.quality-swatches i:nth-child(3) { background: #e3b341; }
.quality-swatches i:nth-child(4) { background: #f2705d; }

.filter-row {
  display: grid;
  gap: 8px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.filter-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.filter-info strong {
  color: var(--text);
  font-size: 13px;
}

.progress {
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-4);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--mint), var(--ice));
  box-shadow: 0 0 16px rgba(var(--mint-rgb), 0.35);
  transition: width 420ms ease;
}

.progress-fill.low {
  background: var(--danger);
  box-shadow: 0 0 16px rgba(255, 114, 102, 0.35);
}

/* Details and setup */

.raw-box,
.connection-tool {
  margin-top: 11px;
  border-top: 1px solid var(--line);
  background: transparent;
}

.raw-box summary,
.connection-tool summary {
  min-height: 43px;
  padding: 13px 2px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 650;
  list-style-position: inside;
}

.raw-box[open] summary,
.connection-tool[open] summary {
  color: var(--text);
}

.raw-box pre {
  max-height: 260px;
  margin: 0 0 10px;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #06090c;
  color: #8ea0ad;
  font: 11px/1.5 "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.raw-box .field,
.connection-tool .field {
  margin-top: 8px;
}

.step-box {
  margin: 4px 0 14px;
  padding: 6px 0 6px 12px;
  border-left: 2px solid rgba(var(--ice-rgb), 0.28);
}

.step-box h3 {
  margin-bottom: 10px;
  color: var(--muted-strong);
  font-size: 12px;
}

.step-no {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  margin-right: 5px;
  border: 1px solid rgba(var(--ice-rgb), 0.35);
  border-radius: 5px;
  color: var(--ice);
  font-size: 10px;
}

.help-body {
  display: grid;
  gap: 8px;
  padding: 3px 0 12px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.help-body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--muted-strong);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.setup-card > button.danger {
  width: 100%;
  margin-top: 13px;
}

/* Schedule */

.schedule-mount,
.schedule-workspace {
  min-width: 0;
}

.schedule-workspace {
  margin-top: 24px;
}

.schedule-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
  padding: 0 2px;
}

.schedule-section-head h2 {
  margin-top: 3px;
  font-size: 24px;
  font-weight: 680;
  line-height: 1.2;
}

.schedule-section-head .hint {
  margin: 5px 0 0;
}

.schedule-kicker {
  color: var(--amber);
}

.schedule-count {
  flex: 0 0 auto;
  min-height: 31px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 189, 105, 0.28);
  border-radius: 7px;
  background: rgba(255, 189, 105, 0.06);
  color: var(--amber);
  font-size: 11px;
  font-weight: 720;
}

.schedule-grid {
  grid-template-columns: minmax(310px, 0.78fr) minmax(0, 1.72fr);
}

.schedule-grid > .card {
  min-height: 100%;
}

.schedule-grid > .card:first-child {
  border-color: rgba(255, 189, 105, 0.17);
}

.schedule-grid .card-title {
  margin-bottom: 15px;
  font-size: 16px;
}

.schedule-extras {
  margin-bottom: 2px;
}

.day-chips {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.day-chips .chip {
  min-height: 38px;
  padding: 0 5px;
}

.day-chips .chip.active {
  border-color: rgba(255, 189, 105, 0.5);
  background: rgba(255, 189, 105, 0.10);
  color: var(--amber);
  box-shadow: inset 0 -2px 0 rgba(255, 189, 105, 0.72);
}

.day-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 5px;
}

button.link {
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10.5px;
}

button.link:hover {
  color: var(--amber);
}

#scheduleAddBtn {
  width: 100%;
  border-color: rgba(255, 189, 105, 0.7);
  background: var(--amber);
  color: #171006;
  box-shadow: 0 8px 24px rgba(255, 189, 105, 0.12);
}

#scheduleAddBtn:hover {
  background: #ffca84;
}

.schedule-list {
  display: grid;
  gap: 8px;
}

.schedule-list .empty {
  padding: 34px 4px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.schedule-item {
  position: relative;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  gap: 15px;
  padding: 14px 14px 14px 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.schedule-item::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--amber);
  content: "";
  box-shadow: 0 0 16px rgba(255, 189, 105, 0.3);
}

.schedule-item.disabled {
  opacity: 0.46;
}

.schedule-time {
  display: grid;
  gap: 3px;
}

.schedule-time strong {
  color: var(--text);
  font-size: 27px;
  font-weight: 450;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.schedule-time small {
  color: var(--amber);
  font-size: 10px;
}

.schedule-info {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.schedule-info .title {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
}

.schedule-info .meta,
.schedule-info .result {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.schedule-info .result.ok { color: var(--mint); }
.schedule-info .result.bad { color: var(--danger); }

.schedule-actions {
  display: grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0b1015;
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn.danger:hover {
  border-color: rgba(255, 114, 102, 0.55);
  color: var(--danger);
}

/* Network */

.network-topology {
  position: relative;
  min-height: 250px;
  margin-bottom: 12px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background-color: rgba(9, 13, 17, 0.78);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 30px 30px;
}

.network-node {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 160px;
  min-height: 72px;
  align-content: center;
  gap: 3px;
  padding: 12px 14px 12px 31px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(11, 17, 22, 0.94);
  box-shadow: 0 15px 34px rgba(0, 0, 0, 0.3);
}

.network-node::before {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #58646d;
  content: "";
  transform: translateY(-50%);
}

.network-node.online::before {
  background: var(--mint);
  box-shadow: 0 0 14px rgba(var(--mint-rgb), 0.65);
}

.network-node span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.network-node strong {
  color: var(--text);
  font-size: 14px;
}

.node-cloud { top: 86px; left: 5%; }
.node-pi { top: 86px; left: 39%; border-color: rgba(var(--ice-rgb), 0.32); }
.node-gree { top: 32px; right: 5%; }
.node-xiaomi { right: 5%; bottom: 32px; }

.network-path {
  position: absolute;
  z-index: 1;
  height: 1px;
  overflow: visible;
  border-top: 1px dashed rgba(var(--ice-rgb), 0.25);
}

.network-path i {
  position: absolute;
  top: -2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ice);
  box-shadow: 0 0 12px rgba(var(--ice-rgb), 0.7);
  animation: path-pulse 2.8s linear infinite;
}

.path-cloud {
  top: 121px;
  left: calc(5% + 160px);
  width: calc(34% - 160px);
}

.path-gree {
  top: 93px;
  left: calc(39% + 160px);
  width: calc(56% - 39% - 160px);
  transform: rotate(-12deg);
  transform-origin: left;
}

.path-xiaomi {
  top: 151px;
  left: calc(39% + 160px);
  width: calc(56% - 39% - 160px);
  transform: rotate(12deg);
  transform-origin: left;
}

@keyframes path-pulse {
  from { left: 0; opacity: 0; }
  12%, 88% { opacity: 1; }
  to { left: 100%; opacity: 0; }
}

.network-grid {
  align-items: start;
}

.xiaomi-setup-mount {
  min-width: 0;
}

.xiaomi-setup-mount .setup-card {
  min-height: 100%;
}

.log-card {
  grid-column: 1 / -1;
}

.device-admin {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.device-admin .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.device-admin .row small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.log-list {
  display: grid;
  max-height: 310px;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0 0 0 20px;
  overflow: auto;
}

.log-list li {
  padding: 5px 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font: 10.5px/1.45 "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
}

.log-list li.ok { color: var(--mint); }
.log-list li.warn { color: var(--amber); }
.log-list li.bad { color: var(--danger); }

/* Toasts */

.toast-host {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 80;
  display: grid;
  width: min(430px, calc(100vw - 24px));
  gap: 7px;
  transform: translateX(-50%);
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(17, 24, 32, 0.97);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  backdrop-filter: blur(14px);
  animation: toast-in 180ms ease both;
}

.toast.ok { border-color: rgba(var(--mint-rgb), 0.45); }
.toast.bad { border-color: rgba(255, 114, 102, 0.55); }
.toast.warn { border-color: rgba(255, 189, 105, 0.55); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */

@media (max-width: 1120px) {
  .page-grid,
  .schedule-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-card,
  .control-deck {
    min-height: auto;
  }

  .control-deck {
    box-shadow: none;
  }

  .log-card {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  html {
    scrollbar-gutter: auto;
  }

  body {
    min-height: 100svh;
    background-size: 28px 28px;
  }

  .shell {
    width: 100%;
    max-width: 100vw;
    padding: 8px 9px 98px;
    padding-bottom: calc(98px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: static;
    min-height: 60px;
    margin-bottom: 8px;
    padding: 7px 1px 8px;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand-mark span {
    font-size: 20px;
  }

  .brand-eyebrow {
    display: none;
  }

  h1 {
    font-size: 18px;
  }

  #statusLine {
    max-width: calc(100vw - 78px);
    font-size: 10.5px;
  }

  .tabs {
    position: fixed;
    right: 9px;
    bottom: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 9px;
    z-index: 90;
    width: auto;
    max-width: calc(100vw - 18px);
    padding: 5px;
    border-color: rgba(255, 255, 255, 0.13);
    background: rgba(8, 12, 16, 0.96);
    box-shadow: 0 20px 46px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(20px) saturate(140%);
  }

  .tab {
    min-height: 57px;
    flex-direction: column;
    gap: 4px;
    padding: 5px 2px;
    font-size: 0;
  }

  .tab::after {
    color: currentColor;
    content: attr(data-short);
    font-size: 10.5px;
    font-weight: 740;
    line-height: 1;
  }

  .tab.active::before {
    right: 18px;
    bottom: 3px;
    left: 18px;
  }

  .tab svg {
    width: 19px;
    height: 19px;
  }

  .tab-page.active {
    animation-duration: 180ms;
  }

  .device-view-nav {
    top: 0;
    width: 100%;
    margin-bottom: 8px;
    padding: 3px;
    background: rgba(8, 12, 16, 0.97);
    box-shadow: 0 9px 24px rgba(0, 0, 0, 0.34);
  }

  .device-view-tab {
    min-height: 40px;
    padding: 0 3px;
    font-size: 10.5px;
  }

  .device-panel {
    padding: 0;
  }

  .page-grid,
  .schedule-grid,
  .card,
  .hero-card,
  .control-deck,
  .chip-group,
  .pill-toggles,
  .stat-strip {
    min-width: 0;
    max-width: 100%;
  }

  .page-grid,
  .schedule-grid {
    gap: 9px;
  }

  .card {
    padding: 13px;
    box-shadow: none;
  }

  .hero-card {
    min-height: 0;
  }

  .stage-head {
    gap: 10px;
  }

  .stage-device {
    flex: 1;
  }

  .device-picker {
    max-width: calc(100vw - 105px);
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .device-picker::-webkit-scrollbar {
    display: none;
  }

  .device-chip {
    flex: 0 0 auto;
    min-width: min(190px, calc(100vw - 122px));
    max-width: min(220px, calc(100vw - 112px));
  }

  .power-label {
    display: none;
  }

  .switch.big {
    width: 62px;
    height: 36px;
  }

  .switch.big > span::before {
    width: 28px;
    height: 28px;
  }

  .switch.big input:checked + span::before {
    transform: translateX(26px);
  }

  .climate-instrument {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
    gap: 7px;
    margin: 18px auto 14px;
  }

  .round {
    width: 52px;
    height: 52px;
  }

  .climate-halo {
    width: 232px;
  }

  .temp-value {
    min-height: 87px;
  }

  .temp-value strong {
    min-width: 105px;
    font-size: 72px;
  }

  .temp-unit {
    margin-top: 10px;
    font-size: 18px;
  }

  .visual-caption {
    font-size: 9px;
  }

  .telemetry-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .telemetry-strip > div {
    min-height: 58px;
    padding: 10px;
    border-top: 1px solid var(--line);
  }

  .telemetry-strip > div:nth-child(-n + 2) {
    border-top: 0;
  }

  .telemetry-strip > div:nth-child(odd) {
    border-left: 0;
  }

  .telemetry-strip strong {
    font-size: 14px;
  }

  .stage-control-block {
    padding-top: 14px;
  }

  .control-caption small {
    display: none;
  }

  .mode-dock {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-dock .chip:last-child {
    grid-column: 1 / -1;
  }

  .fan-dock {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .fan-dock .chip {
    min-height: 39px;
    padding: 0 4px;
    font-size: 10px;
  }

  .chip {
    min-height: 47px;
    padding: 0 8px;
    font-size: 11.5px;
    white-space: normal;
  }

  .control-deck {
    padding: 14px;
  }

  .deck-head {
    padding-bottom: 12px;
  }

  .card-title {
    font-size: 17px;
  }

  .control-section {
    padding: 13px 0;
  }

  .pill-toggles,
  .compact-pills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purifier-display-controls .compact-pills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .display-control-grid {
    grid-template-columns: minmax(105px, 0.8fr) minmax(0, 1.2fr);
    gap: 7px;
  }

  .display-preview {
    min-height: 186px;
    gap: 6px;
  }

  .display-preview-ring {
    width: 76px;
    height: 76px;
  }

  .display-preview-ring::before { top: 12px; left: 35px; }
  .display-preview-ring::after { right: 15px; bottom: 20px; }
  .display-preview-ring span { bottom: 15px; left: 18px; }

  .display-preview strong {
    font-size: 12px;
  }

  .display-preview small {
    font-size: 8px;
  }

  .screen-levels {
    gap: 6px;
  }

  .screen-levels button {
    min-height: 58px;
    padding: 0 10px;
    font-size: 11px;
  }

  .display-color-status {
    gap: 7px;
    padding: 9px;
    font-size: 10px;
  }

  .display-color-status strong {
    font-size: 10px;
  }

  .pill {
    min-height: 45px;
    padding: 7px 8px;
    font-size: 11px;
  }

  .field-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  input,
  select {
    min-height: 46px;
    font-size: 16px;
  }

  .slider-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .slider-row button {
    width: 100%;
  }

  input[type="range"] {
    min-height: 38px;
  }

  .purifier-scene {
    grid-template-columns: minmax(0, 1fr);
    min-height: 470px;
    gap: 0;
    padding-top: 20px;
  }

  .air-quality-copy {
    justify-items: center;
    text-align: center;
  }

  .aqi-label {
    max-width: 100%;
    font-size: 29px;
  }

  .purifier-machine-wrap {
    min-height: 365px;
  }

  .purifier-machine {
    grid-template-rows: 38px 1fr 14px;
    width: 172px;
    height: 304px;
  }

  .purifier-top {
    gap: 4px;
    padding: 10px 12px;
  }

  .purifier-body {
    padding-top: 35px;
  }

  .aqi-ring {
    width: 112px;
    height: 112px;
  }

  .aqi-inner strong {
    font-size: 41px;
  }

  .purifier-intake {
    right: 20px;
    bottom: 20px;
    left: 20px;
    height: 90px;
  }

  .purifier-machine-shadow {
    width: 190px;
  }

  .air-telemetry {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .air-telemetry > div,
  .air-telemetry > div:nth-child(-n + 2),
  .air-telemetry > div:nth-child(odd) {
    min-height: 57px;
    padding: 9px 7px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .air-telemetry > div:first-child {
    border-left: 0;
  }

  .air-telemetry span {
    font-size: 8.5px;
  }

  .air-telemetry strong {
    font-size: 12px;
  }

  .schedule-workspace {
    margin-top: 18px;
  }

  .schedule-section-head {
    align-items: start;
    gap: 10px;
    margin-bottom: 9px;
  }

  .schedule-section-head h2 {
    font-size: 19px;
  }

  .schedule-section-head .hint {
    max-width: 230px;
    font-size: 10.5px;
  }

  .schedule-count {
    min-height: 29px;
    padding: 6px 8px;
    font-size: 10px;
  }

  .day-chips {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .schedule-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 13px 12px 13px 16px;
  }

  .schedule-time {
    grid-template-columns: auto 1fr;
    align-items: end;
    gap: 9px;
  }

  .schedule-time strong {
    font-size: 25px;
  }

  .schedule-actions {
    justify-content: end;
  }

  .icon-btn {
    width: 43px;
    height: 43px;
  }

  .network-topology {
    min-height: 270px;
  }

  .network-node {
    width: calc(50% - 20px);
    min-height: 68px;
    padding-left: 28px;
  }

  .node-cloud { top: 20px; left: 10px; }
  .node-pi { top: 20px; right: 10px; left: auto; }
  .node-gree { top: 112px; left: 10px; right: auto; }
  .node-xiaomi { top: 112px; right: 10px; bottom: auto; }

  .network-path {
    display: none;
  }

  .log-list {
    max-height: 44vh;
  }

  .toast-host {
    bottom: 82px;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 370px) {
  .climate-instrument {
    grid-template-columns: 47px minmax(0, 1fr) 47px;
  }

  .round {
    width: 46px;
    height: 46px;
  }

  .climate-halo {
    width: 212px;
  }

  .temp-value strong {
    min-width: 95px;
    font-size: 66px;
  }

  .tab::after {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Full-screen device experience */

.visually-hidden {
  display: none !important;
}

.device-view-tab {
  transition: color 70ms linear, background 70ms linear, box-shadow 70ms linear;
}

.device-deck {
  scroll-behavior: auto;
  transition: height 120ms ease-out;
}

.device-panel[aria-hidden="false"] > .card,
.device-panel[aria-hidden="false"] .routine-shell {
  animation: panel-focus 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes panel-focus {
  from { opacity: 0.72; transform: scale(0.992); }
  to { opacity: 1; transform: scale(1); }
}

/* Airflow */

#climateAirflow {
  --airflow-rgb: 101, 221, 255;
  display: flex;
  flex-direction: column;
  border-color: rgba(var(--airflow-rgb), 0.22);
  background: #091015;
  box-shadow: inset 0 0 110px rgba(var(--airflow-rgb), 0.045), var(--shadow);
}

.airflow-visual {
  --flow-origin-y: 101px;
  --flow-length: 44%;
  --horizontal-angle: 0deg;
  --horizontal-shift: 0px;
  --horizontal-sweep: 74px;
  --target-y: calc(var(--flow-origin-y) + var(--flow-length));
  position: relative;
  min-height: 270px;
  margin: 2px 0 16px;
  overflow: hidden;
  border: 1px solid rgba(var(--airflow-rgb), 0.14);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    #080e13;
  background-size: 24px 24px;
}

.airflow-visual::before {
  position: absolute;
  top: var(--flow-origin-y);
  right: 18px;
  bottom: 20px;
  z-index: 1;
  width: 9px;
  border-right: 1px solid rgba(var(--airflow-rgb), 0.2);
  background: repeating-linear-gradient(to bottom, rgba(var(--airflow-rgb), 0.34) 0 1px, transparent 1px 24px);
  content: "";
  opacity: 0.65;
}

.airflow-visual::after {
  position: absolute;
  top: var(--target-y);
  right: 14px;
  z-index: 2;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(var(--airflow-rgb), 0.8);
  border-radius: 50%;
  background: #081117;
  box-shadow: 0 0 14px rgba(var(--airflow-rgb), 0.55);
  content: "";
  transform: translateY(-50%);
  transition: top 120ms ease-out;
}

.airflow-unit {
  position: absolute;
  top: 38px;
  left: 50%;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(330px, 70%);
  height: 60px;
  gap: 5px;
  padding: 40px 26px 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #dfe8eb, #9ca9af);
  box-shadow: 0 22px 38px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transform: translateX(-50%);
}

.airflow-unit::before {
  position: absolute;
  top: 11px;
  right: 18px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(var(--airflow-rgb));
  box-shadow: 0 0 13px rgba(var(--airflow-rgb), 0.85);
  content: "";
}

.airflow-unit i {
  height: 2px;
  border-radius: 1px;
  background: rgba(8, 15, 20, 0.62);
}

.airflow-stream {
  position: absolute;
  top: 101px;
  left: 50%;
  width: 2px;
  height: var(--flow-length);
  border-radius: 1px;
  background: linear-gradient(to bottom, rgba(var(--airflow-rgb), 0.8), rgba(var(--airflow-rgb), 0));
  box-shadow: 0 0 12px rgba(var(--airflow-rgb), 0.34);
  transform: rotate(var(--horizontal-angle));
  transform-origin: 50% 0;
  transition: height 120ms ease-out, transform 120ms ease-out;
  animation: airflow-pulse 1.55s ease-in-out infinite;
}

.stream-a { margin-left: -58px; animation-delay: -0.5s; }
.stream-b { animation-delay: -0.95s; }
.stream-c { margin-left: 58px; animation-delay: -0.15s; }

.airflow-target {
  position: absolute;
  top: var(--target-y);
  bottom: auto;
  left: 50%;
  width: 94px;
  height: 20px;
  border-bottom: 1px solid rgba(var(--airflow-rgb), 0.5);
  transform: translateX(calc(-50% + var(--horizontal-shift)));
  transition: top 120ms ease-out, transform 120ms ease-out;
}

.airflow-target span {
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(var(--airflow-rgb));
  box-shadow: 0 0 16px rgba(var(--airflow-rgb), 0.75);
  transform: translateX(-50%);
}

.airflow-visual[data-vertical="fixed_upper"] { --flow-length: 24%; }
.airflow-visual[data-vertical="fixed_upper_middle"] { --flow-length: 33%; }
.airflow-visual[data-vertical="fixed_middle"] { --flow-length: 42%; }
.airflow-visual[data-vertical="fixed_lower_middle"] { --flow-length: 51%; }
.airflow-visual[data-vertical="fixed_lower"] { --flow-length: 60%; }
.airflow-visual[data-vertical="full"] { --flow-length: 60%; }

.airflow-visual[data-horizontal="left"] { --horizontal-angle: 12deg; --horizontal-shift: -74px; }
.airflow-visual[data-horizontal="left_center"] { --horizontal-angle: 6deg; --horizontal-shift: -38px; }
.airflow-visual[data-horizontal="center"] { --horizontal-angle: 0deg; --horizontal-shift: 0px; }
.airflow-visual[data-horizontal="right_center"] { --horizontal-angle: -6deg; --horizontal-shift: 38px; }
.airflow-visual[data-horizontal="right"] { --horizontal-angle: -12deg; --horizontal-shift: 74px; }

.airflow-visual[data-vertical="full"] .airflow-stream {
  animation: airflow-vertical-sweep 2.2s ease-in-out infinite alternate, airflow-pulse 1.55s ease-in-out infinite;
}

.airflow-visual[data-vertical="full"] .airflow-target,
.airflow-visual[data-vertical="full"]::after {
  animation: airflow-target-vertical 2.2s ease-in-out infinite alternate;
}

.airflow-visual[data-horizontal="full"] .airflow-stream {
  animation: airflow-horizontal-sweep 2.3s ease-in-out infinite alternate, airflow-pulse 1.55s ease-in-out infinite;
}

.airflow-visual[data-horizontal="full"] .airflow-target {
  animation: airflow-target-horizontal 2.3s ease-in-out infinite alternate;
}

.airflow-visual[data-vertical="full"][data-horizontal="full"] .airflow-stream {
  animation: airflow-combined-sweep 2.4s ease-in-out infinite alternate, airflow-pulse 1.55s ease-in-out infinite;
}

.airflow-visual[data-vertical="full"][data-horizontal="full"] .airflow-target {
  animation: airflow-target-vertical 2.2s ease-in-out infinite alternate, airflow-target-horizontal 2.3s ease-in-out infinite alternate;
}

@keyframes airflow-pulse {
  0%, 100% { opacity: 0.28; }
  50% { opacity: 0.95; }
}

@keyframes airflow-vertical-sweep {
  from { transform: rotate(var(--horizontal-angle)) scaleY(0.4); }
  to { transform: rotate(var(--horizontal-angle)) scaleY(1); }
}

@keyframes airflow-horizontal-sweep {
  from { transform: rotate(12deg); }
  to { transform: rotate(-12deg); }
}

@keyframes airflow-combined-sweep {
  from { transform: rotate(12deg) scaleY(0.4); }
  to { transform: rotate(-12deg) scaleY(1); }
}

@keyframes airflow-target-vertical {
  from { top: calc(var(--flow-origin-y) + 24%); }
  to { top: calc(var(--flow-origin-y) + 60%); }
}

@keyframes airflow-target-horizontal {
  from { transform: translateX(calc(-50% - var(--horizontal-sweep))); }
  to { transform: translateX(calc(-50% + var(--horizontal-sweep))); }
}

.airflow-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.direction-control {
  min-width: 0;
}

.direction-pad {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}

.direction-pad button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 47px;
  place-items: center;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(15, 22, 28, 0.9);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 740;
  transition: border-color 70ms linear, background 70ms linear, color 70ms linear, transform 70ms linear;
}

.direction-pad button:active {
  transform: scale(0.94);
}

.direction-pad button.active {
  border-color: rgba(var(--airflow-rgb), 0.55);
  background: rgba(var(--airflow-rgb), 0.11);
  color: rgb(var(--airflow-rgb));
  box-shadow: inset 0 -2px 0 rgba(var(--airflow-rgb), 0.75), 0 0 18px rgba(var(--airflow-rgb), 0.06);
}

.direction-pad button i {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 -5px 0 currentColor;
}

.vertical-pad button:nth-child(2) i { transform: rotate(-18deg); }
.vertical-pad button:nth-child(3) i { transform: rotate(-9deg); }
.vertical-pad button:nth-child(4) i { transform: rotate(0); }
.vertical-pad button:nth-child(5) i { transform: rotate(9deg); }
.vertical-pad button:nth-child(6) i { transform: rotate(18deg); }

.horizontal-pad button i {
  width: 3px;
  height: 20px;
  box-shadow: 5px 0 0 currentColor, -5px 0 0 currentColor;
}

.horizontal-pad button:nth-child(2) i { transform: translateX(-4px); }
.horizontal-pad button:nth-child(3) i { transform: translateX(-2px); }
.horizontal-pad button:nth-child(5) i { transform: translateX(2px); }
.horizontal-pad button:nth-child(6) i { transform: translateX(4px); }

.humidity-compact {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.compact-slider .field > span {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Purifier screen and function visualization */

.machine-screen-controls {
  position: absolute;
  top: 198px;
  left: 50%;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 31px);
  gap: 4px;
  transform: translateX(-50%);
}

.machine-screen-controls button {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(7, 13, 16, 0.22);
  border-radius: 6px;
  background: rgba(7, 13, 16, 0.78);
  color: #8f9ca1;
  cursor: pointer;
  transition: color 70ms linear, border-color 70ms linear, background 70ms linear, box-shadow 70ms linear, transform 70ms linear;
}

.machine-screen-controls button:active { transform: scale(0.9); }

.machine-screen-controls button.active {
  border-color: rgba(var(--quality-rgb), 0.75);
  background: rgba(7, 13, 16, 0.94);
  color: rgb(var(--quality-rgb));
  box-shadow: 0 0 15px rgba(var(--quality-rgb), 0.34);
}

.machine-screen-state {
  position: absolute;
  top: 235px;
  left: 50%;
  z-index: 5;
  width: 120px;
  color: #607077;
  font-size: 8px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.purifier-machine[data-screen-level="off"] .aqi-ring {
  opacity: 0.16;
  filter: grayscale(1);
  box-shadow: none;
}

.purifier-machine[data-screen-level="dim"] .aqi-ring {
  opacity: 0.62;
  filter: saturate(0.72);
}

.purifier-machine[data-screen-level="bright"] .aqi-ring {
  opacity: 1;
  filter: saturate(1.2) brightness(1.12);
  box-shadow: 0 0 40px rgba(var(--quality-rgb), 0.32), inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.function-orbit {
  position: relative;
  display: grid;
  width: min(100%, 560px);
  min-height: 310px;
  place-items: center;
  margin: 4px auto 12px;
  overflow: hidden;
  border: 1px solid rgba(var(--mint-rgb), 0.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(var(--mint-rgb), 0.08), transparent 45%),
    #080e12;
}

.function-orbit::before,
.function-orbit::after {
  position: absolute;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(var(--mint-rgb), 0.18);
  border-radius: 50%;
  content: "";
}

.function-orbit::after {
  width: 270px;
  height: 270px;
  border-style: dashed;
  opacity: 0.42;
  animation: orbit-spin 16s linear infinite;
}

.function-orbit-core {
  position: relative;
  z-index: 2;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border: 1px solid rgba(var(--mint-rgb), 0.42);
  border-radius: 50%;
  background: #0a1315;
  box-shadow: inset 0 0 34px rgba(var(--mint-rgb), 0.12), 0 0 36px rgba(var(--mint-rgb), 0.11);
}

.function-orbit-core span {
  width: 40px;
  height: 40px;
  border: 1px solid var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(var(--mint-rgb), 0.55);
}

.orbit-particle {
  position: absolute;
  z-index: 3;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 14px rgba(var(--mint-rgb), 0.8);
  opacity: 0.25;
}

.particle-one { transform: translate(104px, -36px); }
.particle-two { transform: translate(-90px, 68px); }
.particle-three { transform: translate(38px, 123px); }

.function-orbit[data-anion="true"] .orbit-particle {
  opacity: 1;
  animation: ion-pulse 1.6s ease-in-out infinite alternate;
}

.function-orbit[data-uv="true"] {
  border-color: rgba(184, 154, 255, 0.3);
  box-shadow: inset 0 0 90px rgba(184, 154, 255, 0.08);
}

.function-orbit[data-uv="true"] .function-orbit-core {
  border-color: rgba(184, 154, 255, 0.64);
  box-shadow: inset 0 0 34px rgba(184, 154, 255, 0.16), 0 0 44px rgba(184, 154, 255, 0.18);
}

.function-orbit-status {
  position: absolute;
  right: 16px;
  bottom: 14px;
  display: grid;
  gap: 2px;
  text-align: right;
}

.function-orbit-status span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.function-orbit-status strong {
  color: var(--text);
  font-size: 12px;
}

@keyframes orbit-spin { to { transform: rotate(360deg); } }
@keyframes ion-pulse { to { filter: brightness(1.65); transform: scale(1.45) translate(26px, -12px); } }

/* Simple plans */

.schedule-workspace {
  margin-top: 0;
}

.routine-shell {
  display: flex;
  height: 690px;
  min-height: 690px;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 189, 105, 0.2);
  border-radius: 8px;
  background: #0a0e12;
  box-shadow: inset 0 0 120px rgba(255, 189, 105, 0.035), var(--shadow);
}

.routine-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  min-width: 0;
  gap: 14px;
}

.routine-head > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.routine-head h2 {
  font-size: 24px;
  font-weight: 690;
}

.routine-head p {
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.routine-grid {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: minmax(360px, 1.15fr) minmax(300px, 0.85fr);
  gap: 12px;
}

.routine-composer,
.routine-existing {
  min-height: 0;
  box-shadow: none;
}

.routine-composer {
  display: grid;
  align-content: center;
  gap: 12px;
  border-color: rgba(255, 189, 105, 0.18);
  background: rgba(12, 17, 22, 0.92);
}

.routine-primary-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(130px, 0.65fr);
  align-items: center;
  gap: 14px;
}

.routine-dial {
  --time-angle: 97.5deg;
  position: relative;
  display: grid;
  width: 170px;
  height: 170px;
  place-items: center;
  justify-self: center;
  border: 1px solid rgba(255, 189, 105, 0.28);
  border-radius: 50%;
  background:
    conic-gradient(from -90deg, rgba(255, 189, 105, 0.8) 0 var(--time-angle), rgba(255, 255, 255, 0.055) var(--time-angle) 360deg),
    #090e12;
  box-shadow: inset 0 0 0 8px #090e12, inset 0 0 34px rgba(255, 189, 105, 0.08), 0 0 30px rgba(255, 189, 105, 0.08);
  transition: background 90ms linear, border-color 90ms linear;
}

.routine-dial[data-action="off"] {
  filter: saturate(0.35);
}

.routine-orbit {
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(255, 189, 105, 0.28);
  border-radius: 50%;
  animation: orbit-spin 22s linear infinite;
}

.routine-orbit i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(255, 189, 105, 0.7);
}

.routine-orbit i:nth-child(1) { top: 14%; left: 18%; }
.routine-orbit i:nth-child(2) { top: 38%; right: -2px; }
.routine-orbit i:nth-child(3) { bottom: 2%; left: 40%; }

.routine-time {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 4px;
  text-align: center;
}

.routine-time span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.routine-time input {
  width: 116px;
  min-height: 43px;
  padding: 0 5px;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  font-size: 27px;
  font-weight: 430;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.routine-action {
  display: grid;
  gap: 7px;
}

.routine-action button,
.routine-mode-strip button,
.routine-days button,
.routine-temp-stepper button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted-strong);
  cursor: pointer;
  font-weight: 720;
  transition: color 70ms linear, border-color 70ms linear, background 70ms linear, box-shadow 70ms linear, transform 70ms linear;
}

.routine-action button:active,
.routine-mode-strip button:active,
.routine-days button:active,
.routine-temp-stepper button:active { transform: scale(0.95); }

.routine-action button {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
}

.routine-action button.active,
.routine-mode-strip button.active,
.routine-days button.active {
  border-color: rgba(255, 189, 105, 0.55);
  background: rgba(255, 189, 105, 0.11);
  color: var(--amber);
  box-shadow: inset 0 -2px 0 rgba(255, 189, 105, 0.72), 0 0 18px rgba(255, 189, 105, 0.06);
}

.routine-device-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 122px;
  gap: 8px;
}

.routine-device-options:has(.purifier-routine-modes) {
  grid-template-columns: 1fr;
}

.routine-mode-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.purifier-routine-modes {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.routine-mode-strip button,
.routine-days button {
  min-width: 0;
  min-height: 42px;
  padding: 0 6px;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.routine-temp-stepper {
  display: grid;
  grid-template-columns: 35px minmax(42px, 1fr) 35px;
  align-items: center;
  gap: 3px;
}

.routine-temp-stepper button {
  min-height: 42px;
  padding: 0;
  color: var(--amber);
  font-size: 20px;
}

.routine-temp-stepper strong {
  text-align: center;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.routine-days {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.routine-save {
  gap: 7px;
}

.routine-existing {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(12, 17, 22, 0.72);
}

.routine-existing .card-title {
  font-size: 15px;
}

.routine-existing .schedule-list {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
  margin-top: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: rgba(255, 189, 105, 0.45) rgba(255, 255, 255, 0.04);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.routine-existing .schedule-list::-webkit-scrollbar { width: 8px; }
.routine-existing .schedule-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); }
.routine-existing .schedule-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 189, 105, 0.45);
}

.routine-existing .schedule-list .empty {
  display: grid;
  width: 100%;
  min-height: 100px;
  place-items: center;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 7px;
}

.routine-existing .schedule-item {
  width: 100%;
  min-width: 0;
  align-content: center;
  flex: 0 0 auto;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 10px 12px 14px;
}

.routine-existing .schedule-time strong { font-size: 24px; }
.routine-existing .schedule-actions { gap: 4px; }

@media (max-width: 720px) {
  body[data-active-tab="klima"],
  body[data-active-tab="powietrze"] {
    width: 100%;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body[data-active-tab="klima"] .shell,
  body[data-active-tab="powietrze"] .shell {
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .shell {
    padding: 5px 8px calc(72px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 44px;
    margin-bottom: 5px;
    padding: 3px 0 5px;
  }

  .brand { gap: 7px; }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-mark span { font-size: 16px; }
  h1 { font-size: 15px; }

  #statusLine {
    max-width: calc(100vw - 60px);
    font-size: 8.5px;
  }

  .tabs {
    right: 7px;
    bottom: 5px;
    bottom: calc(5px + env(safe-area-inset-bottom));
    left: 7px;
    max-width: calc(100vw - 14px);
    padding: 4px;
  }

  .tab {
    min-height: 51px;
    gap: 3px;
    padding: 3px 1px;
  }

  .tab::after { font-size: 9px; }
  .tab svg { width: 17px; height: 17px; }

  .tab-page.active {
    animation: none;
  }

  .device-view-nav {
    min-height: 38px;
    margin-bottom: 5px;
    padding: 3px;
  }

  .device-view-tab {
    min-height: 32px;
    padding: 0 2px;
    font-size: 9px;
  }

  .device-view-tab.active::after {
    right: 20%;
    bottom: 2px;
    left: 20%;
  }

  .device-deck {
    align-items: stretch;
    touch-action: pan-y;
    transition: none;
  }

  .device-deck.dragging {
    scroll-snap-type: none;
  }

  .device-panel {
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .device-panel > .card,
  .device-panel > .schedule-mount,
  .schedule-panel .schedule-workspace,
  .schedule-mount,
  .schedule-workspace,
  .routine-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .card {
    padding: 8px;
  }

  .hero-card,
  .control-deck {
    min-height: 0;
    box-shadow: none;
  }

  .stage-grid { background-size: 20px 20px; }

  .section-overline,
  .schedule-kicker {
    font-size: 7.5px;
  }

  .stage-device { gap: 2px; }
  .stage-head { min-height: 34px; gap: 7px; }

  .device-picker {
    max-width: calc(100vw - 82px);
    flex-wrap: nowrap;
  }

  .device-chip {
    min-width: 0;
    max-width: calc(100vw - 92px);
    padding: 4px 7px;
  }

  .device-chip strong { font-size: 10px; }
  .device-chip small { display: none; }
  .device-picker .empty { font-size: 9px; }

  .switch.big {
    width: 53px;
    height: 30px;
  }

  .switch.big > span::before {
    width: 22px;
    height: 22px;
  }

  .switch.big input:checked + span::before { transform: translateX(23px); }

  .climate-instrument {
    grid-template-columns: 42px minmax(118px, 1fr) 42px;
    height: 154px;
    gap: 5px;
    margin: 1px auto 3px;
  }

  .round {
    width: 39px;
    height: 39px;
  }

  .round svg { width: 20px; height: 20px; }

  .climate-halo {
    width: clamp(136px, 42vw, 166px);
  }

  .climate-halo::before { inset: 6px; }
  .climate-halo::after { inset: 16px; }
  .halo-scale { inset: -5px; }

  .visual-caption {
    min-height: 10px;
    font-size: 7px;
  }

  .temp-value {
    min-height: 58px;
  }

  .temp-value strong {
    min-width: 72px;
    font-size: 51px;
  }

  .temp-unit {
    margin-top: 6px;
    font-size: 14px;
  }

  .temp-label { font-size: 7.5px; }

  .telemetry-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .telemetry-strip > div,
  .telemetry-strip > div:nth-child(-n + 2),
  .telemetry-strip > div:nth-child(odd) {
    min-height: 43px;
    padding: 5px 4px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .telemetry-strip > div:first-child { border-left: 0; }

  .telemetry-strip span {
    min-height: 16px;
    font-size: 7px;
    line-height: 1.05;
    white-space: normal;
  }

  .telemetry-strip strong { font-size: 10px; }

  .stage-control-block {
    padding-top: 5px;
  }

  .control-caption {
    margin-bottom: 3px;
    font-size: 7.5px;
  }

  .control-caption.compact { margin-top: 4px; }

  .mode-dock {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
  }

  .mode-dock .chip:last-child { grid-column: auto; }
  .mode-dock .chip svg { display: none; }

  .mode-dock .chip,
  .fan-dock .chip {
    min-height: 34px;
    padding: 0 2px;
    font-size: 8px;
    white-space: nowrap;
  }

  .fan-dock { gap: 3px; }
  .fan-dock .chip { min-height: 31px; }

  .deck-head {
    gap: 1px;
    padding-bottom: 6px;
  }

  .card-title { font-size: 14px; }

  .control-section {
    padding: 7px 0;
  }

  .control-section-label {
    margin-bottom: 5px;
    font-size: 7.5px;
  }

  #climateFeatures .control-section { padding-top: 5px; }

  #climateFeatures .pill-toggles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  #climateFeatures .pill {
    min-height: 45px;
    gap: 5px;
    padding: 5px;
    font-size: 8.5px;
  }

  #climateFeatures .pill input {
    width: 15px;
    height: 15px;
  }

  .airflow-visual {
    --flow-origin-y: 57px;
    --horizontal-sweep: 42px;
    min-height: 130px;
    margin: 0 0 6px;
  }

  .airflow-unit {
    top: 14px;
    width: min(220px, 68%);
    height: 42px;
    padding: 28px 18px 6px;
  }

  .airflow-unit::before { top: 7px; right: 12px; width: 5px; height: 5px; }

  .airflow-stream {
    top: 57px;
    height: var(--flow-length);
  }

  .stream-a { margin-left: -38px; }
  .stream-c { margin-left: 38px; }

  .airflow-target {
    top: var(--target-y);
    bottom: auto;
    width: 62px;
    height: 10px;
  }

  .airflow-visual[data-horizontal="left"] { --horizontal-shift: -42px; }
  .airflow-visual[data-horizontal="left_center"] { --horizontal-shift: -21px; }
  .airflow-visual[data-horizontal="right_center"] { --horizontal-shift: 21px; }
  .airflow-visual[data-horizontal="right"] { --horizontal-shift: 42px; }

  .airflow-controls {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .direction-pad { gap: 3px; }

  .direction-pad button {
    min-height: 34px;
    padding: 0 2px;
    font-size: 7px;
  }

  .direction-pad button i {
    width: 14px;
    box-shadow: 0 4px 0 currentColor, 0 -4px 0 currentColor;
  }

  .horizontal-pad button i {
    width: 2px;
    height: 14px;
    box-shadow: 4px 0 0 currentColor, -4px 0 0 currentColor;
  }

  .humidity-compact {
    margin-top: 6px;
    padding-top: 6px;
  }

  .compact-slider {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px;
    align-items: center;
    gap: 5px;
  }

  .compact-slider .field {
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 4px;
  }

  .compact-slider .field > span { font-size: 9px; }
  .compact-slider button { width: auto; min-height: 34px; padding: 0 8px; font-size: 9px; }
  .compact-slider input[type="range"] { min-height: 28px; }

  .purifier-scene {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-columns: minmax(82px, 0.58fr) minmax(150px, 1fr);
    gap: 2px;
    padding: 0;
  }

  .air-quality-copy {
    align-content: center;
    justify-items: start;
    text-align: left;
  }

  .aqi-label {
    max-width: 112px;
    font-size: 22px;
  }

  .purifier-machine-wrap {
    min-height: 270px;
  }

  .purifier-machine {
    grid-template-rows: 29px 1fr 10px;
    width: 146px;
    height: 250px;
  }

  .purifier-top {
    gap: 3px;
    padding: 8px 10px;
  }

  .purifier-body { padding-top: 24px; }

  .aqi-ring {
    width: 87px;
    height: 87px;
    padding: 4px;
  }

  .aqi-inner strong { font-size: 31px; }
  .aqi-inner span { margin-top: 2px; font-size: 7px; }
  .aqi-inner small { font-size: 6px; }

  .machine-screen-controls {
    top: 120px;
    grid-template-columns: repeat(3, 26px);
    gap: 3px;
  }

  .machine-screen-controls button {
    width: 26px;
    height: 26px;
  }

  .machine-screen-controls button svg { width: 12px; height: 12px; }

  .machine-screen-state {
    top: 151px;
    width: 100px;
    font-size: 6px;
  }

  .purifier-intake {
    right: 17px;
    bottom: 13px;
    left: 17px;
    height: 52px;
    background-size: 6px 6px;
  }

  .purifier-machine-shadow {
    bottom: 3px;
    width: 160px;
  }

  .air-telemetry > div,
  .air-telemetry > div:nth-child(-n + 2),
  .air-telemetry > div:nth-child(odd) {
    min-height: 42px;
    padding: 4px;
  }

  .air-telemetry span { font-size: 7px; }
  .air-telemetry strong { font-size: 10px; }

  #purifierModes,
  #purifierFunctions {
    display: flex;
    flex-direction: column;
  }

  #purifierModes .control-section {
    padding: 8px 0;
  }

  #purifierModes .chip {
    min-height: 43px;
    font-size: 9px;
  }

  #purifierModes .slider-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 66px;
    align-items: center;
    gap: 6px;
  }

  #purifierModes .slider-row button {
    width: auto;
    min-height: 36px;
    padding: 0 8px;
    font-size: 9px;
  }

  #purifierModes .field { margin-bottom: 0; }

  .function-orbit {
    width: 100%;
    min-height: 160px;
    margin: 0 0 6px;
  }

  .function-orbit::before { width: 112px; height: 112px; }
  .function-orbit::after { width: 142px; height: 142px; }

  .function-orbit-core {
    width: 58px;
    height: 58px;
  }

  .function-orbit-core span { width: 26px; height: 26px; }
  .particle-one { transform: translate(58px, -22px); }
  .particle-two { transform: translate(-52px, 36px); }
  .particle-three { transform: translate(24px, 66px); }
  .function-orbit-status { right: 8px; bottom: 7px; }
  .function-orbit-status span { font-size: 6px; }
  .function-orbit-status strong { font-size: 9px; }

  #purifierFunctions .control-section { padding: 6px 0; }

  #purifierFunctions .compact-pills {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  #purifierFunctions .pill {
    min-height: 42px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 3px;
    font-size: 7.5px;
    text-align: center;
  }

  #purifierFunctions .pill input { width: 14px; height: 14px; }

  .premium-filter {
    margin-top: auto;
    padding: 7px 0 2px;
  }

  .routine-shell {
    gap: 5px;
    padding: 7px;
    box-shadow: none;
  }

  .routine-head {
    min-height: 40px;
    align-items: center;
    gap: 7px;
  }

  .routine-head h2 { font-size: 15px; }

  .routine-head p {
    max-width: calc(100vw - 112px);
    font-size: 7.5px;
  }

  .schedule-count {
    min-height: 24px;
    padding: 4px 6px;
    font-size: 7.5px;
  }

  .routine-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .routine-composer {
    display: grid;
    min-height: 0;
    flex: 1 1 auto;
    align-content: center;
    gap: 5px;
    padding: 6px;
  }

  .routine-primary-row {
    grid-template-columns: minmax(105px, 0.8fr) minmax(90px, 1.2fr);
    gap: 7px;
  }

  .routine-dial {
    width: 106px;
    height: 106px;
    box-shadow: inset 0 0 0 5px #090e12, inset 0 0 22px rgba(255, 189, 105, 0.08), 0 0 18px rgba(255, 189, 105, 0.07);
  }

  .routine-orbit { inset: -4px; }

  .routine-time { gap: 0; }
  .routine-time span { font-size: 6px; }

  .routine-time input {
    width: 83px;
    min-height: 34px;
    padding: 0;
    font-size: 20px;
  }

  .routine-action { gap: 4px; }

  .routine-action button {
    min-height: 43px;
    gap: 5px;
    font-size: 9px;
  }

  .routine-action button svg { width: 14px; height: 14px; }

  .routine-device-options {
    grid-template-columns: minmax(0, 1fr) 94px;
    gap: 4px;
  }

  .routine-mode-strip { gap: 3px; }

  .routine-mode-strip button,
  .routine-days button {
    min-height: 34px;
    padding: 0 2px;
    font-size: 7.5px;
  }

  .routine-temp-stepper {
    grid-template-columns: 27px minmax(34px, 1fr) 27px;
    gap: 2px;
  }

  .routine-temp-stepper button { min-height: 34px; font-size: 16px; }
  .routine-temp-stepper strong { font-size: 15px; }
  .routine-days { gap: 3px; }

  .routine-save {
    min-height: 37px !important;
    font-size: 9px !important;
  }

  .routine-save svg { width: 14px; height: 14px; }

  .routine-existing {
    min-height: 85px;
    max-height: 96px;
    flex: 0 0 92px;
    padding: 6px;
  }

  .routine-existing .card-head { min-height: 20px; }
  .routine-existing .card-title { font-size: 10px; }
  .routine-existing .badge { min-height: 20px; padding: 2px 5px; font-size: 7px; }

  .routine-existing .schedule-list {
    gap: 5px;
    margin-top: 4px;
  }

  .routine-existing .schedule-list .empty {
    min-height: 52px;
    padding: 4px;
    font-size: 8px;
  }

  .routine-existing .schedule-item {
    width: 238px;
    min-width: 238px;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 5px;
    padding: 5px 4px 5px 8px;
  }

  .routine-existing .schedule-time { gap: 1px; }
  .routine-existing .schedule-time strong { font-size: 17px; }
  .routine-existing .schedule-time small { font-size: 6px; }
  .routine-existing .schedule-info { gap: 1px; }
  .routine-existing .schedule-info .title { font-size: 8px; }
  .routine-existing .schedule-info .meta { font-size: 6.5px; }
  .routine-existing .switch { width: 37px; height: 22px; }
  .routine-existing .switch > span::before { width: 14px; height: 14px; }
  .routine-existing .switch input:checked + span::before { transform: translateX(15px); }
  .routine-existing .icon-btn { width: 25px; height: 25px; }
  .routine-existing .icon-btn svg { width: 12px; height: 12px; }

  /* The schedule screen owns vertical scrolling on mobile. Keeping the plans
     in a hidden horizontal rail made its gesture compete with the page deck. */
  .device-panel.schedule-panel {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .schedule-panel > .schedule-mount,
  .schedule-panel .schedule-workspace,
  .schedule-panel .routine-shell {
    height: auto;
    min-height: 100%;
    overflow: visible;
  }

  .schedule-panel .routine-grid,
  .schedule-panel .routine-composer,
  .schedule-panel .routine-existing {
    flex: 0 0 auto;
  }

  .schedule-panel .routine-existing {
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .schedule-panel .routine-existing .schedule-list {
    display: grid;
    overflow: visible;
    touch-action: pan-y;
  }

  .schedule-panel .routine-existing .schedule-item {
    width: 100%;
    min-width: 0;
  }

  .toast-host {
    bottom: 67px;
    bottom: calc(67px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 370px) and (max-height: 740px) {
  #statusLine { display: none; }
  .brand-copy { gap: 0; }

  .climate-instrument {
    height: 145px;
  }

  .climate-halo { width: 134px; }
  .temp-value strong { font-size: 47px; }

  .purifier-machine-wrap { min-height: 250px; }
  .purifier-machine { width: 136px; height: 232px; }
  .purifier-body { padding-top: 20px; }
  .aqi-ring { width: 80px; height: 80px; }
  .machine-screen-controls { top: 109px; }
  .machine-screen-state { top: 139px; }
  .purifier-intake { height: 46px; }

  .function-orbit { min-height: 145px; }

  .routine-head { min-height: 35px; }
  .routine-dial { width: 98px; height: 98px; }
  .routine-action button { min-height: 39px; }
  .routine-mode-strip button,
  .routine-days button,
  .routine-temp-stepper button { min-height: 31px; }
  .routine-save { min-height: 34px !important; }
  .routine-existing { min-height: 78px; max-height: 82px; flex-basis: 80px; }
}

/* Final mobile polish */

#climateFeatures,
#purifierModes {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

#climateFeatures::before,
#purifierModes::before {
  position: absolute;
  inset: 43% 7% 7%;
  z-index: -1;
  opacity: 0.36;
  background-image:
    linear-gradient(100deg, transparent 0 18%, rgba(var(--ice-rgb), 0.26) 19%, transparent 20% 47%, rgba(var(--ice-rgb), 0.14) 48%, transparent 49% 78%, rgba(var(--ice-rgb), 0.22) 79%, transparent 80%),
    linear-gradient(80deg, transparent 0 28%, rgba(var(--ice-rgb), 0.12) 29%, transparent 30% 66%, rgba(var(--ice-rgb), 0.2) 67%, transparent 68%);
  background-size: 190px 44px, 250px 58px;
  content: "";
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 18% 82%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 18% 82%, transparent);
  animation: atmosphere-field 9s linear infinite;
}

#purifierModes::before {
  background-image:
    linear-gradient(100deg, transparent 0 18%, rgba(var(--mint-rgb), 0.25) 19%, transparent 20% 47%, rgba(var(--mint-rgb), 0.13) 48%, transparent 49% 78%, rgba(var(--mint-rgb), 0.21) 79%, transparent 80%),
    linear-gradient(80deg, transparent 0 28%, rgba(var(--mint-rgb), 0.11) 29%, transparent 30% 66%, rgba(var(--mint-rgb), 0.18) 67%, transparent 68%);
}

#climateFeatures::after,
#purifierModes::after {
  position: absolute;
  right: 8%;
  bottom: 17%;
  left: 8%;
  z-index: -1;
  height: 1px;
  opacity: 0.32;
  background: linear-gradient(90deg, transparent, rgb(var(--ice-rgb)), transparent);
  box-shadow: 0 0 18px rgba(var(--ice-rgb), 0.28);
  content: "";
  animation: field-scan 4.8s ease-in-out infinite alternate;
}

#purifierModes::after {
  background: linear-gradient(90deg, transparent, rgb(var(--mint-rgb)), transparent);
  box-shadow: 0 0 18px rgba(var(--mint-rgb), 0.28);
}

@keyframes atmosphere-field {
  to { background-position: 190px 0, -250px 0; }
}

@keyframes field-scan {
  from { transform: translateY(-78px); opacity: 0.12; }
  to { transform: translateY(58px); opacity: 0.4; }
}

.routine-time input::-webkit-calendar-picker-indicator {
  display: none;
}

@media (max-width: 720px) {
  .switch input {
    min-height: 1px;
  }

  .pill input,
  #climateFeatures .pill input,
  #purifierFunctions .pill input {
    width: 15px;
    height: 15px;
    min-height: 15px;
  }

  #climateFeatures .control-section,
  #purifierModes .control-section {
    position: relative;
    z-index: 2;
  }

  .airflow-visual {
    min-height: 130px;
    flex: 1 1 auto;
  }

  .airflow-stream,
  .stream-b {
    height: var(--flow-length);
    max-height: none;
  }

  #purifierFunctions .function-orbit {
    min-height: 160px;
    flex: 1 1 auto;
  }

  .routine-composer {
    grid-template-rows: minmax(112px, 1fr) auto auto auto;
    align-content: stretch;
  }

  .routine-primary-row {
    height: 100%;
  }

  .routine-time input {
    width: 92px;
  }
}

/* Mode changes read instantly while the hardware confirms in the background. */
.climate-stage,
.climate-halo {
  transition-duration: 110ms;
}

.mode-dock .chip {
  transition: border-color 60ms linear, color 60ms linear, background 60ms linear, transform 90ms ease, box-shadow 60ms linear;
}

.climate-stage[data-syncing="true"] .visual-caption::after {
  display: inline-block;
  width: 15px;
  height: 1px;
  margin-left: 6px;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  content: "";
  vertical-align: middle;
  animation: climate-sync 680ms ease-in-out infinite alternate;
}

@keyframes climate-sync {
  from { opacity: 0.25; transform: scaleX(0.4); }
  to { opacity: 0.95; transform: scaleX(1); }
}

@media (max-width: 720px) and (min-height: 780px) {
  .routine-dial {
    width: 128px;
    height: 128px;
  }

  .routine-time input {
    width: 96px;
    font-size: 22px;
  }

  .function-orbit::before { width: 150px; height: 150px; }
  .function-orbit::after { width: 190px; height: 190px; }
  .function-orbit-core { width: 70px; height: 70px; }
  .particle-one { transform: translate(75px, -28px); }
  .particle-two { transform: translate(-68px, 48px); }
  .particle-three { transform: translate(30px, 88px); }
}

/* Interactive controls must not move under the pointer. */
.purifier-stage[data-powered="true"] .purifier-machine {
  animation: none;
}

.purifier-stage[data-powered="true"] .aqi-ring {
  animation: purifier-screen-breathe 3.8s ease-in-out infinite;
}

.pill input {
  min-height: 18px;
}

#purifierFunctions .compact-pills {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.routine-existing .schedule-list {
  align-items: flex-start;
}

.routine-existing .schedule-item {
  min-height: 110px;
  align-self: flex-start;
}

@media (min-width: 721px) {
  .airflow-visual {
    flex: 1 1 auto;
  }

  .airflow-visual .airflow-stream {
    height: var(--flow-length);
  }
}

@media (max-width: 720px) {
  .routine-existing .schedule-item {
    min-height: 0;
  }
}

@keyframes purifier-screen-breathe {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

/* Direction icons mirror their physical axis. */
.vertical-pad button i,
.horizontal-pad button i {
  position: relative;
  box-shadow: none;
  transform: none !important;
}

.vertical-pad button i {
  width: 2px;
  height: 22px;
  background: linear-gradient(to bottom, transparent, currentColor 14% 86%, transparent);
}

.horizontal-pad button i {
  width: 22px;
  height: 2px;
  background: linear-gradient(to right, transparent, currentColor 14% 86%, transparent);
}

.vertical-pad button i::after,
.horizontal-pad button i::after {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  content: "";
}

.vertical-pad button i::after {
  left: 50%;
  transform: translate(-50%, -50%);
}

.vertical-pad button:nth-child(2) i::after { top: 10%; }
.vertical-pad button:nth-child(3) i::after { top: 30%; }
.vertical-pad button:nth-child(4) i::after { top: 50%; }
.vertical-pad button:nth-child(5) i::after { top: 70%; }
.vertical-pad button:nth-child(6) i::after { top: 90%; }

.horizontal-pad button i::after {
  top: 50%;
  transform: translate(-50%, -50%);
}

.horizontal-pad button:nth-child(2) i::after { left: 10%; }
.horizontal-pad button:nth-child(3) i::after { left: 30%; }
.horizontal-pad button:nth-child(4) i::after { left: 50%; }
.horizontal-pad button:nth-child(5) i::after { left: 70%; }
.horizontal-pad button:nth-child(6) i::after { left: 90%; }

@media (max-width: 720px) {
  .vertical-pad button i { height: 17px; }
  .horizontal-pad button i { width: 17px; }
  .vertical-pad button i::after,
  .horizontal-pad button i::after {
    width: 6px;
    height: 6px;
  }
}

/* Restrained climate motion and tactile mobile steppers. */
.climate-stage .environment-canvas {
  opacity: 0.92;
}

.climate-stage .stage-grid {
  opacity: 0.12;
  background-size: 42px 42px;
}

.climate-stage[data-powered="true"] .climate-halo {
  animation: none;
}

#climateFeatures::before,
#climateFeatures::after,
#purifierModes::before,
#purifierModes::after {
  content: none;
  animation: none;
}

@media (max-width: 720px) {
  .climate-instrument {
    grid-template-columns: 44px auto 44px;
    justify-content: center;
    width: 100%;
    gap: 10px;
    padding-inline: 2px;
  }

  .climate-instrument .instrument-step {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-color: rgba(255, 255, 255, 0.15);
    background: #111920;
    color: #dff8ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 7px 16px rgba(0, 0, 0, 0.32);
    -webkit-tap-highlight-color: transparent;
  }

  .climate-instrument .instrument-step:hover {
    border-color: rgba(var(--mode-rgb), 0.42);
    background: #141e26;
  }

  .climate-instrument .instrument-step:active {
    border-color: rgba(var(--mode-rgb), 0.72);
    background: rgba(var(--mode-rgb), 0.12);
    transform: scale(0.94);
  }

  .climate-instrument .instrument-step:focus-visible {
    outline: 2px solid rgb(var(--mode-rgb));
    outline-offset: 3px;
  }

  .climate-instrument .instrument-step svg {
    width: 19px;
    height: 19px;
  }
}

@media (max-width: 370px) and (max-height: 740px) {
  .climate-instrument {
    grid-template-columns: 42px auto 42px;
    gap: 8px;
  }

  .climate-instrument .instrument-step {
    width: 42px;
    min-width: 42px;
    height: 42px;
  }
}

/* Roborock */

.roborock-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.75fr);
  align-items: start;
  gap: 12px;
}

.roborock-grid.single {
  grid-template-columns: minmax(0, 1fr);
}

.roborock-stage {
  position: relative;
  min-height: 610px;
  overflow: hidden;
  border-color: rgba(184, 154, 255, 0.18);
  background:
    radial-gradient(circle at 50% 42%, rgba(184, 154, 255, 0.09), transparent 38%),
    rgba(12, 17, 22, 0.97);
}

.roborock-stage::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(184, 154, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 154, 255, 0.09) 1px, transparent 1px);
  background-size: 52px 52px;
  content: "";
  pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at center, black, transparent 78%);
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.roborock-stage > * {
  position: relative;
  z-index: 1;
}

.robot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.robot-head > div {
  display: grid;
  gap: 4px;
}

.robot-connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.robot-connection::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  content: "";
  box-shadow: 0 0 10px rgba(255, 114, 102, 0.35);
}

.robot-connection.online {
  color: var(--mint);
}

.robot-connection.online::before {
  background: var(--mint);
  box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.65);
}

.robot-picker {
  min-height: 54px;
  margin-top: 15px;
}

.robot-console {
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(240px, 1.1fr);
  align-items: center;
  min-height: 280px;
  gap: 22px;
  margin: 18px 0;
}

.robot-visual {
  position: relative;
  display: grid;
  min-height: 255px;
  place-items: center;
}

.robot-body {
  position: relative;
  width: 208px;
  height: 208px;
  border: 2px solid rgba(232, 225, 255, 0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle at 44% 40%, rgba(255, 255, 255, 0.14), transparent 32%),
    linear-gradient(145deg, #242431, #11121a 68%);
  box-shadow:
    inset 0 0 0 10px rgba(255, 255, 255, 0.025),
    inset -18px -24px 44px rgba(0, 0, 0, 0.38),
    0 24px 48px rgba(0, 0, 0, 0.48);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.robot-body::before {
  position: absolute;
  top: 38px;
  left: 50%;
  width: 52px;
  height: 52px;
  border: 2px solid rgba(232, 225, 255, 0.4);
  border-radius: 50%;
  background: #0b0d13;
  content: "";
  box-shadow: inset 0 0 18px rgba(184, 154, 255, 0.18), 0 5px 16px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
}

.robot-body::after {
  position: absolute;
  top: 56px;
  left: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--violet);
  content: "";
  box-shadow: 0 0 18px rgba(184, 154, 255, 0.75);
  transform: translateX(-50%);
}

.robot-body i {
  position: absolute;
  right: 32px;
  bottom: 43px;
  left: 32px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(232, 225, 255, 0.42), transparent);
}

.robot-body span {
  position: absolute;
  right: 23px;
  bottom: 22px;
  width: 37px;
  height: 37px;
  border: 2px dotted rgba(184, 154, 255, 0.48);
  border-radius: 50%;
}

.roborock-stage[data-connected="true"] .robot-body {
  border-color: rgba(184, 154, 255, 0.8);
  box-shadow:
    inset 0 0 0 10px rgba(255, 255, 255, 0.025),
    inset -18px -24px 44px rgba(0, 0, 0, 0.38),
    0 0 50px rgba(184, 154, 255, 0.12),
    0 24px 48px rgba(0, 0, 0, 0.48);
}

.roborock-stage[data-status="cleaning"] .robot-body,
.roborock-stage[data-status="sweeping"] .robot-body,
.roborock-stage[data-status="mopping"] .robot-body,
.roborock-stage[data-status="sweep_and_mop"] .robot-body {
  animation: robot-working 3.4s ease-in-out infinite;
}

.robot-dock {
  position: absolute;
  right: 8%;
  bottom: 14px;
  width: 72px;
  height: 30px;
  border: 1px solid rgba(184, 154, 255, 0.28);
  border-radius: 6px 6px 2px 2px;
  background: #11131a;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
}

.robot-dock::after {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 27px;
  height: 3px;
  border-radius: 2px;
  background: rgba(184, 154, 255, 0.5);
  content: "";
  transform: translateX(-50%);
}

@keyframes robot-working {
  0%, 100% { transform: translateX(-4px) rotate(-0.5deg); }
  50% { transform: translateX(4px) rotate(0.5deg); }
}

.robot-readout {
  display: grid;
  gap: 7px;
}

.robot-readout > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.robot-readout > strong {
  color: var(--text);
  font-size: clamp(34px, 5vw, 62px);
  font-weight: 520;
  line-height: 1;
}

.robot-readout > small {
  min-height: 20px;
  color: var(--violet);
  font-size: 12px;
  line-height: 1.45;
}

.robot-telemetry {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.robot-actions {
  display: grid;
  grid-template-columns: 1.35fr repeat(4, minmax(92px, 1fr));
  gap: 7px;
}

.robot-actions button {
  gap: 7px;
  min-width: 0;
  padding-inline: 9px;
}

.robot-start {
  border-color: rgba(184, 154, 255, 0.8) !important;
  background: var(--violet) !important;
  color: #0d0818 !important;
}

.robot-refresh {
  display: block;
  margin: 10px auto 0;
}

.robot-error {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 114, 102, 0.3);
  border-radius: 7px;
  background: rgba(255, 114, 102, 0.07);
  color: var(--danger);
  font-size: 12px;
}

.roborock-auth {
  border-color: rgba(184, 154, 255, 0.18);
}

.roborock-auth .primary {
  width: 100%;
}

.robot-code-step {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.robot-code-step input {
  letter-spacing: 0.24em;
  text-align: center;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.local-only-note {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(255, 189, 105, 0.3);
  border-radius: 7px;
  background: rgba(255, 189, 105, 0.07);
  color: var(--amber);
  font-size: 12px;
  line-height: 1.5;
}

.local-only-note code {
  color: var(--text);
  overflow-wrap: anywhere;
}

.robot-auth-status {
  margin-top: 13px;
  margin-bottom: 0;
}

.robot-auth-status.bad {
  color: var(--danger);
}

@media (max-width: 1080px) {
  .roborock-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .roborock-stage {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .roborock-grid {
    gap: 9px;
  }

  .roborock-stage {
    padding: 14px;
  }

  .robot-console {
    grid-template-columns: minmax(154px, 0.8fr) minmax(125px, 1.2fr);
    min-height: 210px;
    gap: 9px;
    margin: 8px 0 12px;
  }

  .robot-visual {
    min-height: 188px;
  }

  .robot-body {
    width: 154px;
    height: 154px;
  }

  .robot-body::before {
    top: 27px;
    width: 40px;
    height: 40px;
  }

  .robot-body::after {
    top: 41px;
    width: 13px;
    height: 13px;
  }

  .robot-body i {
    right: 24px;
    bottom: 33px;
    left: 24px;
  }

  .robot-body span {
    right: 16px;
    bottom: 16px;
    width: 30px;
    height: 30px;
  }

  .robot-dock {
    right: 2%;
    bottom: 5px;
    width: 55px;
    height: 24px;
  }

  .robot-readout > strong {
    font-size: clamp(27px, 9vw, 42px);
  }

  .robot-readout > small {
    font-size: 10px;
  }

  .robot-telemetry {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .robot-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .robot-actions .robot-start {
    grid-column: 1 / -1;
  }

  .robot-actions button {
    min-height: 47px;
    font-size: 10.5px;
  }
}

@media (max-width: 380px) {
  .robot-console {
    grid-template-columns: 132px minmax(0, 1fr);
  }

  .robot-body {
    width: 132px;
    height: 132px;
  }

  .robot-dock {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .roborock-stage .robot-body {
    animation: none !important;
  }
}

/* Pełne centrum Roborock */

.roborock-stage.compact {
  min-height: 0;
}

.roborock-stage.compact .robot-console {
  grid-template-columns: 140px minmax(0, 1fr);
  min-height: 126px;
  margin: 8px 0 12px;
}

.roborock-stage.compact .robot-visual {
  min-height: 120px;
}

.roborock-stage.compact .robot-body {
  width: 108px;
  height: 108px;
}

.roborock-stage.compact .robot-body::before {
  top: 20px;
  width: 30px;
  height: 30px;
}

.roborock-stage.compact .robot-body::after {
  top: 31px;
  width: 9px;
  height: 9px;
}

.roborock-stage.compact .robot-body i {
  right: 18px;
  bottom: 25px;
  left: 18px;
}

.roborock-stage.compact .robot-body span {
  right: 12px;
  bottom: 11px;
  width: 23px;
  height: 23px;
}

.roborock-stage.compact .robot-dock {
  display: none;
}

.roborock-stage.compact .robot-readout > strong {
  font-size: clamp(30px, 4vw, 46px);
}

.robot-workspace {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.robot-workspace-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 0;
}

.robot-workspace-head > div {
  display: grid;
  gap: 3px;
}

.robot-workspace-head h2 {
  margin: 0;
  font-size: clamp(21px, 3vw, 32px);
  font-weight: 560;
  letter-spacing: -0.035em;
}

.robot-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  white-space: nowrap;
}

.robot-live-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  content: "";
}

.robot-live-badge.online {
  border-color: rgba(var(--mint-rgb), 0.25);
  color: var(--mint);
}

.robot-live-badge.online::before {
  background: var(--mint);
  box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.65);
}

.robot-subnav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 12, 16, 0.88);
}

.robot-subnav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 740;
}

.robot-subnav button span {
  color: var(--violet);
  font-size: 17px;
  line-height: 1;
}

.robot-subnav button.active {
  background: rgba(184, 154, 255, 0.12);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(184, 154, 255, 0.2);
}

.robot-view {
  display: none;
}

.robot-view.active {
  display: block;
  animation: robot-view-in 180ms ease both;
}

@keyframes robot-view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.robot-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  align-items: start;
  gap: 12px;
}

.robot-map-card,
.robot-selection-card,
.robot-control-card,
.robot-routines-card,
.robot-dock-card,
.robot-history-card,
.robot-dnd-card,
.robot-settings-card,
.robot-care-card {
  border-color: rgba(184, 154, 255, 0.16);
}

.robot-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.robot-panel-head > div {
  display: grid;
  gap: 4px;
}

.robot-panel-head h3 {
  margin: 0;
  color: var(--text);
  font-size: clamp(17px, 2.2vw, 23px);
  font-weight: 560;
  letter-spacing: -0.025em;
}

.robot-map-picker {
  display: grid;
  min-width: 142px;
  gap: 4px;
}

.robot-map-picker > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
  text-transform: uppercase;
}

.robot-map-picker select {
  min-height: 36px;
  padding: 7px 30px 7px 9px;
}

.robot-target-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 10px;
}

.robot-target-tabs button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  line-height: 1.2;
}

.robot-target-tabs button.active {
  border-color: rgba(184, 154, 255, 0.52);
  background: rgba(184, 154, 255, 0.12);
  color: var(--text);
}

.robot-extra-tools {
  margin-top: 9px;
  border: 1px solid rgba(184, 154, 255, 0.2);
  border-radius: 8px;
  background: rgba(184, 154, 255, 0.035);
}

.robot-extra-tools summary {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  cursor: pointer;
  list-style: none;
}

.robot-extra-tools summary::-webkit-details-marker {
  display: none;
}

.robot-extra-tools summary::after {
  content: "+";
  color: var(--violet);
  font-size: 16px;
  line-height: 1;
}

.robot-extra-tools[open] summary::after {
  content: "−";
}

.robot-extra-tools-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.robot-extra-tools-body p {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
}

.robot-extra-target {
  min-height: 38px;
  border: 1px solid rgba(184, 154, 255, 0.25);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font-size: 10px;
  font-weight: 760;
}

.robot-extra-target.active {
  border-color: rgba(184, 154, 255, 0.58);
  background: rgba(184, 154, 255, 0.14);
}

.robot-map-frame {
  position: relative;
  display: grid;
  aspect-ratio: 16 / 10;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid rgba(184, 154, 255, 0.16);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 45%, rgba(184, 154, 255, 0.08), transparent 50%),
    #080c10;
  place-items: center;
  isolation: isolate;
}

.robot-map-frame::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(184, 154, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 154, 255, 0.1) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
}

.robot-map-frame img,
.robot-map-frame svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}

.robot-map-frame img {
  z-index: 1;
}

.robot-map-frame svg {
  z-index: 2;
  overflow: visible;
  touch-action: pan-y;
}

.robot-map-frame[data-ready="false"] svg,
.robot-map-frame[data-calibrated="false"] svg {
  pointer-events: none;
}

.robot-map-frame[data-target="zones"] svg,
.robot-map-frame[data-target="point"] svg {
  cursor: crosshair;
  touch-action: none;
}

.robot-map-empty {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  max-width: none;
  gap: 7px;
  padding: 20px;
  place-items: center;
  align-content: center;
  background: rgba(8, 12, 16, 0.94);
  color: var(--muted);
  pointer-events: auto;
  text-align: center;
}

.robot-map-empty strong {
  color: var(--text);
  font-size: 14px;
}

.robot-map-empty small {
  font-size: 10px;
  line-height: 1.5;
}

.robot-map-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(184, 154, 255, 0.18);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: robot-spinner 900ms linear infinite;
}

@keyframes robot-spinner {
  to { transform: rotate(360deg); }
}

.robot-map-environment {
  pointer-events: none;
}

.robot-routines-card {
  scroll-margin-top: 72px;
}

.robot-map-svg-shape,
.robot-map-frame svg polygon,
.robot-map-frame svg polyline,
.robot-map-frame svg line,
.robot-map-frame svg circle,
.robot-map-frame svg rect {
  vector-effect: non-scaling-stroke;
}

.map-room-hit {
  fill: rgba(184, 154, 255, 0.025);
  stroke: rgba(184, 154, 255, 0.16);
  stroke-width: 1.2;
  cursor: pointer;
  transition: fill 120ms ease, stroke 120ms ease;
}

.robot-map-frame[data-target="rooms"] .map-room-hit:hover,
.robot-map-frame[data-target="rooms"] .map-room-hit:focus-visible {
  fill: rgba(184, 154, 255, 0.15);
  stroke: rgba(184, 154, 255, 0.8);
  outline: none;
}

.map-room-hit.selected {
  fill: rgba(var(--mint-rgb), 0.21);
  stroke: var(--mint);
  stroke-width: 2;
}

.map-no-go,
.map-no-mop {
  fill: rgba(255, 114, 102, 0.16);
  stroke: rgba(255, 114, 102, 0.78);
  stroke-width: 1.5;
}

.map-no-mop {
  fill: rgba(75, 168, 255, 0.13);
  stroke: rgba(75, 168, 255, 0.72);
}

.map-wall {
  stroke: var(--danger);
  stroke-width: 2.2;
}

.map-clean-path,
.map-mop-path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.42);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-mop-path {
  stroke: rgba(75, 168, 255, 0.48);
}

.map-user-zone,
.map-zone-draft {
  fill: rgba(var(--mint-rgb), 0.18);
  stroke: var(--mint);
  stroke-width: 2;
  stroke-dasharray: 6 3;
}

.map-zone-draft {
  fill: rgba(184, 154, 255, 0.13);
  stroke: var(--violet);
}

.map-user-point-pulse {
  fill: rgba(var(--mint-rgb), 0.15);
  stroke: rgba(var(--mint-rgb), 0.55);
  animation: map-point-pulse 1.6s ease-out infinite;
}

.map-user-point,
.map-robot-marker {
  fill: var(--mint);
  stroke: #07110e;
  stroke-width: 2;
}

.map-robot-marker {
  fill: var(--violet);
  stroke: #0d0818;
}

.map-robot-center {
  fill: #0d0818;
}

.map-dock-marker {
  fill: #dce8ed;
  stroke: #111820;
  stroke-width: 2;
}

@keyframes map-point-pulse {
  0% { opacity: 1; transform: scale(0.8); transform-origin: center; }
  80%, 100% { opacity: 0; transform: scale(1.8); transform-origin: center; }
}

.robot-map-tip {
  min-height: 18px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.robot-room-list {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  margin-top: 9px;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.robot-room-list button {
  min-height: 38px;
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 10px;
  font-weight: 730;
}

.robot-room-list button.selected {
  border-color: rgba(var(--mint-rgb), 0.62);
  background: rgba(var(--mint-rgb), 0.13);
  color: var(--mint);
}

.robot-selection-card {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 12px;
}

.robot-selection-card > strong {
  min-height: 56px;
  color: var(--text);
  font-size: 25px;
  font-weight: 540;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.robot-clean-cta {
  min-height: 50px;
}

.robot-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.robot-quick-actions,
.robot-dock-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.robot-quick-actions button,
.robot-dock-actions button {
  min-height: 47px;
}

.robot-quick-actions button:first-child {
  grid-column: 1 / -1;
}

.robot-settings-grid {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}

.robot-dnd-card {
  grid-column: 1 / -1;
  min-width: 0;
}

.robot-dnd-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.robot-dnd-fieldset + .robot-dnd-fieldset {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.robot-dnd-fieldset legend {
  max-width: 100%;
  margin: 0 0 8px;
  padding: 0;
  color: var(--text);
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 720;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.robot-dnd-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.robot-dnd-row > span {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.robot-dnd-row input[type="checkbox"] {
  width: 42px;
  height: 23px;
  margin: 0;
  accent-color: var(--violet);
}

.robot-dnd-row input[type="time"] {
  width: min(145px, 42vw);
  min-width: 0;
}

.robot-dnd-actions input:disabled {
  opacity: 0.78;
  cursor: not-allowed;
}

.robot-dnd-hint {
  max-width: 70ch;
  margin: 9px 0 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

#roborockDndSave {
  width: min(100%, 280px);
}

#roborockDisconnectBtn {
  display: block;
  margin-top: 10px;
}

.robot-settings-grid .field,
.robot-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(135px, 0.75fr);
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.robot-setting-row > span,
.robot-settings-grid .field > span {
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
}

.robot-setting-row input[type="checkbox"] {
  width: 42px;
  height: 23px;
  justify-self: end;
  accent-color: var(--violet);
}

.robot-routines-card {
  margin-top: 12px;
}

.robot-routine-list,
.robot-history-list,
.robot-consumables {
  display: grid;
  gap: 8px;
}

.robot-routine-item,
.robot-history-item,
.robot-consumable-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
}

.robot-routine-item > div,
.robot-history-item {
  min-width: 0;
}

.robot-routine-item > div,
.robot-history-item {
  display: grid;
  gap: 4px;
}

.robot-routine-item strong,
.robot-history-item strong,
.robot-consumable-item strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 680;
}

.robot-routine-item span,
.robot-history-item span,
.robot-consumable-item span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.robot-routine-item button {
  min-height: 38px;
  flex: 0 0 auto;
}

.robot-dock-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 14px;
}

.robot-dock-status > div {
  display: grid;
  min-height: 76px;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
}

.robot-dock-status span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 730;
  text-transform: uppercase;
}

.robot-dock-status strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 570;
}

.robot-history-item {
  align-items: start;
}

.robot-history-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}

.robot-history-summary > article {
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(184, 154, 255, 0.055);
}

.robot-history-summary span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 730;
  line-height: 1.35;
}

.robot-history-summary strong {
  color: var(--text);
  font-size: clamp(15px, 2.5vw, 21px);
  font-weight: 620;
  line-height: 1.15;
}

.robot-history-card > .ghost {
  width: 100%;
  margin-top: 10px;
}

.robot-consumable-item {
  display: grid;
  grid-template-columns: 1fr auto;
}

.robot-consumable-item > div:first-child {
  display: contents;
}

.robot-consumable-track {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.robot-consumable-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--mint));
}

.robot-consumable-item .link {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 30px;
  padding: 0;
  font-size: 9px;
}

.robot-empty-copy {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 900px) {
  .robot-map-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .robot-selection-card {
    position: static;
    grid-template-columns: minmax(0, 1fr) minmax(140px, 0.5fr);
    align-items: end;
  }

  .robot-selection-card > .section-overline,
  .robot-selection-card > strong {
    grid-column: 1 / -1;
  }

  .robot-selection-card > strong {
    min-height: 0;
  }

  .robot-selection-card .robot-clean-cta {
    grid-column: 1 / -1;
  }

  .robot-selection-card > .ghost {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .roborock-stage.compact .robot-console {
    grid-template-columns: 92px minmax(0, 1fr);
    min-height: 92px;
  }

  .roborock-stage.compact .robot-visual {
    min-height: 88px;
  }

  .roborock-stage.compact .robot-body {
    width: 78px;
    height: 78px;
  }

  .roborock-stage.compact .robot-body::before {
    top: 14px;
    width: 22px;
    height: 22px;
  }

  .roborock-stage.compact .robot-body::after {
    top: 22px;
    width: 7px;
    height: 7px;
  }

  .robot-workspace-head {
    align-items: start;
  }

  .robot-live-badge {
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .robot-subnav {
    position: sticky;
    top: 4px;
    z-index: 20;
    grid-template-columns: repeat(5, minmax(58px, 1fr));
    overflow-x: auto;
    backdrop-filter: blur(14px);
  }

  .robot-subnav button {
    display: grid;
    min-height: 52px;
    gap: 2px;
    padding: 5px 3px;
    font-size: 8.5px;
  }

  .robot-subnav button span {
    font-size: 16px;
  }

  .robot-map-card,
  .robot-selection-card,
  .robot-control-card,
  .robot-routines-card,
  .robot-dock-card,
  .robot-history-card,
  .robot-dnd-card,
  .robot-settings-card,
  .robot-care-card {
    padding: 13px;
  }

  .robot-panel-head {
    align-items: center;
  }

  .robot-map-picker {
    min-width: 112px;
  }

  .robot-target-tabs {
    gap: 3px;
  }

  .robot-target-tabs button {
    min-height: 42px;
    padding-inline: 4px;
    font-size: 9px;
  }

  .robot-map-frame {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: min(57vh, 430px);
    min-height: 280px;
    aspect-ratio: auto;
  }

  .robot-selection-card {
    grid-template-columns: 1fr;
  }

  .robot-selection-card > *,
  .robot-selection-card > .section-overline,
  .robot-selection-card > strong,
  .robot-selection-card .robot-clean-cta,
  .robot-selection-card > .ghost {
    grid-column: 1;
  }

  .robot-two-column {
    grid-template-columns: minmax(0, 1fr);
  }

  .robot-dock-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .robot-settings-grid .field,
  .robot-setting-row {
    grid-template-columns: minmax(0, 1fr) minmax(120px, 0.8fr);
  }
}

@media (max-width: 390px) {
  .robot-workspace-head {
    display: grid;
  }

  .robot-live-badge {
    max-width: none;
    justify-self: start;
  }

  .robot-panel-head {
    display: grid;
  }

  .robot-map-picker {
    width: 100%;
  }

  .robot-quick-actions,
  .robot-dock-actions,
  .robot-dock-status {
    grid-template-columns: minmax(0, 1fr);
  }

  .robot-settings-grid .field,
  .robot-setting-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .robot-setting-row input[type="checkbox"] {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .robot-view.active,
  .robot-map-spinner,
  .map-user-point-pulse {
    animation: none !important;
  }
}
