:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --ink: #171a1f;
  --muted: #64707d;
  --line: #dce1e6;
  --surface: #ffffff;
  --canvas: #f3f5f7;
  --brand: #1261a0;
  --brand-hover: #0d4f83;
  --online: #19733f;
  --online-bg: #e8f6ed;
  --offline: #69727c;
  --offline-bg: #edf0f2;
  --danger: #a62b2b;
  --danger-hover: #852222;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
.button-link {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 18px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: var(--brand-hover);
}

.danger {
  background: var(--danger);
  color: #fff;
}

.danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.secondary {
  border-color: #c7ced5;
  background: #fff;
  color: #29313a;
}

.secondary:hover:not(:disabled) {
  background: #f1f3f5;
}

.topbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 0 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 720;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}

.brand-mark.small {
  width: 30px;
  height: 30px;
  font-size: 14px;
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.text-button:hover {
  color: var(--ink);
}

.dashboard {
  width: min(760px, calc(100% - 32px));
  margin: 72px auto;
}

.device-panel,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(24 33 43 / 6%);
}

.device-panel {
  padding: 34px;
}

.device-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.status {
  display: flex;
  min-width: 102px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 700;
}

.status span,
.agent-state span {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.status.online {
  background: var(--online-bg);
  color: var(--online);
}

.status.offline {
  background: var(--offline-bg);
  color: var(--offline);
}

.device-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 30px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.device-meta div {
  min-width: 0;
  padding: 20px 18px;
  border-right: 1px solid var(--line);
}

.device-meta div:first-child {
  padding-left: 0;
}

.device-meta div:last-child {
  border-right: 0;
}

.device-meta dt {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.device-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}

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

.actions form {
  margin: 0;
}

.agent-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
}

.agent-state.ready {
  color: var(--online);
}

.installer-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 650;
}

.alert {
  margin: 0 0 18px;
  border: 1px solid;
  border-radius: 6px;
  padding: 11px 13px;
  font-size: 14px;
}

.alert.error {
  border-color: #e8b5b5;
  background: #fff1f1;
  color: #862525;
}

.alert.success {
  border-color: #acd8bb;
  background: #eef9f2;
  color: #176339;
}

.hidden {
  display: none;
}

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

.login-panel {
  width: min(390px, 100%);
  padding: 36px;
}

.login-panel .brand-mark {
  margin-bottom: 22px;
}

.login-panel h1 {
  font-size: 26px;
}

.muted {
  margin: 8px 0 28px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #3b4651;
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bcc5ce;
  border-radius: 6px;
  padding: 8px 11px;
  color: var(--ink);
  outline: none;
}

.login-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(18 97 160 / 13%);
}

.button-link {
  display: inline-grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 16px;
  }

  .dashboard {
    margin: 28px auto;
  }

  .device-panel {
    padding: 22px;
  }

  .device-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .status {
    align-self: flex-start;
  }

  .device-meta {
    grid-template-columns: 1fr;
  }

  .device-meta div,
  .device-meta div:first-child {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 15px 0;
  }

  .device-meta div:last-child {
    border-bottom: 0;
  }

  .actions,
  .actions form,
  .actions button {
    width: 100%;
  }
}
