:root {
  color-scheme: light;
  --brand-graphite: #182026;
  --brand-turquoise: #12b8a6;
  --brand-lime: #b8f34a;
  --brand-navy: #0b2433;
  --brand-navy-deep: #061923;

  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #edf3f2;
  --surface-subtle: #f8faf9;
  --text: #182026;
  --text-strong: #10171b;
  --muted: #52666b;
  --line: #d8e2e1;
  --line-strong: #bdcdcb;
  --primary: #08766e;
  --primary-hover: #075f59;
  --primary-soft: #ddf6f2;
  --accent: #8bbc21;
  --success: #16805a;
  --danger: #c43e4b;
  --warning: #a96808;
  --focus: #12b8a6;
  --input-bg: #ffffff;
  --chart-bg: #f8fbfa;
  --chart-grid: #dfe9e8;
  --chart-axis: #afc2c0;
  --page-glow: rgba(18, 184, 166, .11);
  --shadow: 0 16px 42px rgba(24, 32, 38, .08);
  --shadow-strong: 0 28px 78px rgba(11, 36, 51, .18);
  --backdrop: rgba(4, 20, 27, .58);

  --good-bg: #e8f8f0;
  --good-line: #b7ddca;
  --good-text: #12613e;
  --warn-bg: #fff4e5;
  --warn-line: #f0c28f;
  --warn-text: #805019;
  --bad-bg: #fff0f1;
  --bad-line: #f1b4ba;
  --bad-text: #a72f3b;
  --neutral-bg: #edf3f2;
  --neutral-line: #d8e2e1;
  --neutral-text: #52666b;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --type-body: 1rem;
  --type-small: .8125rem;
  --type-label: .75rem;
  --leading-body: 1.5;
  --leading-compact: 1.25;
  --leading-heading: 1.08;
  --tracking-heading: -.025em;
  --tracking-label: .1em;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #091820;
  --surface: #10242e;
  --surface-raised: #142b35;
  --surface-muted: #172f39;
  --surface-subtle: #0d2029;
  --text: #eaf4f3;
  --text-strong: #ffffff;
  --muted: #b4c5c8;
  --line: #29414a;
  --line-strong: #3d5962;
  --primary: #42d4c3;
  --primary-hover: #78e7da;
  --primary-soft: #123f3d;
  --accent: #b8f34a;
  --success: #56d29e;
  --danger: #ff7f8b;
  --warning: #f4b85a;
  --focus: #59e2d2;
  --input-bg: #0c2029;
  --chart-bg: #0c2029;
  --chart-grid: #24404a;
  --chart-axis: #3d5962;
  --page-glow: rgba(18, 184, 166, .13);
  --shadow: 0 18px 46px rgba(0, 0, 0, .25);
  --shadow-strong: 0 28px 82px rgba(0, 0, 0, .4);
  --backdrop: rgba(0, 8, 12, .78);
  --good-bg: #143a2f;
  --good-line: #2d6a52;
  --good-text: #9de4c2;
  --warn-bg: #43351c;
  --warn-line: #72582a;
  --warn-text: #ffd995;
  --bad-bg: #48242b;
  --bad-line: #78414b;
  --bad-text: #ffc1c7;
  --neutral-bg: #172f39;
  --neutral-line: #29414a;
  --neutral-text: #c0ced0;
}

