:root {
  color-scheme: dark;
  --ink: #e7f1ef;
  --ink-soft: #9dafad;
  --paper: #0d1517;
  --card: #151f22;
  --line: #2d3c3f;
  --surface-subtle: #111a1c;
  --surface-raised: #1b272a;
  --surface-frosted: rgba(21, 31, 34, 0.86);
  --teal: #40bdb6;
  --teal-dark: #86d9d4;
  --teal-pale: #173532;
  --amber: #e39a5c;
  --amber-pale: #39281d;
  --red: #ef8178;
  --red-pale: #3a2221;
  --blue: #79b9de;
  --blue-pale: #1c303c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 85% 5%, rgba(64, 189, 182, 0.09), transparent 28rem),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  color: inherit;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 64px);
}

.masthead-status {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 18px;
}

.outside-reading {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 290px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-frosted);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
}

.outside-glyph {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: var(--teal);
  background: var(--teal-pale);
  font-size: 17px;
  font-weight: 800;
}

.outside-reading > span:last-child,
.outside-label,
.outside-values,
.outside-updated,
.outside-doors,
.outside-door {
  display: block;
}

.outside-label,
.outside-updated {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.3;
}

.outside-label {
  margin-bottom: 2px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.outside-values {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 15px;
  line-height: 1.25;
}

.outside-values > span[aria-hidden] {
  color: var(--line);
}

.outside-updated {
  margin-top: 2px;
}

.outside-doors {
  display: grid;
  gap: 1px;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.outside-door {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.35;
}

.outside-door.open {
  color: var(--red);
  font-weight: 750;
}

.outside-door.closed {
  color: var(--teal-dark);
}

.outside-door.offline {
  color: #778684;
}

.outside-reading.offline .outside-glyph,
.outside-reading.loading .outside-glyph {
  color: var(--ink-soft);
  background: var(--surface-raised);
}

.tab-bar {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 64px);
}

.tab-bar > div {
  display: inline-flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-frosted);
}

.tab-button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  padding: 8px 18px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.tab-button.active {
  color: #071212;
  background: var(--teal);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.25);
}

.tab-button:focus-visible {
  outline: 3px solid rgba(10, 108, 104, 0.24);
  outline-offset: 2px;
}

.app-panel[hidden] {
  display: none;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #071212;
  background: var(--teal);
  font: 750 13px/1 ui-monospace, monospace;
  letter-spacing: 0.08em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
}

.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #697775;
  box-shadow: 0 0 0 4px rgba(155, 155, 145, 0.14);
}

.connection.online .status-dot {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(10, 108, 104, 0.13);
}

.connection.error .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(163, 60, 53, 0.12);
}

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 34px clamp(20px, 4vw, 64px) 80px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
  align-items: end;
  gap: clamp(30px, 7vw, 110px);
  padding: 54px 0 66px;
}

.eyebrow,
.card-label {
  margin: 0 0 9px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(31px, 4vw, 46px);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.lede {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.55;
}

.system-card {
  display: grid;
  gap: 22px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-frosted);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.system-state {
  margin-bottom: 5px;
  font-size: 25px;
  font-weight: 720;
}

.muted {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  font-size: 14px;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  position: relative;
  width: 43px;
  height: 24px;
  border-radius: 999px;
  background: #536260;
  transition: 160ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e9f1ef;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: 160ms ease;
}

.switch input:checked + span {
  background: var(--teal);
}

.switch input:checked + span::after {
  transform: translateX(19px);
}

.switch input:focus-visible + span {
  outline: 3px solid rgba(10, 108, 104, 0.25);
  outline-offset: 3px;
}

.compact-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  font-weight: 650;
}

select,
input[type="number"],
input[type="time"],
input[type="text"] {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
  padding: 8px 10px;
}

select:focus,
input:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(10, 108, 104, 0.12);
}

