:root {
  color-scheme: dark;
  --bg: #0b0b13;
  --panel: #181820;
  --wash: #1e1e2a;
  --line: #29293d;
  --ink: #eef0f7;
  --muted: #99a8bd;
  --accent: #8b8cf9;
  --dark-accent: #17172a;
  --active: #22d3a0;
  --frozen: #6eb6ff;
  --pending: #9da2ac;
  --warm: #ffab20;
  --danger: #ffc0ae;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
main { width: min(714px, calc(100% - 28px)); margin: 0 auto; padding: 21px 0 48px; }
footer { display: flex; justify-content: flex-end; margin-top: 16px; }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.18; letter-spacing: -.025em; overflow-wrap: anywhere; }
h2 { font-size: 17px; }
.muted, small, dt { color: var(--muted); }
p.muted { font-size: 14px; }
.summary { margin-top: 28px; }
.summary summary { cursor: pointer; font-weight: 650; }
.summary .muted { margin: 9px 0 14px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metrics div { min-width: 0; border-left: 1px solid var(--line); padding-left: 14px; }
.metrics strong { display: block; font-size: clamp(18px, 3vw, 28px); line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metrics div:first-child strong { color: var(--accent); }
.device-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.device-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px; min-height: 83px; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); text-decoration: none; }
.person-card { grid-template-columns: minmax(0, 1fr) auto auto; }
.device-card:hover, .device-card:focus-visible { border-color: #45458a; }
.device-icon { display: grid; place-items: center; width: 47px; height: 47px; border-radius: 13px; background: var(--wash); }
.device-icon.active { color: var(--active); }
.device-icon.frozen { color: var(--frozen); }
.device-icon.pending { color: var(--pending); }
.device-icon svg { width: 29px; height: 29px; }
.device-info strong { display: block; margin-bottom: 3px; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--muted); font-size: 13px; }
.person-icons { display: flex; flex-wrap: wrap; gap: 4px; }
.person-icons .device-icon { width: 25px; height: 25px; border-radius: 7px; }
.person-icons svg { width: 16px; height: 16px; }
.card-traffic { text-align: right; white-space: nowrap; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.card-traffic small { display: block; font-size: 12px; font-weight: 400; }
.chevron { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 650; line-height: 1.35; }
.status.active { color: var(--active); background: #1d312d; }
.status.pending { color: #c1c2ff; background: #2a2850; }
.status.frozen { color: var(--warm); background: #382d20; }
.button, .plain { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); padding: 9px 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--wash); font-weight: 650; }
.button:hover, .plain:hover { border-color: var(--accent); }
.button.primary { background: var(--accent); color: var(--dark-accent); border-color: var(--accent); }
.button.add-device { display: flex; gap: 8px; min-height: 43px; padding: 6px 12px; margin-bottom: 16px; border: 0; border-radius: 13px; color: white; background: linear-gradient(110deg, #6462ed, #5043e2); box-shadow: 0 5px 17px #5651e946; }
.add-device:hover { filter: brightness(1.09); }
.add-device span { font-size: 19px; line-height: 1; }
.plain { background: none; color: var(--muted); }
.back { color: var(--accent); display: inline-flex; align-items: center; min-height: 40px; margin-bottom: 8px; font-size: 14px; text-decoration: none; }
.back:hover { text-decoration: underline; }
.page-heading { margin: 0 0 18px; }
.page-heading h1 { margin-bottom: 5px; }
.device-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.device-settings { display: grid; gap: 8px; }
.panel { padding: clamp(15px, 4vw, 20px); background: var(--panel); border: 1px solid var(--line); border-radius: 13px; }
.panel h2 { margin-bottom: 8px; }
.device-section { padding: 0; }
.device-section > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 10px 15px; border-radius: inherit; list-style: none; cursor: pointer; font-weight: 650; }
.device-section > summary::-webkit-details-marker { display: none; }
.device-section > summary::after { content: ''; width: 7px; height: 7px; margin-right: 3px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); }
.device-section[open] > summary::after { transform: rotate(45deg); }
.section-body { padding: 0 15px 15px; }
.device-created { margin-top: 10px; }
.new h1, .login h1 { margin-bottom: 16px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
input, select { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font-size: 16px; }
input[readonly] { font-family: ui-monospace, monospace; }
.editor { display: grid; gap: 13px; }
.editor button { justify-self: start; }
.share-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 4px; align-items: center; padding: 8px 10px 8px 16px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; }
.share-bar label { grid-column: 1; grid-row: 1; align-self: end; font-size: 12px; }
.share-bar input { grid-column: 1; grid-row: 2; align-self: start; padding: 0; border: 0; border-radius: 0; color: var(--ink); background: transparent; font: inherit; font-size: 14px; text-overflow: ellipsis; }
.copy-link, .qr-trigger, .qr-close { min-width: 42px; height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--accent); }
.copy-link, .qr-trigger { grid-row: 1 / 3; }
.copy-link { display: grid; place-items: center; }
.copy-link span { position: relative; width: 13px; height: 15px; border: 1.5px solid currentColor; border-radius: 3px; }
.copy-link span::before { content: ''; position: absolute; width: 8px; height: 10px; left: -5px; top: -5px; border: solid currentColor; border-width: 1.5px 0 0 1.5px; border-radius: 3px 0 0; }
.qr-trigger { background: var(--wash); font-size: 13px; font-weight: 650; }
.copy-link:hover, .qr-trigger:hover, .qr-close:hover { background: var(--line); }
#copy-result:not(:empty) { grid-column: 1 / -1; color: var(--active); font-size: 12px; }
#qr { width: min(292px, calc(100% - 32px)); padding: 16px 20px 20px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
#qr::backdrop { background: rgb(5 5 12 / 78%); }
.qr-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.qr-close { font-size: 24px; color: var(--muted); line-height: 1; }
#qr img { display: block; width: 100%; height: auto; aspect-ratio: 1; background: white; border-radius: 6px; }
dl { margin: 0 0 12px; }
dl div { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
dd { margin: 0; font-variant-numeric: tabular-nums; }
.delete { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; color: var(--danger); }
.delete summary { cursor: pointer; }
.delete p { margin: 10px 0; color: var(--muted); }
.danger { color: var(--danger); }
.notice { padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--wash); color: var(--accent); margin-bottom: 18px; }
.notice.error { border-color: var(--danger); color: var(--danger); }
@media (min-width: 521px) {
  main { width: min(714px, calc(100% - 48px)); padding-top: 42px; }
  .device-card { gap: 12px; padding: 16px 17px; }
}
@media (max-width: 520px) {
  .metrics { gap: 7px; }
  .metrics div { padding-left: 8px; }
}