:root[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #04131c;
  --surface: #08232d;
  --surface-raised: #0b2c37;
  --surface-muted: #0d3440;
  --surface-subtle: #061d27;
  --text: #e9fbf8;
  --text-strong: #ffffff;
  --muted: #b3cbcd;
  --line: #17414b;
  --line-strong: #25616a;
  --primary: #52e1d0;
  --primary-hover: #91f2e7;
  --primary-soft: #0b4543;
  --accent: #b8f34a;
  --success: #62dda7;
  --danger: #ff8190;
  --warning: #ffc264;
  --focus: #b8f34a;
  --input-bg: #061b24;
  --chart-bg: #061b24;
  --chart-grid: #16414a;
  --chart-axis: #25616a;
  --page-glow: rgba(18, 184, 166, .2);
  --shadow: 0 20px 52px rgba(0, 0, 0, .34);
  --shadow-strong: 0 32px 92px rgba(0, 0, 0, .52);
  --backdrop: rgba(0, 5, 9, .84);
  --good-bg: #0d392f;
  --good-line: #236b53;
  --good-text: #a2ebc7;
  --warn-bg: #403219;
  --warn-line: #725727;
  --warn-text: #ffe09f;
  --bad-bg: #432129;
  --bad-line: #78404b;
  --bad-text: #ffc1c9;
  --neutral-bg: #0d3440;
  --neutral-line: #17414b;
  --neutral-text: #c2d6d7;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 100% 0, var(--page-glow), transparent 34rem),
    radial-gradient(circle at 10% 108%, rgba(184, 243, 74, .05), transparent 28rem),
    var(--bg);
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: var(--type-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.install-help-open {
  overflow: hidden;
}

.comfort-pilot {
  margin: 0 0 34px;
}

.comfort-pilot-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.comfort-pilot-head h2 {
  margin: 5px 0 0;
  color: var(--text-strong);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  letter-spacing: 0;
}

.comfort-pilot-actions,
.comfort-range {
  display: flex;
  align-items: center;
  gap: 7px;
}

.comfort-range {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.comfort-range button,
.comfort-refresh {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.comfort-range button {
  padding: 0 14px;
}

.comfort-range button.active {
  color: var(--primary);
  background: var(--surface-raised);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

.comfort-refresh {
  width: 42px;
  border: 1px solid var(--line-strong);
  background: var(--surface-raised);
  font-size: 1.45rem;
}

.comfort-pilot-status {
  min-height: 24px;
  color: var(--muted);
  font-size: var(--type-small);
}

.comfort-pilot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.comfort-chart-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.comfort-chart-card > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}

.comfort-chart-card > header > div:first-child > span {
  color: var(--primary);
  font-size: .72rem;
  font-weight: 900;
}

.comfort-chart-card h3 {
  margin: 2px 0 0;
  color: var(--text-strong);
  font-size: 1rem;
  letter-spacing: 0;
  line-height: 1.25;
}

.comfort-legend,
.comfort-latest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.comfort-legend {
  justify-content: end;
  color: var(--muted);
  font-size: .72rem;
}

.comfort-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.comfort-legend i {
  width: 18px;
  height: 4px;
  border-radius: 2px;
}

.comfort-legend i.dashed {
  height: 0;
  border-top: 3px dashed;
  border-radius: 0;
}

.comfort-latest {
  min-height: 31px;
  padding: 0 16px 8px;
  color: var(--muted);
  font-size: .76rem;
}

.comfort-latest span {
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--surface-muted);
}

.comfort-chart-frame {
  position: relative;
  padding: 0 8px 8px;
}

.comfort-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 260px;
  touch-action: pan-y;
}

.comfort-plot {
  fill: var(--chart-bg);
}

.comfort-grid line {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

.comfort-axis text,
.comfort-lane {
  fill: var(--muted);
  font-family: inherit;
  font-size: 11px;
}

.comfort-lane {
  font-weight: 800;
}

.comfort-actual,
.comfort-setpoint {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.comfort-setpoint {
  stroke-dasharray: 7 6;
}

.comfort-crosshair {
  stroke: var(--text-strong);
  stroke-width: 1.5;
  opacity: 0;
  pointer-events: none;
}

.comfort-crosshair.visible {
  opacity: .7;
}

.comfort-hit {
  fill: transparent;
  cursor: crosshair;
}

.comfort-tooltip {
  position: absolute;
  z-index: 4;
  bottom: 24px;
  left: 50%;
  width: min(260px, calc(100% - 24px));
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: var(--shadow-strong);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
}

.comfort-tooltip.visible {
  opacity: 1;
}

.comfort-tooltip > strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text-strong);
}

.comfort-tooltip span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  font-size: .78rem;
}

.comfort-tooltip em {
  font-style: normal;
  text-align: right;
}

.comfort-empty {
  grid-column: 1 / -1;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.room-comfort-panel {
  min-width: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.room-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.room-chart-zones,
.room-chart-range {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.room-chart-zones button,
.room-chart-range button {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: .76rem;
  font-weight: 800;
  cursor: pointer;
}

.room-chart-zones button.active,
.room-chart-range button.active {
  color: var(--primary);
  background: var(--surface-raised);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .12);
}

.room-chart-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .74rem;
}

.room-chart-summary > span {
  font-weight: 800;
}

.room-chart-summary > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 4px 10px;
}

.room-chart-summary > div span {
  white-space: nowrap;
}

.room-chart-frame {
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--chart-bg);
}