.action-bar {
  position: sticky;
  z-index: 5;
  top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
  padding: 13px 14px 13px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(21, 31, 34, 0.94);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.action-bar > div {
  display: flex;
  gap: 9px;
}

.save-state {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.save-state.dirty {
  color: var(--amber);
  font-weight: 700;
}

.button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 720;
  font-size: 13px;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 3px solid rgba(10, 108, 104, 0.24);
  outline-offset: 2px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button.primary {
  color: #071212;
  background: var(--teal);
}

.button.primary:hover:not(:disabled) {
  background: var(--teal-dark);
}

.button.secondary {
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.button.danger {
  color: #fff;
  background: var(--red);
}

.error-banner {
  margin-bottom: 30px;
  padding: 15px 18px;
  border: 1px solid #75423f;
  border-radius: 13px;
  color: #ffaaa3;
  background: var(--red-pale);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
}

.section-heading > p {
  max-width: 380px;
  margin: 0;
  color: var(--ink-soft);
  text-align: right;
  line-height: 1.5;
}

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

.room-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.room-card.offline {
  opacity: 0.72;
}

.room-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 24px 24px 17px;
}

.room-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
}

.room-title-row h3 {
  margin: 0;
  font-size: 21px;
}

.room-kind {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--teal-pale);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.temperature-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 18px;
}

.current-temp {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 52px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.target-temp {
  color: var(--ink-soft);
  font-size: 13px;
}

.target-temp b {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 18px;
}

.door-target-note {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.state-stack {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 7px;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--ink-soft);
  background: var(--surface-raised);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.state-pill.heat {
  color: #f0af79;
  background: var(--amber-pale);
}

.state-pill.cool {
  color: #9ed3f1;
  background: var(--blue-pale);
}

.state-pill.blocked {
  color: #e5b87d;
  background: #342a1d;
}

.humidity {
  color: var(--ink-soft);
  font-size: 12px;
}

.decision {
  margin: 0;
  padding: 0 24px 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.curve-wrap {
  padding: 0 18px 17px;
}

.curve-chart {
  display: block;
  width: 100%;
  height: 120px;
}

.curve-grid {
  stroke: #29383a;
  stroke-width: 1;
}

.curve-line {
  fill: none;
  stroke: var(--teal);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.curve-area {
  fill: rgba(64, 189, 182, 0.1);
}

.curve-now {
  stroke: var(--amber);
  stroke-width: 2;
  stroke-dasharray: 3 4;
}

.curve-label {
  fill: #899a98;
  font-size: 9px;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.manual-controls {
  display: flex;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.manual-controls .button {
  flex: 1;
  min-height: 37px;
  padding: 7px 8px;
}

.manual-controls .heat-button {
  color: #f0af79;
  background: var(--amber-pale);
}

.manual-controls .cool-button {
  color: #9ed3f1;
  background: var(--blue-pale);
}

.target-boost-controls {
  border-top: 0;
  background: #13201f;
}

.heater-card .target-boost-controls {
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.room-editor {
  padding: 20px 24px 24px;
}

.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.editor-heading strong {
  font-size: 14px;
}

.room-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-subtle);
}

.room-toggle-row strong,
.room-toggle-row small {
  display: block;
}

.door-interlock-row {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #5b4935;
  border-radius: 13px;
  background: #211c17;
}

.door-interlock-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.door-interlock-toggle strong,
.door-interlock-toggle small {
  display: block;
}

.door-interlock-toggle strong {
  margin-bottom: 3px;
  font-size: 13px;
}

.door-interlock-toggle small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.4;
}

.door-condition {
  display: grid;
  grid-template-columns: auto minmax(170px, 1fr);
  align-items: center;
  gap: 12px;
}

.door-condition > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 720;
}

.door-condition select {
  min-width: 0;
  width: 100%;
}

.room-toggle-row strong {
  margin-bottom: 3px;
  font-size: 13px;
}

.room-toggle-row small {
  max-width: 410px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.4;
}

.temperature-boost-copy {
  flex: 1 1 auto;
}

.temperature-boost-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: end;
  gap: 14px;
}

.temperature-boost-value {
  display: grid;
  gap: 5px;
  width: 92px;
}

.temperature-boost-value > span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 720;
}

.temperature-boost-value input {
  width: 100%;
}

.morning-ramp-editor {
  display: grid;
  gap: 13px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #365363;
  border-radius: 13px;
  background: #142027;
}

.morning-ramp-copy strong,
.morning-ramp-copy small {
  display: block;
}

.morning-ramp-copy strong {
  margin-bottom: 3px;
  font-size: 13px;
}

.morning-ramp-copy small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.4;
}

