/* Clime design system: system typography, grouped surfaces, restrained
   colour. Mode tints double as the chart palette (validated for colour-vision
   deficiency in light and dark; see TESTING.md). */

:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f7f7fa;
  --elevated: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --separator: rgba(60, 60, 67, 0.16);
  --label: #0b0b0c;
  --label-2: rgba(60, 60, 67, 0.72);
  --label-3: rgba(60, 60, 67, 0.45);
  --accent: #007aff;
  --accent-ink: #ffffff;
  --danger: #d70015;
  --success: #248a3d;
  --warning: #b25000;
  --cool: #2a78d6;
  --heat: #eb6834;
  --auto: #1baf7a;
  --dry: #eda100;
  --fan: #6250d6;
  --off: #8e8e93;
  --tint: var(--off);
  --chart-surface: #fcfcfb;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 56px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --elevated: #2c2c2e;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.36);
    --separator: rgba(84, 84, 88, 0.6);
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.68);
    --label-3: rgba(235, 235, 245, 0.38);
    --accent: #0a84ff;
    --danger: #ff453a;
    --success: #30d158;
    --warning: #ff9f0a;
    --cool: #3987e5;
    --heat: #d95926;
    --auto: #199e70;
    --dry: #c98500;
    --fan: #9085e9;
    --chart-surface: #1c1c1e;
    --shadow: none;
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --elevated: #2c2c2e;
  --fill: rgba(120, 120, 128, 0.24);
  --fill-strong: rgba(120, 120, 128, 0.36);
  --separator: rgba(84, 84, 88, 0.6);
  --label: #ffffff;
  --label-2: rgba(235, 235, 245, 0.68);
  --label-3: rgba(235, 235, 245, 0.38);
  --accent: #0a84ff;
  --danger: #ff453a;
  --success: #30d158;
  --warning: #ff9f0a;
  --cool: #3987e5;
  --heat: #d95926;
  --auto: #199e70;
  --dry: #c98500;
  --fan: #9085e9;
  --chart-surface: #1c1c1e;
  --shadow: none;
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 17px/1.35 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.15em; }

/* ---------- layout ---------- */
.app { min-height: 100dvh; }
.main {
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
  max-width: 680px;
  margin: 0 auto;
}
.view { animation: fade 0.25s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(var(--safe-bottom) + 4px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 48px; padding: 4px 0; border: 0; background: none;
  color: var(--label-3); font-size: 10.5px; font-weight: 500; letter-spacing: 0;
}
.tab svg.icon { width: 25px; height: 25px; }
.tab[aria-current="page"] { color: var(--accent); }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .tabbar {
    position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 28px 12px; border-top: 0; border-right: 0.5px solid var(--separator); background: var(--surface-2);
  }
  :root:not([data-theme="light"]) .tabbar { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
  .tabbar .brand { display: flex; }
  .tab {
    flex: none; flex-direction: row; gap: 12px; justify-content: flex-start; min-height: 40px;
    padding: 8px 12px; border-radius: 10px; font-size: 15px; color: var(--label);
  }
  .tab svg.icon { width: 20px; height: 20px; color: var(--accent); }
  .tab[aria-current="page"] { background: var(--fill); color: var(--label); }
  .main { max-width: 1120px; padding: 40px 40px 60px; width: 100%; }
}
.brand { display: none; align-items: center; gap: 10px; padding: 0 12px 20px; font-weight: 600; font-size: 17px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }

/* ---------- typography ---------- */
.large-title { font: 700 34px/1.12 var(--font-display); letter-spacing: -0.025em; margin: 0; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 4px; }
.subtitle { color: var(--label-2); font-size: 15px; margin: 2px 0 18px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--label-2);
  margin: 28px 16px 8px; font-weight: 500; display: flex; justify-content: space-between; align-items: baseline;
}
.section-title a, .section-title button { text-transform: none; letter-spacing: 0; font-size: 15px; }
.footnote { font-size: 13px; color: var(--label-2); margin: 8px 16px 0; line-height: 1.4; }
.muted { color: var(--label-2); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; }
.list { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 16px;
  width: 100%; border: 0; background: none; text-align: left; position: relative;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--separator); }