.room-chart-frame .comfort-chart-svg {
  min-height: 240px;
}

@media (max-width: 640px) {
  .room-chart-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .room-chart-zones,
  .room-chart-range {
    width: 100%;
  }

  .room-chart-zones button,
  .room-chart-range button {
    flex: 1;
  }

  .room-chart-summary {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .room-chart-summary > div {
    justify-content: start;
  }

  .room-chart-frame .comfort-chart-svg {
    min-height: 230px;
  }
}

@media (max-width: 980px) {
  .comfort-pilot-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .comfort-pilot-head {
    align-items: stretch;
    flex-direction: column;
  }

  .comfort-pilot-actions {
    justify-content: space-between;
  }

  .comfort-range {
    flex: 1;
  }

  .comfort-range button {
    flex: 1;
    padding: 0 8px;
  }

  .comfort-chart-card > header {
    flex-direction: column;
  }

  .comfort-legend {
    justify-content: start;
  }

  .comfort-chart-svg {
    min-height: 245px;
  }
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
select {
  touch-action: manipulation;
}

button {
  -webkit-tap-highlight-color: transparent;
}

::selection {
  color: var(--brand-navy-deep);
  background: var(--brand-lime);
}

:where(a, button, input, select):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #fff;
  border-radius: var(--radius-sm);
  background: var(--brand-navy);
  transform: translateY(-180%);
  transition: transform .18s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 0 max(40px, env(safe-area-inset-bottom));
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0 22px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
  border-radius: 15px;
  box-shadow: 0 10px 22px rgba(6, 25, 35, .16);
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1;
}

.brand-copy strong {
  color: var(--text-strong);
  font-size: 1.05rem;
  font-weight: 850;
  letter-spacing: .12em;
}

.brand-copy span {
  margin-top: 6px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.theme-control,
.status,
.utility-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 8px 24px rgba(11, 36, 51, .05);
  backdrop-filter: blur(14px);
}

.theme-control {
  display: grid;
  grid-template-columns: 20px auto minmax(112px, auto);
  align-items: center;
  gap: 8px;
  padding: 5px 7px 5px 11px;
  color: var(--muted);
}

.theme-icon,
.theme-icon svg {
  display: block;
  width: 19px;
  height: 19px;
}

.theme-icon svg,
.utility-button svg,
.summary-icon svg {
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-label {
  font-size: var(--type-small);
  font-weight: 750;
}

.theme-control select {
  min-width: 0;
  min-height: 32px;
  padding: 5px 28px 5px 9px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  font-size: var(--type-small);
  font-weight: 700;
}

.utility-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  color: var(--text);
  cursor: pointer;
}

.utility-button:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.utility-button svg {
  width: 18px;
  height: 18px;
}

.utility-button span {
  font-size: var(--type-small);
  font-weight: 750;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  color: var(--muted);
  font-size: var(--type-small);
  font-weight: 750;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--warning) 14%, transparent);
}

.dot.online {
  background: var(--success);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 14%, transparent);
}

.dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 14%, transparent);
}

.hero {
  position: relative;
  display: grid;
  min-height: 260px;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--surface-raised), var(--surface-muted));
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 62px);
}

.eyebrow {
  color: var(--primary);
  font-size: var(--type-label);
  font-weight: 850;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--text-strong);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
  text-wrap: balance;
}

h1 {
  max-width: 660px;
  margin-top: 10px;
  font-size: clamp(2rem, 4.3vw, 3.75rem);
  font-weight: 820;
}

h2 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: 800;
}

.hero-copy p {
  max-width: 590px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.16rem);
}

.scene {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(6, 25, 35, .94), rgba(11, 51, 62, .94)),
    var(--brand-navy);
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to left, #000, transparent);
}

.scene-glow {
  position: absolute;
  width: 250px;
  height: 250px;
  top: -80px;
  right: -50px;
  border-radius: 50%;
  background: rgba(18, 184, 166, .34);
  filter: blur(24px);
}

.building {
  position: absolute;
  inset: 38px 34px 54px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  transform: perspective(620px) rotateY(-8deg);
}

.building span {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(95, 219, 201, .28);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .025)),
    rgba(18, 184, 166, .07);
}