.morning-ramp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 720;
}

.field input {
  width: 100%;
}

.field-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.45;
}

.heater-section {
  margin-top: 70px;
}

.vent-section {
  margin-top: 48px;
}

.vent-global-setting {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 0.4fr);
  gap: 22px;
  align-items: end;
  margin-bottom: 20px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.vent-global-setting h3,
.vent-global-setting p {
  margin: 0;
}

.vent-global-setting > div > p:last-child {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.45;
}

.vent-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.vent-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.vent-card.is-on {
  border-color: #497b91;
  box-shadow: 0 16px 42px rgba(44, 108, 140, 0.18);
}

.vent-card.offline {
  opacity: 0.72;
}

.vent-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 12px;
}

.vent-card-header h3 {
  margin-bottom: 3px;
  font-size: 22px;
}

.vent-card-header small,
.vent-enabled-row small {
  display: block;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.4;
}

.vent-decision {
  margin: 0;
  padding: 0 24px 12px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.vent-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 24px 20px;
}

.vent-status-chip {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface-raised);
  font-size: 10px;
  font-weight: 750;
}

.vent-status-chip.active {
  color: #9ed3f1;
  background: var(--blue-pale);
}

.vent-status-chip.external {
  color: #f0af79;
  background: var(--amber-pale);
}

.vent-enabled-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.vent-enabled-row strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.vent-manual-row {
  border-top: 0;
  background: #13201f;
}

.vent-door-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 20px 24px 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-subtle);
}

.vent-door-setting > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 720;
}

.vent-door-setting select {
  min-width: 0;
  max-width: 100%;
}

.vent-window-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 24px 24px;
}

