:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #14171f; --muted: #5d6576; --border: #dfe3ea;
  --accent: #2563eb; --accent-text: #ffffff; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --panel: #161922; --text: #e6e8ee; --muted: #8a93a6; --border: #262b3a;
    --accent: #3b82f6; --accent-text: #ffffff; --ok: #4ade80; --warn: #f4c25b; --bad: #f87171;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; max-width: 1040px; margin: 0 auto; }
h1 { margin: 0; font-size: 20px; } h1 span { color: var(--muted); font-weight: 500; }
h2 { margin: 0; font-size: 17px; }
main { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }
section { margin-top: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 14px; }
.account { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; min-width: 0; }
.account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border-color: var(--border); }
button.danger { background: transparent; color: var(--bad); border-color: var(--border); }
button:disabled { opacity: .5; cursor: default; }
input { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); min-width: 0; flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.server .top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.server .flag { font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--muted); }
.server h3 { margin: 2px 0 8px; font-size: 16px; }
.server dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 12px; font-size: 13px; }
.server dt { color: var(--muted); } .server dd { margin: 0; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border); white-space: nowrap; }
.pill.running { color: var(--ok); border-color: currentColor; }
.pill.pending, .pill.stopping { color: var(--warn); border-color: currentColor; }
.pill.stopped { color: var(--muted); }
.devices { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.devices li { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.devices .meta { color: var(--muted); font-size: 13px; font-family: ui-monospace, monospace; }
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); padding: 16px; }
.gate[hidden] { display: none; }
.gate .card { width: min(380px, 100%); text-align: center; }
.gate p { color: var(--muted); }
.gate button { width: 100%; }
.msg { min-height: 1.2em; color: var(--warn); }
.warn { color: var(--warn); font-size: 14px; }
dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); padding: 16px; }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.conf { border-top: 1px solid var(--border); padding: 12px 0; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.conf .qr { background: #fff; padding: 6px; border-radius: 8px; line-height: 0; }
.conf .qr svg { width: 168px; height: 168px; }
.conf .info { flex: 1; min-width: 200px; display: grid; gap: 8px; justify-items: start; }
.error { color: var(--bad); }