.building span:nth-child(2),
.building span:nth-child(7) {
  background: rgba(184, 243, 74, .28);
  box-shadow: 0 0 32px rgba(184, 243, 74, .18);
}

.building span::after {
  content: "";
  position: absolute;
  inset: 12px 7px;
  border-top: 2px solid rgba(255, 255, 255, .12);
  border-bottom: 2px solid rgba(255, 255, 255, .08);
}

.scene-caption {
  position: absolute;
  right: 30px;
  bottom: 20px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #fff;
}

.scene-caption span {
  color: #8eb3b6;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .16em;
}

.scene-caption strong {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 34px;
}

.summary {
  display: grid;
  min-width: 0;
  min-height: 118px;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 2px 13px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-icon {
  display: grid;
  width: 44px;
  height: 44px;
  grid-row: 1 / 3;
  place-items: center;
  align-self: center;
  color: var(--primary);
  border-radius: 13px;
  background: var(--primary-soft);
}

.summary-icon svg {
  width: 23px;
  height: 23px;
}

.summary > span:not(.summary-icon) {
  align-self: end;
  color: var(--muted);
  font-size: var(--type-small);
  font-weight: 700;
}

.summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-strong);
  font-size: clamp(1.3rem, 2.2vw, 1.75rem);
  font-variant-numeric: tabular-nums lining-nums;
}

.section-heading {
  display: flex;
  min-width: 0;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 2px 16px;
}

.section-heading h2 {
  margin-top: 6px;
}

.section-heading p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: var(--type-small);
}

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

.room-card {
  min-width: 0;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 95% 0, var(--page-glow), transparent 15rem),
    var(--surface);
  box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

@media (hover: hover) {
  .room-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-strong);
    transform: translateY(-2px);
  }
}

.room-card.cleaning-active {
  border-color: color-mix(in srgb, var(--warning) 46%, var(--line));
  background:
    radial-gradient(circle at 95% 0, color-mix(in srgb, var(--warning) 15%, transparent), transparent 15rem),
    linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--warning) 8%, var(--surface)));
}

.room-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.room-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.room-title strong {
  min-width: 0;
  color: var(--text-strong);
  font-size: 1.35rem;
  font-weight: 820;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}

.room-title span,
.meta {
  color: var(--muted);
  font-size: var(--type-small);
}

.temp {
  flex: 0 0 auto;
  text-align: right;
}

.temp strong {
  display: block;
  color: var(--text-strong);
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1;
  white-space: nowrap;
}

.temp span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--type-small);
  font-variant-numeric: tabular-nums lining-nums;
}

.room-states {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -3px 0 18px;
}

