:root {
  color-scheme: dark;
  font: 16px/1.5 system-ui, sans-serif;
  background: #10151c;
  color: #edf3fb;
  --muted: #a6b7ca;
}

* { box-sizing: border-box; }
main { max-width: 74rem; margin: auto; padding: clamp(1rem, 4vw, 3rem); }
header, .card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .7rem; }
header { flex-wrap: wrap; align-items: end; margin-bottom: 1.5rem; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.15; }
h2 { font-size: 1.3rem; }
.eyebrow { color: #9bc8ff; font-size: .7rem; font-weight: 750; letter-spacing: .13em; }
#refresh-status, dt, .detail { color: var(--muted); font-size: .85rem; }
.dashboard { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1rem; }
section {
  grid-column: span 2;
  border: 1px solid #354356;
  border-radius: 1rem;
  padding: 1.15rem;
  background: #1a2330;
}
.deye, .leaf { grid-column: span 3; }
.deye .eyebrow { color: #a4e8a6; }
.leaf .eyebrow { color: #89dddc; }
dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1.15rem; }
dl > div { grid-column: span 2; padding: .65rem; border-radius: .6rem; background: #131b25; }
.deye dl > div, .leaf dl > div { grid-column: span 1; }
dd { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.detail { font-weight: normal; }
.detail:empty { display: none; }
.badge {
  border: 1px solid #46566c;
  border-radius: 1rem;
  padding: .15rem .55rem;
  font-size: .75rem;
  text-align: center;
  color: #d0dced;
}
.badge.good { color: #b5f1be; background: #203d30; border-color: #4a7d5d; }
.badge.warn { color: #ffcf9f; background: #473025; border-color: #8c6344; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.login-page { max-width: 29rem; padding-top: clamp(2rem, 12vh, 7rem); }
.login-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 1.25rem;
  border: 1px solid #354356;
  border-radius: 1rem;
  background: #1a2330;
}
.login-form label { display: grid; gap: .3rem; }
.login-form .remember { display: flex; align-items: center; }
.login-form input:not([type="checkbox"]), button {
  font: inherit;
  color: inherit;
  border: 1px solid #526985;
  border-radius: .45rem;
  background: #131b25;
  padding: .4rem .7rem;
}
button { cursor: pointer; }
button:hover { background: #263b52; }
.login-message { color: #ffcf9f; }
.login-message:empty { display: none; }
.device-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.device-actions button { min-height: 2.65rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: #1c494a; border-color: #4e9293; }
button.danger { background: #542f35; border-color: #a15f67; }
button.primary:not(:disabled):hover { background: #286264; }
button.danger:not(:disabled):hover { background: #6b3a42; }
progress {
  display: block;
  width: 100%;
  height: .45rem;
  margin-top: .4rem;
  accent-color: #83ce92;
}
progress[hidden] { display: none; }
.deye [data-meter="load"] { accent-color: #8bbbf5; }
.deye [data-meter="grid"] { accent-color: #ecb07a; }
.deye [data-meter="battery"] { accent-color: #e0c477; }
.leaf progress { accent-color: #79d7cb; }
.charge-progress { margin: .7rem 0; padding: .55rem .65rem; background: #131b25; border-radius: .6rem; }
.command-status { margin-top: .55rem; font-size: .9rem; color: #b5f1be; }
.command-status.warn { color: #ffcf9f; }
.command-status:empty { display: none; }
dialog {
  width: min(34rem, calc(100% - 1.5rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  border: 1px solid #526985;
  border-radius: 1rem;
  padding: 1rem;
  background: #1a2330;
  color: inherit;
}
dialog::backdrop { background: #080e16ba; }
.control-form { display: grid; gap: .75rem; margin-top: 1rem; }
.control-form label { display: grid; align-content: start; gap: .25rem; }
.control-form .checkbox { display: flex; align-items: center; gap: .5rem; }
.control-form input:not([type="checkbox"]), .control-form select {
  min-width: 0;
  width: 100%;
  font: inherit;
  color: inherit;
  background: #131b25;
  border: 1px solid #526985;
  border-radius: .45rem;
  padding: .45rem .6rem;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.control-form h3 { margin: 0; }
.record-list { display: grid; gap: .5rem; margin: .7rem 0; padding: 0; list-style: none; }
.record-list li { padding: .65rem; background: #131b25; border-radius: .5rem; }
.record-list .device-actions { margin-top: .35rem; }

@media (max-width: 52rem) {
  section, .deye, .leaf { grid-column: span 3; }
  #watch { grid-column: span 6; }
}
@media (max-width: 38rem) {
  .dashboard { grid-template-columns: minmax(0, 1fr); }
  section, .deye, .leaf, #watch { grid-column: 1; }
}
