:root {
  --bg: #f6f7f9; --panel: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6ec;
  --accent: #2563eb; --accent-text: #fff; --danger: #c62828; --ok: #2e7d32; --warn: #b26a00;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171d; --panel: #1c2028; --text: #e6e8ee; --muted: #9aa3b2; --line: #2d333f;
          --accent: #4c8dff; --accent-text: #0b1020; --danger: #ef6b6b; --ok: #6cc070; --warn: #e0a040; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, sans-serif; }
header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 16px;
         background: var(--panel); border-bottom: 1px solid var(--line); }
header h1 { font-size: 16px; margin: 0 8px 0 0; }
nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
nav button { background: none; border: 0; padding: 6px 10px; border-radius: 6px; color: var(--muted); cursor: pointer; font: inherit; }
nav button.active { background: var(--bg); color: var(--text); font-weight: 600; }
main { padding: 16px; max-width: 1200px; margin: 0 auto; }
.bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.bar h2 { margin: 0; font-size: 18px; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.wrap { white-space: normal; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
button.btn, a.btn { background: var(--accent); color: var(--accent-text); border: 0; padding: 6px 12px; border-radius: 6px;
                    cursor: pointer; font: inherit; text-decoration: none; display: inline-block; }
button.btn.ghost, a.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.btn.danger { background: var(--danger); color: #fff; }
button.btn.small { padding: 2px 8px; font-size: 12px; }
td.actions { display: flex; gap: 4px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; margin-right: 3px; }
.ok { color: var(--ok); } .err { color: var(--danger); } .warn { color: var(--warn); } .muted { color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.on { background: var(--ok); }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 20px;
         width: min(520px, calc(100vw - 32px)); max-height: 90vh; overflow: auto; }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h3 { margin-top: 0; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 3px; }
label.field small { color: var(--muted); display: block; margin-top: 2px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
.multi { max-height: 160px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; background: var(--bg); }
.multi label { display: block; }
.buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.login { max-width: 380px; margin: 10vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.login h1 { margin-top: 0; }
.error { color: var(--danger); min-height: 1.4em; }
pre.conf { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow: auto; font-size: 12px; max-height: 260px; }
img.qr { display: block; margin: 8px auto; background: #fff; padding: 6px; border-radius: 6px; max-width: 100%; }
.codes { columns: 2; font-family: monospace; font-size: 15px; background: var(--bg); padding: 10px; border-radius: 6px; }
.toast { position: fixed; bottom: 16px; right: 16px; background: var(--panel); border: 1px solid var(--line); padding: 10px 14px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.pad { padding: 16px; }
.mt { margin-top: 16px; }
header h1 { display: flex; align-items: center; }
img.logo { height: 28px; width: 28px; margin-right: 8px; }
img.banner { display: block; width: 320px; max-width: 100%; margin: 0 auto 8px; }
.login h2 { margin-top: 0; text-align: center; }