.row.icon-row + .row::before, .row.icon-row + .row.icon-row::before { left: 56px; }
button.row:active, a.row:active { background: var(--fill); }
.row .grow { flex: 1; min-width: 0; }
.row .label { display: block; }
.row .detail { display: block; font-size: 14px; color: var(--label-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }
.row .value { color: var(--label-2); font-size: 16px; text-align: right; }
.row .chev { color: var(--label-3); }
.row-icon {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--accent); color: #fff;
}
.row-icon svg.icon { width: 18px; height: 18px; }
.row.destructive { color: var(--danger); justify-content: center; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 0;
  background: var(--fill); color: var(--label); font-weight: 600; font-size: 16px;
  transition: transform 0.12s var(--ease), background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.plain { background: none; color: var(--accent); padding: 8px 10px; min-height: 36px; font-weight: 500; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--fill); color: var(--label); position: relative;
}
.icon-btn svg.icon { width: 22px; height: 22px; }
.icon-btn .badge {
  position: absolute; top: 6px; right: 6px; min-width: 9px; height: 9px; border-radius: 5px; background: var(--danger);
}

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px;
  background: var(--fill); border-radius: 10px;
}
.segmented button {
  min-height: 36px; border: 0; border-radius: 8px; background: none; color: var(--label);
  font-size: 14px; font-weight: 500; padding: 4px 6px; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.2s var(--ease);
}
.segmented button[aria-pressed="true"] { background: var(--elevated); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 600; }
:root[data-theme="dark"] .segmented button[aria-pressed="true"] { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented button[aria-pressed="true"] { background: #636366; } }
.segmented.big button { min-height: 64px; flex-direction: column; gap: 4px; font-size: 12px; }
.segmented.big button svg.icon { width: 24px; height: 24px; }
.segmented button .pending-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }

.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { appearance: none; -webkit-appearance: none; margin: 0; width: 51px; height: 31px; border-radius: 16px; background: var(--fill-strong); transition: background 0.2s; cursor: pointer; }
.switch input:checked { background: var(--success); }
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.1); transition: transform 0.25s var(--ease);
}
.switch input:checked::after { transform: translateX(20px); }
.switch input:disabled { opacity: 0.5; }

