:root {
  color-scheme: light;
  --background: #f3f6f9;
  --surface: #ffffff;
  --ink: #17202b;
  --muted: #5b6878;
  --line: #dbe2ea;
  --primary: #3157d5;
  --primary-dark: #2443ab;
  --danger: #a82b38;
  --success: #176e4b;
  --warning: #835c10;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--ink);
  line-height: 1.55;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.site-header {
  min-height: 68px;
  padding: 12px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #101b31;
  color: #fff;
}

.brand {
  color: inherit;
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -.02em;
  text-decoration: none;
}
.brand span { color: #aebee9; font-weight: 500; }
.account-area { display: flex; align-items: center; gap: 14px; }
.account-area > span { color: #dbe4f6; font-size: .9rem; }

.page-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 34px auto 48px;
}
.page-shell.narrow { width: min(720px, calc(100% - 32px)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgb(20 39 68 / 5%);
  margin-bottom: 22px;
  padding: clamp(20px, 3vw, 30px);
}

.login-card { max-width: 700px; margin: 8vh auto 0; }
.login-card h1 { max-width: 580px; font-size: clamp(2rem, 5vw, 3rem); }
.login-card p:not(.eyebrow) { max-width: 580px; color: var(--muted); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -.025em; }
h1 { margin: 4px 0 20px; font-size: clamp(1.65rem, 3vw, 2.15rem); }
h2 { margin: 4px 0 22px; font-size: 1.4rem; }
h3 { margin: 0 0 5px; font-size: 1.05rem; }
.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: .73rem;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hint { margin: 18px 0 0; color: var(--muted); font-size: .85rem; }

.button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color .15s, border-color .15s;
}
.button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgb(49 87 213 / 28%);
  outline-offset: 2px;
}
.button:disabled { cursor: wait; opacity: .58; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: #fff; border-color: #bfcbd9; color: #27364a; }
.button.secondary:hover { background: #edf2f8; }
.button.danger { background: #fff; border-color: #e0b9be; color: var(--danger); }
.button.danger:hover { background: #fff2f3; }
.button.small { min-height: 34px; padding: 6px 11px; font-size: .83rem; }
.site-header .button.secondary { background: transparent; border-color: #62708b; color: #fff; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h1, .section-heading h2 { margin-bottom: 18px; }
.server-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; }
dl div { min-width: 0; }
dt { color: var(--muted); font-size: .77rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
dd { margin: 3px 0 0; overflow-wrap: anywhere; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; }
.breakable { word-break: break-all; }
.public-details { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.public-details summary { cursor: pointer; color: var(--primary-dark); font-weight: 650; }
.public-details dl { display: grid; gap: 14px; margin-top: 18px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.device-form { display: grid; gap: 10px; }
.device-form .button { margin-top: 10px; }
label { display: block; margin: 8px 0 6px; font-size: .88rem; font-weight: 650; }
input, select {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid #b9c5d3;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}
input[readonly] { background: #f7f9fb; color: #3d4b5e; }

.enrollment-card { text-align: center; }
.enrollment-card label { text-align: left; }
.qr-image { display: block; width: min(256px, 100%); height: auto; margin: 0 auto 20px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; }
.enrollment-card > .button { width: 100%; margin-top: 12px; }

.device-list { display: grid; gap: 10px; }
.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.device-item p { margin: 0 0 8px; color: var(--muted); font-size: .84rem; }
.status {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.status.pending { background: #fff3d6; color: var(--warning); }
.status.imported { background: #dcf3e9; color: var(--success); }
.empty-state { padding: 26px 12px; color: var(--muted); text-align: center; }

.message { padding: 11px 14px; border-radius: 8px; background: #e6f3ed; color: #185e43; }
.message.error { background: #ffebec; color: #8c2430; }
.notice { margin: 20px 0; padding: 13px 15px; border-left: 3px solid #c68b22; background: #fff7e6; color: #694d18; }
.enrollment-page > p:not(.eyebrow, .hint, .message) { color: var(--muted); }
.enrollment-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
pre {
  max-height: 460px;
  padding: 16px;
  overflow: auto;
  border-radius: 8px;
  background: #111b2c;
  color: #e5ecf8;
  font-size: .78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.text-link { display: inline-block; margin-top: 20px; color: var(--primary-dark); }
footer { padding: 0 20px 30px; color: var(--muted); font-size: .8rem; text-align: center; }

@media (max-width: 800px) {
  .server-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; gap: 0; }
  .account-area > span { display: none; }
}

@media (max-width: 520px) {
  .page-shell { width: min(100% - 22px, 1160px); margin-top: 18px; }
  .site-header { padding-inline: 14px; }
  .card { padding: 18px; border-radius: 11px; }
  .server-grid { grid-template-columns: 1fr; gap: 13px; }
  .device-item { align-items: flex-start; }
  .device-item .button { flex-shrink: 0; }
  .copy-row { flex-direction: column; }
  .enrollment-actions { flex-direction: column; }
  .enrollment-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
