:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #1c3438;
  background: #f1f5f4;
  font-synthesis: none;
  --card: #fff;
  --text: #1c3438;
  --muted: #586d70;
  --line: #dce5e3;
  --accent: #13766e;
  --soft: #edf6f3;
  --input: #fff;
  --danger: #a3332a;
  --shadow: 0 3px 14px #123b3005;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input {
  font: inherit;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 650;
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #cc9b32;
  outline-offset: 3px;
}
header {
  max-width: 1184px;
  padding: 20px 32px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
}
.brand-small {
  display: block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  margin-top: 2px;
}
main {
  max-width: 1184px;
  margin: 0 auto;
  padding: 0 32px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 36px;
  letter-spacing: -1.3px;
  line-height: 1.17;
  font-weight: 650;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.4px;
  font-weight: 650;
}
h3 {
  font-size: 16px;
  font-weight: 650;
}
.page-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.page-title .muted {
  margin-top: 8px;
}
.eyebrow {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 9px;
}
.location {
  font-size: 12px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 99px;
  color: var(--muted);
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.left-column {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-heading .eyebrow {
  margin: 0;
}
.card-heading > .muted {
  font-size: 12px;
}
.state-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 10px;
}
.state-line h2 {
  font-size: 32px;
  letter-spacing: -0.8px;
}
.state-dot {
  width: 13px;
  height: 13px;
  background: #849797;
  border-radius: 50%;
  box-shadow: 0 0 0 6px #84979716;
  flex-shrink: 0;
}
.state-dot.on,
.state-dot.probably_on {
  background: #13766e;
  box-shadow: 0 0 0 6px #13766e15;
}
.state-dot.probably_off {
  background: #b5822e;
  box-shadow: 0 0 0 6px #b5822e15;
}
.reason {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  min-height: 32px;
}
.readings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 24px 0;
}
.reading-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.readings strong {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.7px;
}
.readings small {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.readings .time {
  font-size: 23px;
  display: block;
  padding-top: 6px;
  letter-spacing: -0.5px;
}
.status-foot {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 12px;
  color: var(--muted);
}
.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.control-card {
  padding: 22px;
}
.control-card > .muted {
  margin: 9px 0 16px;
}
.schedule-card > .muted {
  margin: 9px 0 20px;
}
.button-pair {
  display: flex;
  gap: 12px;
}
.button-pair button {
  flex: 1;
}
.primary {
  background: var(--accent);
  color: #fff;
}
.primary:hover {
  filter: brightness(0.92);
}
.secondary {
  background: var(--soft);
  color: var(--accent);
  border: 1px solid var(--line);
}
.quiet {
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 10px 12px;
}
.progress {
  margin-top: 14px;
  border-radius: 12px;
  padding: 13px 14px;
  background: var(--soft);
  color: var(--accent);
  font-size: 13px;
  line-height: 1.6;
}
.progress.attention {
  background: #fff1d8;
  color: #7e5315;
}
.progress.verifying,
.progress.waiting,
.progress.observing {
  border-left: 3px solid var(--accent);
}
.hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 12px;
}
.badge {
  border-radius: 99px;
  background: var(--soft);
  padding: 6px 11px;
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
}
.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  padding: 14px 0 22px;
  border-bottom: 1px solid var(--line);
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 22px;
  height: 22px;
  cursor: pointer;
}
input[role="switch"] {
  appearance: none;
  width: 44px;
  height: 26px;
  border-radius: 99px;
  background: #a6b7b3;
  position: relative;
  margin: 0;
}
input[role="switch"]:checked {
  background: var(--accent);
}
input[role="switch"]:before {
  content: "";
  display: block;
  background: white;
  border-radius: 50%;
  height: 20px;
  width: 20px;
  position: absolute;
  top: 3px;
  left: 3px;
}
input[role="switch"]:checked:before {
  left: 21px;
}
.week-heading,
.day-row {
  display: grid;
  grid-template-columns: minmax(84px, 1fr) minmax(86px, 1fr) minmax(86px, 1fr);
  gap: 10px;
  align-items: center;
}
.week-heading {
  font-size: 11px;
  color: var(--muted);
  padding: 22px 0 8px;
}
.day-row {
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}
.day-name {
  font-size: 13px;
  font-weight: 600;
}
.day-off {
  display: flex;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
  gap: 4px;
  min-height: 44px;
  cursor: pointer;
  white-space: nowrap;
}
.day-off input {
  width: 15px;
  height: 15px;
  margin: 0;
}
.day-row input[type="time"] {
  width: 100%;
  min-width: 0;
  padding: 8px 5px;
  font-size: 13px;
  min-height: 48px;
  letter-spacing: -0.3px;
}
input[type="time"],
input[type="date"],
input[type="password"] {
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  min-height: 48px;
  padding: 10px;
  width: 100%;
  color-scheme: light;
}
.day-row input:disabled {
  opacity: 0.35;
}
.holiday {
  margin-top: 23px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.holiday h3 {
  margin-bottom: 18px;
}
label[for] {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}
.date-row {
  display: flex;
  gap: 5px;
}
.date-row input {
  min-width: 0;
}
.holiday .hint {
  margin-top: 7px;
}
.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  margin: 15px 0 24px;
  min-height: 48px;
  cursor: pointer;
}
.check-row input {
  margin: 0;
  flex-shrink: 0;
}
.full {
  width: 100%;
}
.saved {
  font-size: 12px;
  line-height: 1.5;
  color: var(--accent);
  margin-top: 10px;
}
.error {
  color: var(--danger);
  font-size: 13px;
  line-height: 1.6;
  margin: 10px 0;
}
.notice {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 20px;
}
.activity {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}
.activity li {
  border-top: 1px solid var(--line);
  padding: 14px 0;
  font-size: 13px;
  line-height: 1.6;
}
.activity time {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}
.activity li:last-child {
  padding-bottom: 0;
}
.activity-card {
  padding-bottom: 24px;
}
footer {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  text-align: center;
  padding: 32px 0 40px;
}
.login {
  max-width: 440px;
  margin: 60px auto;
}
.login h1 {
  font-size: 32px;
}
.login > p:not(.eyebrow) {
  margin: 18px 0;
  line-height: 1.65;
  font-size: 14px;
  color: var(--muted);
}
.login form {
  margin-top: 26px;
}
.login button {
  width: 100%;
  margin-top: 14px;
}
dialog {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 20px;
  padding: 28px;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 24px 80px #0004;
}
dialog::backdrop {
  background: #102c3377;
}
dialog p:not(.eyebrow) {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin: 16px 0 24px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1000px) {
  header {
    padding: 14px 20px;
  }
  main {
    padding: 0 20px;
    margin-top: 8px;
  }
  .page-title {
    margin-bottom: 18px;
  }
  .page-title h1 {
    font-size: 29px;
  }
  .location {
    font-size: 10px;
    padding: 7px 9px;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .card {
    padding: 22px;
    border-radius: 18px;
  }
  .left-column {
    display: contents;
  }
  .status-card {
    order: 0;
  }
  .control-card {
    order: 1;
  }
  .schedule-card {
    order: 2;
  }
  .activity-card {
    order: 3;
  }
  .state-line {
    margin-top: 23px;
  }
  .reason {
    min-height: 0;
  }
  .readings {
    padding: 22px 0;
  }
  .week-heading,
  .day-row {
    grid-template-columns: minmax(76px, 1fr) minmax(81px, 1fr) minmax(81px, 1fr);
    gap: 7px;
  }
  .day-row input[type="time"] {
    font-size: 12px;
    padding: 7px 2px;
  }
  .login {
    margin-top: 24px;
  }
  .login h1 {
    font-size: 30px;
  }
  .page-title .muted {
    font-size: 12px;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --card: #152b2e;
    --text: #e0ebe8;
    --muted: #a5b9b6;
    --line: #30474a;
    --accent: #79d0b9;
    --soft: #203e3d;
    --input: #1b3436;
    background: #0e2023;
    color: var(--text);
    --danger: #ffada1;
  }
  .primary {
    background: #79d0b9;
    color: #102b27;
  }
  input[type="time"],
  input[type="date"],
  input[type="password"] {
    color-scheme: dark;
  }
  .progress.attention {
    background: #493a21;
    color: #f0ce93;
  }
  .state-dot.on,
  .state-dot.probably_on {
    background: #79d0b9;
  }
  .brand img {
    border-radius: 10px;
  }
  .secondary {
    color: #bce9db;
  }
}

.devices {
  list-style: none;
  margin: 16px 0;
  padding: 0;
}
.devices li {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.devices strong {
  font-size: 14px;
}
.devices small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  margin-top: 4px;
}
.devices-card > .secondary {
  margin-top: 18px;
}
.login input[type="text"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: var(--input);
  color: var(--text);
  margin-bottom: 16px;
}
.login #setup-code {
  margin-bottom: 4px;
}
.login > .primary {
  margin-top: 12px;
}
.login > .secondary {
  margin-top: 8px;
}
.devices-card {
  order: 4;
}