.chip {
  display: inline-flex;
  min-height: 29px;
  max-width: 100%;
  align-items: center;
  padding: 5px 9px;
  color: var(--neutral-text);
  border: 1px solid var(--neutral-line);
  border-radius: 999px;
  background: var(--neutral-bg);
  font-size: .78rem;
  font-weight: 720;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.guest-in,
.windows-closed,
.climate-stable {
  color: var(--good-text);
  border-color: var(--good-line);
  background: var(--good-bg);
}

.guest-out,
.windows-open,
.climate-heating,
.climate-cooling {
  color: var(--warn-text);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.guest-blocked,
.climate-blocked {
  color: var(--bad-text);
  border-color: var(--bad-line);
  background: var(--bad-bg);
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.controls > div {
  min-width: 0;
}

.controls .meta {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.setpoint {
  display: grid;
  min-width: 0;
  grid-template-columns: 44px minmax(84px, 1fr) 44px;
  gap: 8px;
}

.setpoint input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 7px;
  color: var(--text-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font-weight: 780;
  font-variant-numeric: tabular-nums lining-nums;
  text-align: center;
}

.btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 13px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  box-shadow: 0 6px 14px rgba(11, 36, 51, .05);
  font-weight: 720;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease, transform .16s ease;
}

.btn:hover:not(:disabled) {
  color: var(--primary);
  border-color: var(--primary);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn.primary {
  min-width: 94px;
  color: #fff;
  border-color: var(--primary);
  background: linear-gradient(135deg, #0d9e91, #08766e);
  box-shadow: 0 10px 22px rgba(7, 104, 96, .2);
}

:root[data-theme="dark"] .btn.primary,
:root[data-theme="midnight"] .btn.primary {
  color: #fff;
  border-color: #0d9e91;
}

.btn.primary:hover:not(:disabled) {
  color: #fff;
  border-color: var(--primary-hover);
  background: linear-gradient(135deg, #0db09e, #08766e);
}

.btn.clean {
  min-width: 120px;
  color: var(--good-text);
  border-color: var(--good-line);
  background: var(--good-bg);
}

.btn.clean.active {
  color: var(--warn-text);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.btn.clean.blocked {
  color: var(--neutral-text);
  border-color: var(--neutral-line);
  background: var(--neutral-bg);
}

.btn[disabled],
.dnd-bar[disabled] {
  cursor: not-allowed;
  opacity: .52;
}

.mini-history {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.mini-history.loading {
  display: flex;
  min-height: 64px;
  align-items: center;
  color: var(--muted);
  font-size: var(--type-small);
}

.mini-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: var(--type-small);
}

.mini-history-head strong {
  color: var(--text-strong);
  font-size: var(--type-small);
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}

.mini-history svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.mini-chart-bg {
  fill: var(--chart-bg);
}

.mini-history-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.2;
}

.mini-history-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.mini-history-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.mini-axis {
  stroke: var(--chart-axis);
  stroke-width: 1;
}

.mini-grid {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

.mini-label {
  fill: var(--muted);
  font-size: 10px;
}

.mini-actual,
.mini-set {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-actual {
  stroke: #3687f5;
}

.mini-set {
  stroke: var(--primary);
  stroke-dasharray: 6 5;
}

.mini-dot-actual {
  fill: #3687f5;
  background: #3687f5;
}

.mini-dot-set {
  fill: var(--primary);
  background: var(--primary);
}

.dnd-bar {
  width: 100%;
  min-height: 44px;
  margin-top: 15px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 760;
  line-height: 1.25;
  text-align: center;
}

.dnd-bar.dnd-active {
  color: var(--bad-text);
  border-color: var(--bad-line);
  background: var(--bad-bg);
}

.dnd-bar.dnd-guest-in {
  color: var(--warn-text);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}

.dnd-bar.dnd-guest-out {
  color: var(--good-text);
  border-color: var(--good-line);
  background: var(--good-bg);
}

.dnd-bar[disabled] {
  opacity: 1;
  cursor: default;
}

.room-foot {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.room-foot .meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.other-card {
  background:
    radial-gradient(circle at 95% 0, rgba(184, 243, 74, .1), transparent 15rem),
    var(--surface);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 2px 0;
  color: var(--muted);
  font-size: .75rem;
}

.is-offline #pwa-state {
  color: var(--warning);
  font-weight: 800;
}

.toast {
  position: fixed;
  z-index: 120;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 15px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  background: var(--brand-navy-deep);
  box-shadow: var(--shadow-strong);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(.98);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.install-sheet {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.install-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--backdrop);
  backdrop-filter: blur(5px);
}

.install-card {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  padding: 28px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-strong);
  text-align: center;
}

.install-card img {
  border-radius: 17px;
  box-shadow: var(--shadow);
}

.install-card h2 {
  margin-top: 18px;
}

.install-card p {
  margin: 13px auto 22px;
  color: var(--muted);
}

.install-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.install-done {
  min-width: 130px;
}

@media (max-width: 920px) {
  .shell {
    width: min(100% - 24px, 760px);
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .scene {
    min-height: 190px;
  }

  .building {
    inset: 26px 32px 45px;
  }

  .overview,
  .rooms {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 560px);
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr auto;
    margin: 0 -10px 14px;
    padding: 8px 10px 10px;
    background: color-mix(in srgb, var(--bg) 91%, transparent);
    backdrop-filter: blur(18px);
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .brand-copy strong {
    font-size: .96rem;
  }

  .brand-copy span {
    font-size: .64rem;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: auto auto;
    gap: 7px;
  }

  .theme-control {
    grid-template-columns: 18px minmax(98px, auto);
    padding-left: 9px;
  }

  .theme-label {
    display: none;
  }

  .theme-control select {
    min-width: 98px;
    font-size: .75rem;
  }

  .status {
    grid-column: 1 / -1;
    min-height: 34px;
    justify-self: end;
    padding: 0 10px;
    border-radius: 10px;
    box-shadow: none;
  }

  .utility-button {
    min-width: 42px;
    padding: 0 10px;
  }

  .utility-button span {
    display: none;
  }

  .hero {
    min-height: 0;
    border-radius: 20px;
  }

  .hero-copy {
    padding: 28px 22px 30px;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 2.75rem);
  }

  .hero-copy p {
    margin-top: 14px;
  }

  .scene {
    min-height: 150px;
  }

  .building {
    inset: 20px 24px 40px;
    gap: 8px;
  }

  .scene-caption {
    right: 22px;
    bottom: 14px;
  }

  .overview {
    grid-template-columns: 1fr;
    gap: 9px;
    margin-bottom: 28px;
  }

  .summary {
    min-height: 86px;
    padding: 14px 16px;
  }

  .summary strong {
    font-size: 1.4rem;
  }

  .section-heading {
    display: block;
    margin-bottom: 13px;
  }

  .section-heading p {
    margin-top: 8px;
  }

  .rooms {
    gap: 10px;
  }

  .room-card {
    padding: 16px;
    border-radius: 15px;
  }

  .room-head {
    gap: 10px;
    margin-bottom: 14px;
  }

  .room-title strong {
    font-size: 1.2rem;
  }

  .temp strong {
    font-size: 1.75rem;
  }

  .room-states {
    margin-bottom: 15px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .controls > .btn.primary {
    width: 100%;
  }

  .setpoint {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
  }

  .setpoint input,
  .setpoint .btn,
  .controls > .btn {
    min-height: 48px;
  }

  .room-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .btn.clean {
    width: 100%;
    min-height: 46px;
  }

  .mini-history {
    margin-top: 15px;
    padding-top: 13px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 24px 2px 0;
  }

  .toast {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    max-width: none;
  }

  .install-sheet {
    align-items: end;
    padding: 10px;
  }

  .install-card {
    padding: 26px 20px max(22px, env(safe-area-inset-bottom));
    border-radius: 22px;
  }
}

@media (max-width: 390px) {
  .brand-copy span {
    display: none;
  }

  .theme-control {
    grid-template-columns: minmax(92px, auto);
    padding-left: 7px;
  }

  .theme-icon {
    display: none;
  }

  .room-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .temp {
    text-align: left;
  }
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.auth-layout {
  width: min(960px, 100%);
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .86fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow-strong);
}

.auth-layout.compact {
  width: min(560px, 100%);
  min-height: 0;
  grid-template-columns: 1fr;
}

.auth-panel,
.auth-aside {
  padding: clamp(28px, 5vw, 58px);
}

.auth-panel {
  display: flex;
  flex-direction: column;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 12px;
  color: var(--text-strong);
  text-decoration: none;
}

.auth-brand img {
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(11, 36, 51, .18);
}

.auth-brand span {
  display: grid;
}

.auth-brand strong {
  letter-spacing: .12em;
}

.auth-brand small {
  color: var(--muted);
}

.auth-heading {
  margin: auto 0 26px;
  padding-top: 56px;
}

.auth-heading h1 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 5vw, 3rem);
}

.auth-heading p,
.auth-note,
.field-help,
.card-heading p {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-form label,
.invite-form label,
.compact-field {
  display: grid;
  gap: 7px;
  color: var(--text-strong);
  font-size: .9rem;
  font-weight: 700;
}

.auth-form input,
.invite-form input,
.invite-form select,
.compact-field input,
.invite-result input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--text);
  background: var(--input-bg);
  font: inherit;
}

.auth-form input:focus,
.invite-form input:focus,
.invite-form select:focus,
.compact-field input:focus,
.invite-result input:focus {
  outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent);
  border-color: var(--focus);
}

.auth-submit {
  min-height: 50px;
  margin-top: 4px;
}

.auth-note {
  margin: 24px 0 0;
  font-size: .86rem;
}

.auth-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #effffd;
  background:
    radial-gradient(circle at 85% 15%, rgba(184, 243, 74, .24), transparent 28%),
    linear-gradient(145deg, #0b3b47, #071d29 72%);
}

.auth-aside h2 {
  margin: 12px 0 20px;
  color: #effffd;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.12;
}

.auth-aside .eyebrow {
  color: #9ef2dc;
}

.auth-aside p {
  color: #c7dfdf;
  line-height: 1.65;
}

.auth-theme {
  align-self: flex-start;
  grid-template-columns: auto minmax(140px, auto);
  width: 100%;
  padding-left: 13px;
  color: #effffd;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .18);
}

.form-message {
  margin: 0;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: .88rem;
}

.form-message.error {
  color: var(--bad-text);
  background: var(--bad-bg);
  border: 1px solid var(--bad-line);
}

.form-message.success {
  color: var(--good-text);
  background: var(--good-bg);
  border: 1px solid var(--good-line);
}

.text-link {
  margin-top: 22px;
  color: var(--primary);
  font-weight: 700;
}

.narrow-shell {
  max-width: 920px;
}

.settings-main {
  display: grid;
  gap: 20px;
  padding: 34px 0;
}

.settings-card {
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-card h2 {
  margin-top: 0;
}

.settings-form {
  max-width: 560px;
}

.notice.warning {
  padding: 12px 14px;
  border: 1px solid var(--warn-line);
  border-radius: 12px;
  color: var(--warn-text);
  background: var(--warn-bg);
}

.user-pill {
  max-width: 240px;
  overflow: hidden;
  color: var(--muted);
  font-size: .84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(170px, .7fr) auto;
  align-items: end;
  gap: 12px;
}

.invite-form .btn {
  min-height: 48px;
}

.invite-result {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--good-line);
  border-radius: 14px;
  background: var(--good-bg);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.users-list {
  display: grid;
  gap: 14px;
}

.user-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.user-card-head,
.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.user-card-head > div {
  display: grid;
  gap: 3px;
}

.user-card-head span {
  color: var(--muted);
  font-size: .85rem;
}

.active-toggle,
.permission {
  display: flex;
  align-items: center;
  gap: 9px;
}

.active-toggle input,
.permission input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

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

.permission {
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: .88rem;
}

.cleaning-shell {
  max-width: 1180px;
}

.cleaning-hero {
  align-items: center;
}

.cleaning-summary {
  min-width: 190px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 20px;
  color: #effffd;
  background: rgba(255, 255, 255, .08);
}

.cleaning-summary strong {
  font-size: 3rem;
  line-height: 1;
}

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

.cleaning-card {
  display: grid;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cleaning-card.active {
  border-color: var(--good-line);
  background: linear-gradient(145deg, var(--good-bg), var(--surface) 62%);
}

.cleaning-card.blocked {
  border-color: var(--bad-line);
}

.cleaning-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cleaning-card-head h3 {
  margin: 4px 0 0;
  font-size: 1.25rem;
}

.room-code {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .1em;
}

.permission-badge {
  max-width: 240px;
  padding: 7px 10px;
  border: 1px solid;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 800;
  text-align: center;
}

.permission-badge.allowed {
  color: var(--good-text);
  border-color: var(--good-line);
  background: var(--good-bg);
}

.permission-badge.denied {
  color: var(--bad-text);
  border-color: var(--bad-line);
  background: var(--bad-bg);
}

.cleaning-state {
  display: grid;
  gap: 3px;
}

.cleaning-state strong {
  color: var(--text-strong);
  font-size: 1.8rem;
}

.cleaning-state span {
  color: var(--muted);
  font-size: .85rem;
}

@media (max-width: 760px) {
  .auth-page {
    padding: 0;
    place-items: stretch;
  }

  .auth-layout {
    min-height: 100vh;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
  }

  .auth-aside {
    min-height: 260px;
  }

  .auth-panel,
  .auth-aside {
    padding: 28px 22px;
  }

  .auth-heading {
    margin-top: 16px;
    padding-top: 20px;
  }

  .invite-form,
  .cleaning-grid,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .user-card-head,
  .cleaning-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .permission-badge {
    max-width: none;
  }

  .user-pill {
    display: none;
  }
}

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

@media print {
  :root {
    color-scheme: light !important;
    --bg: #fff;
    --surface: #fff;
    --surface-raised: #fff;
    --surface-muted: #f5f7f8;
    --surface-subtle: #f8faf9;
    --text: #182026;
    --text-strong: #10171b;
    --muted: #52666b;
    --line: #d8e2e1;
  }

  html,
  body {
    color: #182026 !important;
    background: #fff !important;
  }

  .topbar-actions,
  .toast,
  .install-sheet,
  .footer {
    display: none !important;
  }

  .hero,
  .summary,
  .room-card {
    color: #182026 !important;
    background: #fff !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
}