.vent-window {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.vent-window legend {
  padding: 0 6px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vent-window-fields {
  display: grid;
  gap: 12px;
}

.vent-glyph {
  color: var(--blue);
  background: var(--blue-pale);
}

.dyson-section {
  margin-top: 48px;
}

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

.dyson-card.is-on {
  border-color: #4f7b72;
  box-shadow: 0 16px 42px rgba(61, 139, 126, 0.16);
}

.heater-card.dyson-card > .door-interlock-row {
  margin: 20px 24px 24px;
}

.dyson-status-row {
  min-height: 38px;
  padding-bottom: 12px;
}

.heater-card .dyson-door-state {
  margin-top: 0;
}

.dyson-glyph {
  color: var(--teal);
  background: var(--teal-pale);
}

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

.heater-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.heater-card.is-on {
  border-color: #805b3c;
  box-shadow: 0 16px 42px rgba(189, 107, 44, 0.16);
}

.heater-card.offline {
  opacity: 0.72;
}

.heater-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 12px;
}

.heater-card-header h3 {
  margin-bottom: 3px;
  font-size: 21px;
}

.heater-card-header small,
.heater-enabled-row small {
  display: block;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.4;
}

.heater-decision {
  min-height: 44px;
  margin: 0;
  padding: 0 24px 7px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.heater-active-window {
  margin: 0 24px 20px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.heater-door-state {
  margin: -10px 24px 18px;
  color: var(--red);
  font-size: 11px;
  font-weight: 750;
}

.heater-temperature-state {
  margin: -10px 24px 18px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 750;
}

.heater-temperature-state.active {
  color: var(--red);
}

.heater-boost-state {
  margin: -10px 24px 18px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
}

.heater-enabled-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.heater-enabled-row strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.heater-card > .door-interlock-row {
  margin: 20px 24px 0;
}

.temperature-interlock-editor {
  display: grid;
  gap: 14px;
  margin: 20px 24px 0;
  padding: 14px;
  border: 1px solid #805b3c;
  border-radius: 14px;
  background: var(--amber-pale);
}

.temperature-interlock-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.temperature-interlock-heading strong,
.temperature-interlock-heading small {
  display: block;
}

.temperature-interlock-heading strong {
  margin-bottom: 3px;
  font-size: 13px;
}

.temperature-interlock-heading small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.4;
}

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

.heater-period-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px 24px 24px;
}

.heater-period {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.heater-period legend {
  padding: 0 6px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.heater-period-fields {
  display: grid;
  gap: 12px;
}

.activity-section {
  margin-top: 70px;
}

.hue-intro h1 {
  max-width: 800px;
}

.hue-bridge-card {
  align-self: end;
}

.bridge-signal {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.bridge-signal strong,
.bridge-signal small {
  display: block;
}

.bridge-signal small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}

.bridge-glyph {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font: 800 14px/1 ui-monospace, monospace;
  box-shadow: 0 0 0 7px var(--teal-pale);
}

.hue-action-bar {
  position: static;
}

.tapo-glyph {
  background: #7665dc;
  box-shadow: 0 0 0 7px #292442;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 70px;
}

.metric-card {
  display: grid;
  min-height: 150px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.metric-card > span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.metric-card > strong {
  align-self: end;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
}

.metric-card > small {
  margin-top: 5px;
  color: var(--ink-soft);
}

.hue-section {
  margin-top: 66px;
}

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

.space-card {
  display: grid;
  gap: 20px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card);
}

.space-card > div {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.space-card h3 {
  margin: 0;
  font-size: 15px;
}

.space-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.space-card .space-brightness {
  align-self: end;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
}

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

.output-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.output-card.is-on {
  border-color: #7d663b;
  background: #231e16;
  box-shadow: 0 8px 25px rgba(189, 107, 44, 0.12);
}

.output-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.output-header h3 {
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output-meta {
  margin: 7px 0 15px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brightness-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-raised);
}

.brightness-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--amber);
}

.output-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 10px;
}

.tapo-device-card {
  display: flex;
  flex-direction: column;
  min-height: 240px;
}

.tapo-device-card.offline {
  opacity: 0.68;
}

.tapo-feature-list {
  display: grid;
  gap: 0;
  margin: 0 0 14px;
  border-top: 1px solid var(--line);
}

.tapo-feature {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 31px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.tapo-feature span {
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tapo-feature strong {
  flex-shrink: 0;
  font-size: 10px;
}

.tapo-device-card .output-footer {
  margin-top: auto;
}

.tapo-controls {
  display: flex;
  margin: 12px 0;
}

.tapo-controls .button {
  width: 100%;
  min-height: 37px;
  padding: 7px 10px;
}

.tapo-no-features {
  margin: 14px 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.5;
}

.tapo-empty-card {
  grid-column: 1 / -1;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(21, 31, 34, 0.55);
  text-align: center;
}

.tapo-empty-card h3 {
  margin: 0;
  font-size: 18px;
}

.tapo-empty-card p {
  max-width: 620px;
  margin: 8px auto 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.hue-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: 20px;
}

.section-heading.compact h2 {
  font-size: 37px;
}

.detail-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card);
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 54px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row strong {
  display: block;
  font-size: 13px;
}

.detail-row small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
}

.detail-row > span {
  flex-shrink: 0;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.activity-card {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ink-soft);
  background: var(--surface-subtle);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty {
  padding: 30px;
  color: var(--ink-soft);
  text-align: center;
}

dialog {
  width: min(480px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.55);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(3px);
}

dialog h2 {
  margin-bottom: 12px;
  font-size: 31px;
}

dialog p:not(.eyebrow) {
  color: var(--ink-soft);
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 9px;
  margin-top: 24px;
}

@media (max-width: 920px) {
  .intro,
  .room-grid,
  .heater-grid,
  .dyson-grid {
    grid-template-columns: 1fr;
  }

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

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

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

  .hue-detail-grid {
    grid-template-columns: 1fr;
  }

  .intro {
    align-items: stretch;
    padding-top: 28px;
  }

  .system-card {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  .system-card > div:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .vent-global-setting {
    grid-template-columns: 1fr;
  }

  .masthead {
    gap: 10px;
    padding-top: 18px;
  }

  .brand > span:last-child,
  .connection span:last-child {
    display: none;
  }

  .masthead-status {
    gap: 10px;
  }

  .outside-reading {
    min-width: 0;
    padding: 8px 10px;
  }

  .outside-glyph,
  .outside-label,
  .outside-updated,
  .outside-doors {
    display: none;
  }

  .outside-values {
    white-space: nowrap;
    font-size: 13px;
  }

  main {
    padding-top: 10px;
  }

  .tab-bar > div {
    display: flex;
    width: 100%;
    overflow-x: auto;
  }

  .tab-button {
    flex: 0 0 auto;
    padding-inline: 10px;
    font-size: 11px;
  }

  h1 {
    font-size: 50px;
  }

  .intro {
    padding-bottom: 40px;
  }

  .system-card {
    grid-template-columns: 1fr;
  }

  .system-card > div:first-child {
    grid-column: auto;
  }

  .action-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .action-bar > div,
  .action-bar .button {
    flex: 1;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .section-heading > p {
    text-align: left;
  }

  .room-summary {
    grid-template-columns: 1fr;
  }

  .state-stack {
    align-items: start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .room-editor-grid {
    grid-template-columns: 1fr;
  }

  .morning-ramp-grid {
    grid-template-columns: 1fr;
  }

  .vent-door-setting {
    align-items: stretch;
    flex-direction: column;
  }

  .vent-window-grid {
    grid-template-columns: 1fr;
  }

  .temperature-boost-row {
    align-items: stretch;
    flex-direction: column;
  }

  .temperature-boost-controls {
    justify-content: space-between;
  }

  .door-interlock-toggle {
    align-items: start;
  }

  .temperature-interlock-heading {
    align-items: start;
  }

  .temperature-interlock-fields {
    grid-template-columns: 1fr;
  }

  .door-condition {
    grid-template-columns: 1fr;
  }

  .heater-period-grid {
    grid-template-columns: 1fr;
  }

  .field-hint {
    grid-column: auto;
  }

  .manual-controls {
    flex-wrap: wrap;
  }

  .manual-controls .button {
    flex-basis: calc(50% - 8px);
  }

  .metric-grid,
  .space-grid,
  .output-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 125px;
  }
}
.eco-weather {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid #354849;
  border-radius: 16px;
  background: #142123;
}

.heater-plan .curve-chart { height: 150px; }
.heater-plan .curve-area { fill: rgba(64, 189, 182, 0.3); }
.heater-plan .curve-label { fill: #c9dedb; font-size: 12px; }
.history-command-legend { color: #a4b4bd; font-size: 0.8rem; line-height: 1.5; }
.eco-weather summary { cursor: pointer; }
#ecoSummary { margin-left: 1rem; color: #b8ccca; }
.eco-weather h2 { font-size: 1.15rem; }
.eco-table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.eco-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.eco-table th, .eco-table td { text-align: left; padding: .65rem; border-bottom: 1px solid #354849; white-space: nowrap; }
.eco-table caption { text-align: left; padding: .5rem; color: #b8ccca; }
#ecoReport { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 28rem; overflow-y: auto; font-size: .8rem; }
@media (max-width: 640px) {
  #ecoSummary { display: block; margin: .5rem 0 0; }
}

.temperature-history { margin-top: 2rem; }
.history-card { padding: 1.2rem; border: 1px solid #34464a; border-radius: 16px; background: #142024; min-width: 0; }
.history-card svg { width: 100%; height: auto; }
.history-card svg text { fill: #acbdc1; font-size: 12px; }
.history-gridline { stroke: #34464a; }
.history-line { fill: none; stroke: #78dbca; stroke-width: 2; pointer-events: none; }
.history-dot { fill: #78dbca; }
@media (max-width: 600px) {
  #climatePanel > .action-bar { position: static; }
  .history-card svg text { font-size: 21px; }
  .history-card svg .history-midtime { display: none; }
}

.shutdown-panel { display: flex; justify-content: space-between; gap: 24px; padding: 24px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.shutdown-panel h2 { margin: 0 0 12px; font: 650 26px/1.2 Inter, ui-sans-serif, system-ui, sans-serif; }
.shutdown-panel p, .shutdown-panel small { color: var(--ink-soft); }
.shutdown-panel.active { border-color: var(--amber); }
.shutdown-panel #shutdownStatus { color: var(--ink); font-weight: 600; }
.shutdown-controls { display: grid; gap: 10px; min-width: 220px; align-content: start; }
.shutdown-controls input { width: 100%; padding: 10px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 8px; }
.shutdown-controls #shutdownError { color: var(--red); max-width: 280px; }
@media (max-width: 640px) { .shutdown-panel { flex-direction: column; } .shutdown-controls { min-width: 0; } }