.field { display: block; padding: 10px 16px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--separator); }
.field > span { display: block; font-size: 13px; color: var(--label-2); margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 0;
  background: var(--fill); outline: none; appearance: none; -webkit-appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--label-2) 50%), linear-gradient(135deg, var(--label-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
input[type="time"].input { font-variant-numeric: tabular-nums; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper output { min-width: 64px; text-align: center; font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stepper button { width: 44px; height: 36px; border-radius: 9px; border: 0; background: var(--fill); display: grid; place-items: center; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 4px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 14px; border-radius: 20px; border: 0;
  background: var(--surface); color: var(--label); font-size: 15px; font-weight: 500; box-shadow: var(--shadow);
}
.chip svg.icon { color: var(--label-2); }
.chip[aria-pressed="true"] { background: var(--label); color: var(--bg); }
.chip[aria-pressed="true"] svg.icon { color: var(--bg); }
.chip.ghost { background: var(--fill); box-shadow: none; }
.day-pills { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-pill {
  min-height: 40px; border-radius: 12px; border: 0; background: var(--fill); font-weight: 600; font-size: 14px; position: relative;
}
.day-pill[aria-pressed="true"] { background: var(--accent); color: #fff; }
.day-pill.off { color: var(--label-3); text-decoration: line-through; }
.day-pill .today-dot { position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 2px; background: currentColor; }

/* ---------- home ---------- */
.banner {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin-bottom: 14px;
  border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); font-size: 15px;
}
.banner svg.icon { margin-top: 2px; }
.banner.demo { background: color-mix(in srgb, var(--fan) 14%, var(--surface)); }
.banner.warn { background: color-mix(in srgb, var(--warning) 14%, var(--surface)); }
.banner.danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.banner .grow { flex: 1; }
.banner strong { display: block; }

.conn { display: inline-flex; align-items: center; gap: 6px; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.conn.online .dot { background: var(--success); }
.conn.degraded .dot { background: var(--warning); }
.conn.offline .dot, .conn.unconfigured .dot { background: var(--danger); }

.home-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.home-grid > * { min-width: 0; }
@media (min-width: 1080px) { .home-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 24px; } .home-grid .span { grid-column: 1 / -1; } }
@media (min-width: 900px) and (max-width: 1079px) { .main { max-width: 720px; } }

.hero { padding: 18px 16px 18px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.09;
  background: radial-gradient(120% 70% at 50% 0%, var(--tint), transparent 70%); transition: background 0.6s;
}
.dial { position: relative; width: min(290px, 78vw); aspect-ratio: 1; margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.dial > svg { width: 100%; height: 100%; display: block; overflow: visible; }
.dial .track { stroke: var(--fill-strong); }
.dial .progress { stroke: var(--tint); transition: stroke 0.4s; }
.dial .knob { fill: #fff; stroke: var(--tint); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25)); cursor: grab; }
.dial .room-tick { stroke: var(--label); stroke-width: 3; stroke-linecap: round; opacity: 0.55; }
.dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.dial-kicker { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tint); }
.dial-value { font: 200 clamp(68px, 21vw, 92px)/1 var(--font-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.dial-value sup { font-size: 0.42em; font-weight: 300; vertical-align: 0.95em; margin-left: 2px; letter-spacing: 0; }
.dial-value.off { color: var(--label-3); }
.dial-sub { font-size: 15px; color: var(--label-2); display: flex; gap: 12px; }
.dial-sub span { display: inline-flex; align-items: center; gap: 4px; }
.dial-controls { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 4px; }
.round {
  width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--fill); display: grid; place-items: center;
  transition: transform 0.12s var(--ease);
}
.round:active { transform: scale(0.93); }
.round svg.icon { width: 26px; height: 26px; }
.power {
  width: 76px; height: 76px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--fill); color: var(--label-2); transition: background 0.3s, color 0.3s, transform 0.12s var(--ease);
}
.power svg.icon { width: 32px; height: 32px; }
.power[aria-pressed="true"] { background: var(--tint); color: #fff; box-shadow: 0 6px 20px color-mix(in srgb, var(--tint) 40%, transparent); }
.power:active { transform: scale(0.94); }
.command-status { min-height: 22px; margin-top: 12px; font-size: 14px; color: var(--label-2); display: flex; align-items: center; justify-content: center; gap: 6px; }
.command-status.error { color: var(--danger); }
.command-status.ok { color: var(--success); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--fill-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.3; } }
.control-card { padding: 14px 16px; }
.control-card + .control-card { margin-top: 14px; }
.control-label { font-size: 13px; color: var(--label-2); margin: 0 0 8px 2px; display: flex; justify-content: space-between; }
.quick-temps { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.status-list .row { min-height: 52px; }
.mode-cool { --tint: var(--cool); } .mode-heat { --tint: var(--heat); } .mode-auto { --tint: var(--auto); }
.mode-dry { --tint: var(--dry); } .mode-fan { --tint: var(--fan); } .mode-off { --tint: var(--off); } .mode-none { --tint: var(--accent); }

/* ---------- schedule ---------- */
.week { padding: 14px 16px 10px; }
.week-row { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 10px; min-height: 30px; border: 0; background: none; width: 100%; padding: 3px 0; }
.week-row .d { font-size: 13px; font-weight: 600; color: var(--label-2); text-align: left; }
.week-row[aria-pressed="true"] .d { color: var(--accent); }
.week-bar { position: relative; height: 16px; border-radius: 5px; background: var(--fill); overflow: hidden; }
.week-bar .seg { position: absolute; top: 0; bottom: 0; border-right: 2px solid var(--surface); }
.week-bar .seg.off { background: transparent; }
.week-bar .now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--label); border-radius: 1px; }
.week-axis { display: grid; grid-template-columns: 34px 1fr; gap: 10px; font-size: 11px; color: var(--label-3); margin-top: 4px; }
.week-axis div { display: flex; justify-content: space-between; }
.week-row.disabled .week-bar { opacity: 0.35; }
.timeline .row { align-items: center; }
.event-time { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; min-width: 62px; }
.event-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tint); flex: none; }
.row.disabled .event-time, .row.disabled .label { color: var(--label-3); }
.empty { text-align: center; padding: 34px 20px; color: var(--label-2); }
.empty svg.icon { width: 40px; height: 40px; color: var(--label-3); margin-bottom: 8px; }
.empty h3 { margin: 0 0 4px; color: var(--label); font-size: 17px; }
.profile-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--fill); border-radius: 18px; padding: 6px 12px; font-weight: 600; font-size: 15px; }

/* ---------- sheets, toasts, menus ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.32); z-index: 40; animation: fadein 0.2s; }
@keyframes fadein { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: calc(100dvh - var(--safe-top) - 24px);
  background: var(--bg); border-radius: 14px 14px 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: up 0.32s var(--ease);
}
@keyframes up { from { transform: translateY(100%); } }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; transform: translate(-50%, -50%); border-radius: 16px; max-height: min(86dvh, 860px); animation: pop 0.24s var(--ease); }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } }
}
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 12px 8px 8px; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.sheet-head .left { justify-self: start; } .sheet-head .right { justify-self: end; }
.sheet-grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: 6px auto 0; }
@media (min-width: 700px) { .sheet-grabber { display: none; } }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(var(--safe-bottom) + 24px); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-body .list + .section-title { margin-top: 22px; }
.toast-host { position: fixed; z-index: 60; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (min-width: 900px) { .toast-host { bottom: 24px; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px;
  padding: 12px 16px; border-radius: 14px; background: color-mix(in srgb, var(--label) 88%, transparent); color: var(--bg);
  font-size: 15px; box-shadow: var(--shadow-lg); animation: toast 0.3s var(--ease);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.toast button { border: 0; background: none; color: var(--accent); font-weight: 600; filter: brightness(1.3); }
.toast.error { background: var(--danger); color: #fff; }
.toast.error button { color: #fff; }
@keyframes toast { from { opacity: 0; transform: translateY(10px); } }
.menu { position: fixed; z-index: 50; min-width: 220px; background: var(--elevated); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: fadein 0.15s; }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; min-height: 44px; padding: 10px 16px; border: 0; background: none; text-align: left; font-size: 16px; }
.menu button + button { border-top: 0.5px solid var(--separator); }
.menu button:active { background: var(--fill); }
.menu button.danger { color: var(--danger); }

/* ---------- insights ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 14px 16px; }
.stat .k { font-size: 13px; color: var(--label-2); }
.stat .v { font: 600 28px/1.15 var(--font-display); letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 15px; font-weight: 500; color: var(--label-2); margin-left: 2px; }
.stat .n { font-size: 12px; color: var(--label-3); margin-top: 2px; }
.chart-card { padding: 14px 8px 10px 14px; }
.chart-card h3 { margin: 0 6px 2px 2px; font-size: 17px; display: flex; justify-content: space-between; align-items: baseline; }
.chart-card .sub { font-size: 13px; color: var(--label-2); margin: 0 6px 8px 2px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--separator); stroke-width: 1; }
.chart .axis-label { fill: var(--label-3); font-size: 11px; font-family: var(--font); }
.chart .s-room { stroke: var(--cool); } .chart .s-set { stroke: var(--heat); } .chart .s-out { stroke: var(--auto); }
.chart .on-band { fill: var(--fill); }
.chart .hit { fill: transparent; }
.chart .cross { stroke: var(--label-2); stroke-width: 1; }
.chart .bar { fill: var(--cool); }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 140px; padding: 8px 10px; border-radius: 10px;
  background: var(--elevated); box-shadow: var(--shadow-lg); font-size: 13px; line-height: 1.5;
}
.tooltip .t { color: var(--label-2); margin-bottom: 2px; }
.tooltip .r { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tooltip .r span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--label-2); margin: 8px 6px 2px 2px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 3px; border-radius: 2px; background: currentColor; display: inline-block; }
.swatch.box { height: 10px; width: 10px; border-radius: 3px; }
.stack { display: flex; height: 14px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--fill); }
.stack div { height: 100%; }
.history .row { align-items: flex-start; }
.history time { font-size: 13px; color: var(--label-2); white-space: nowrap; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--fill); color: var(--label-2); }
.pill.success { color: var(--success); } .pill.failed { color: var(--danger); } .pill.retrying, .pill.unconfirmed { color: var(--warning); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 0.5px solid var(--separator); font-variant-numeric: tabular-nums; }
.table th { color: var(--label-2); font-weight: 500; }

/* ---------- login & onboarding ---------- */
.center-screen { min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 24px); }
.login { width: 100%; max-width: 380px; text-align: center; }
.login img { width: 76px; height: 76px; border-radius: 18px; box-shadow: var(--shadow-lg); }
.login h1 { font: 700 30px/1.15 var(--font-display); margin: 18px 0 6px; letter-spacing: -0.02em; }
.login p { color: var(--label-2); margin: 0 0 24px; }
.login form .list { text-align: left; margin-bottom: 16px; }
.login .input { background: transparent; padding-left: 0; }
.error-text { color: var(--danger); font-size: 14px; min-height: 20px; margin: 4px 0 10px; }
.steps .row .ok { color: var(--success); } .steps .row .bad { color: var(--danger); }
.onboard { width: 100%; max-width: 520px; }
.onboard h1 { font: 700 30px/1.15 var(--font-display); letter-spacing: -0.02em; margin: 8px 0 8px; }
.onboard p { color: var(--label-2); }
.progress-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.progress-dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--fill-strong); }
.progress-dots i.on { background: var(--accent); width: 20px; }

/* ---------- skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--fill) 25%, var(--fill-strong) 37%, var(--fill) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 12px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .power[aria-pressed="true"], .segmented button[aria-pressed="true"], .chip[aria-pressed="true"] { outline: 2px solid CanvasText; }
}