.brand { min-height: 44px; }
.inference { margin-top: 8px; font-size: 12px; color: var(--muted); }
.inference summary { cursor: pointer; padding: 12px 0; min-height: 44px; }
.schedule-summary { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--soft); font-size: 14px; line-height: 1.6; }
.readings { padding: 16px 0 0; }
.readings strong, .readings .time { font-size: 19px; padding: 0; letter-spacing: 0; }
.holiday { margin-top: 18px; padding-top: 0; border: 0; }
.holiday h3 { margin-bottom: 14px; }
.check-row { margin-bottom: 0; }
.save-bar { margin-top: 16px; padding: 12px 0; background: var(--card); }
[aria-invalid="true"] { border: 2px solid var(--danger) !important; }
@media (max-width: 1000px) {
  main { max-width: 620px; }
  .editing .save-bar { position: sticky; bottom: 0; z-index: 2; border-top: 1px solid var(--line); }
  .schedule-card { padding-bottom: 0; }
  input { scroll-margin-block: 120px; }
}
@media (max-width: 440px) {
  header { padding-inline: 12px; }
  main { padding-inline: 12px; }
  .card { padding-inline: 16px; }
  .week-heading, .day-row { grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .day-row input[type="time"] { font-size: 13px; padding: 7px 3px; }
}
@media (max-width: 374px) {
  .week-heading { display: none; }
  .day-row { grid-template-columns: 1fr 1fr; }
  .day-name { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
}

.day-time { display: block; min-width: 0; margin: 0; }
.day-time span { display: none; }
@media (max-width: 374px) {
  .day-time span { display: block; font-size: 13px; margin-bottom: 4px; }
}
