:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #15202b;
  --muted: #637083;
  --line: #d9dee7;
  --accent: #146c5f;
  --accent-strong: #0e5148;
  --danger: #a4362a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  margin-bottom: 18px;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  margin-top: 6px;
}

.shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 24px clamp(18px, 5vw, 56px) 48px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  background: #ffffff;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

button.secondary:hover {
  background: #edf3f1;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(100%, 420px);
}

.auth-panel h1 {
  margin-bottom: 8px;
}

.auth-form {
  display: grid;
  gap: 4px;
  margin-top: 24px;
}

.inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.output {
  min-height: 46px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 6px;
  background: #111827;
  color: #e9eef6;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.output:empty {
  display: none;
}

.tall {
  min-height: 260px;
}

.device-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.device {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 8px;
  cursor: pointer;
}

.device.online {
  border-color: #6fb9a8;
}

.device.offline {
  opacity: 0.72;
}

.device-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.device strong {
  font-size: 15px;
}

.device code {
  overflow-wrap: anywhere;
  color: var(--muted);
}

.device-delete {
  justify-self: start;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid #e5bbb6;
  color: var(--danger);
  background: #fff7f6;
  font-size: 13px;
}

.device-delete:hover {
  background: #fbe8e5;
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  background: #edf3f1;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
}

.offline .badge {
  background: #f2f3f5;
  color: var(--muted);
}

.error {
  color: var(--danger);
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .inline {
    grid-template-columns: 1fr;
  }
}
