:root {
  --bg: #08090b;
  --card: #14171c;
  --line: rgba(255, 255, 255, 0.10);
  --text: #eef1f5;
  --muted: #9aa3af;
  --accent: #4c8dff;
  --good: #3ad6a0;
  --danger: #ff6b5e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }

.mark {
  width: 56px; height: 56px; margin: 0 auto 6px; border-radius: 16px;
  background: linear-gradient(140deg, #3b6fe0, #7a5cff 55%, #2fd0b8);
  position: relative; box-shadow: 0 14px 34px -14px rgba(76, 141, 255, 0.85);
}
.mark::after {
  content: ""; position: absolute; inset: 16px 13px 20px;
  border: 3px solid rgba(255,255,255,.95); border-radius: 5px;
}
.mark.small { width: 22px; height: 22px; border-radius: 7px; margin: 0; box-shadow: none; display: inline-block; vertical-align: -5px; }
.mark.small::after { inset: 6px 5px 8px; border-width: 2px; border-radius: 2px; }

.centre { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
#auth-form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 11px; text-align: center; }
h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0; font-weight: 600; }
h3 { font-size: 17px; margin: 0 0 14px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.error { color: var(--danger); font-size: 13px; margin: 2px 0 0; }
.switch { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

input {
  width: 100%; background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 13px 14px; font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  font: inherit; color: var(--text); background: #20242b; border: 1px solid var(--line);
  border-radius: 11px; padding: 11px 15px; cursor: pointer; transition: background .12s, transform .06s;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
#auth-submit, #add-device { background: var(--accent); border-color: transparent; font-weight: 600; }
button.ghost { background: transparent; color: var(--muted); }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-size: 13px; }
button.danger { color: var(--danger); background: transparent; }

main { max-width: 860px; margin: 0 auto; padding: 22px 20px 60px; }
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; gap: 12px; }
.brand { font-weight: 650; display: flex; align-items: center; gap: 9px; }
.account { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

.devices { display: flex; flex-direction: column; gap: 10px; }
.device {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: 13px; padding: 14px;
}
.device .info { flex: 1; min-width: 0; }
.device .name { font-weight: 560; display: flex; align-items: center; gap: 8px; }
.device .meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #555; flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px rgba(58, 214, 160, .18); }
.device .actions { display: flex; gap: 6px; flex: none; }
.device .actions button { padding: 8px 12px; font-size: 13px; }
.device .open { background: var(--accent); border-color: transparent; font-weight: 600; }

.sessions { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.session { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.session b { color: var(--text); font-weight: 500; }

.empty { color: var(--muted); font-size: 13px; padding: 10px 2px; }
.note { color: var(--muted); font-size: 12px; text-align: center; margin-top: 26px; line-height: 1.6; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 20px; z-index: 20; }
.sheet { background: #16191e; border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(420px, 100%); }
.sheet-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.code {
  font: 600 26px/1.3 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em;
  text-align: center; background: #0e1116; border: 1px solid var(--line);
  border-radius: 12px; padding: 18px; margin: 10px 0 14px; user-select: all;
}
.steps { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0; padding-left: 18px; }
.steps code { background: #0e1116; padding: 2px 6px; border-radius: 5px; color: var(--text); }

@media (max-width: 520px) {
  .device { flex-wrap: wrap; }
  .device .actions { width: 100%; justify-content: flex-end; }
}
