:root {
  color-scheme: dark;
  --bg: #101317;
  --surface: #171b20;
  --line: #30363d;
  --text: #eef2f5;
  --muted: #9da7b2;
  --green: #45bd70;
  --red: #d65353;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Noto Sans CJK SC", sans-serif;
}
body.center {
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px
    max(20px, env(safe-area-inset-bottom));
}
button, input { font: inherit; }
button {
  min-height: 44px;
  padding: 7px 14px;
  color: var(--text);
  background: #1e242b;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.login {
  width: min(340px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
}
h1 { margin: 0 0 6px; font-size: 24px; }
label { display: grid; gap: 6px; color: var(--muted); }
input {
  min-height: 44px;
  padding: 8px 10px;
  color: var(--text);
  background: #101317;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.error { margin: 0; color: var(--red); }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right)) 16px
    max(20px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
main {
  padding: 20px max(20px, env(safe-area-inset-right)) 20px
    max(20px, env(safe-area-inset-left));
  max-width: 860px;
  margin: 0 auto;
}
#devices { display: grid; gap: 10px; }
.device {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 4px;
}
.device.online { border-left-color: var(--green); }
.device.offline { border-left-color: var(--red); }
.state { color: var(--muted); }

@media (max-width: 600px) {
  .login {
    width: 100%;
    padding: 20px;
  }
  header {
    gap: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 12px;
  }
  h1 { font-size: 22px; }
  main { padding-top: 14px; }
  .device {
    min-height: 58px;
    padding: 14px 16px;
  }
}
