:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #16201b;
  --muted: #5b6b62;
  --accent: #1f6f4a;
  --accent-fg: #ffffff;
  --line: #d7e0db;
  --error: #a3261f;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1512;
    --fg: #e6efe9;
    --muted: #9db0a5;
    --accent: #4cc38a;
    --accent-fg: #06150d;
    --line: #26332c;
    --error: #ff8a80;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  min-height: 100%;
}

.screen {
  max-width: 34rem;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.25rem max(1.5rem, env(safe-area-inset-bottom));
}

h1 { font-size: 1.6rem; margin: 0.5rem 0 1rem; }
h1:focus { outline: none; }
.lede { font-size: 1.1rem; }
.note { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.85rem; margin-top: 2rem; }
.error { color: var(--error); }

.actions { display: flex; flex-direction: column; gap: 0.75rem; margin: 1.5rem 0; }

button, textarea {
  font: inherit;
  color: inherit;
}

button {
  min-height: 44px;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.quiet { border-color: transparent; color: var(--muted); }
button:disabled { opacity: 0.6; cursor: default; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

label { display: block; margin-top: 1rem; font-weight: 600; }
textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.devices { list-style: none; margin: 0; padding: 0; }
.device { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.device a {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.9rem 0;
  color: inherit;
  text-decoration: none;
  min-height: 44px;
}
.device .name { font-weight: 600; }
.device .detail { color: var(--muted); font-size: 0.9rem; }
.device.retired .name { text-decoration: line-through; }

.scanner { width: 100%; border-radius: 10px; margin-top: 1rem; }

/* Device view: a bar outside the frame, then the frame filling the rest. */
#app.framed .screen {
  max-width: none;
  padding: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
.device-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: max(0.4rem, env(safe-area-inset-top)) 0.75rem 0.4rem;
  border-bottom: 1px solid var(--line);
}
.device-bar h1 { font-size: 1rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-bar .status { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
#app.framed .note { margin: 0; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.device-frame { flex: 1; width: 100%; border: 0; background: var(--bg); }
