:root {
  --bg: #0f1216;
  --card: #171c22;
  --line: #2a323c;
  --text: #e6edf3;
  --muted: #93a1b1;
  --accent: #4da3ff;
  --ok: #2ea043;
  --danger: #f85149;
  --warn: #d29922;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: #12161b;
}
.brand { font-weight: 700; color: var(--text); letter-spacing: .2px; }
.top nav { display: flex; gap: 16px; align-items: center; }
.who { color: var(--muted); }

main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; border-top: 1px solid var(--line); }

h1 { font-size: 24px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.card.narrow { max-width: 460px; margin: 40px auto; }
.card hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }

label { display: block; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  background: #0d1117; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; font-size: 15px;
}
input:focus { outline: none; border-color: var(--accent); }
input[readonly] { color: var(--muted); }

button, .button {
  display: inline-block; padding: 10px 16px; border-radius: 8px;
  border: 1px solid #2f6fbf; background: #1f6feb; color: #fff;
  font-size: 14px; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: #2f81f7; text-decoration: none; }
button.link {
  background: none; border: 0; color: var(--accent); padding: 0; font-size: 13px;
}
button.link:hover { text-decoration: underline; background: none; }
button.link.danger { color: var(--danger); }

.row-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.row-form label { flex: 1 1 200px; margin: 0; }
.row-form button { flex: 0 0 auto; }
form.inline { display: inline; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--line);
}
.badge.on { color: #7ee787; border-color: #235b31; background: #12261a; }
.badge.off { color: #ffa198; border-color: #5c2320; background: #2a1515; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.err, .warn {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px;
}
.err { background: #2a1515; border: 1px solid #5c2320; color: #ffb3ad; }
.warn { background: #2a2113; border: 1px solid #5c4a20; color: #e3b341; }

.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox input { font-size: 12px; }
.linkbox button { flex: 0 0 auto; }

.profile-head { display: flex; justify-content: space-between; align-items: center; }
.qr { margin-top: 14px; display: flex; justify-content: center; }
.qr img, .qr canvas { background: #fff; padding: 10px; border-radius: 8px; }
.qr-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.secret code { display: block; margin-top: 6px; word-break: break-all; }

@media (max-width: 560px) {
  .row-form { display: block; }
  .row-form button { width: 100%; margin-top: 8px; }
  td.actions { white-space: normal; }
}
