:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --card: #fff;
  --text: #17202c;
  --muted: #5d6b7d;
  --line: #d7dde6;
  --accent: #1f6feb;
  --accent-text: #fff;
  --bad: #b42318;
  --ok: #1a7f37;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1420; --card: #172033; --text: #e6ebf3; --muted: #9aa8bd; --line: #2b3750; --accent: #4c8dff; --accent-text: #08111f; --bad: #ff8d85; --ok: #6fd687; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, "Segoe UI", "Noto Sans TC", "Noto Sans", sans-serif; }
header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
header .brand { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-right: auto; }
header img { width: 24px; height: 24px; }
nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 20px 0; max-width: 1100px; margin: 0 auto; }
nav button { border-color: transparent; background: transparent; }
nav button[aria-current="page"] { border-color: var(--line); background: var(--card); font-weight: 600; }
main { max-width: 1100px; margin: 0 auto; padding: 16px 20px 48px; }
main.narrow { max-width: 460px; }
h1 { font-size: 1.35rem; margin: 8px 0 12px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
a { color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.bad-text { color: var(--bad); }
.ok-text { color: var(--ok); }
button, input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
input, select, button { height: 36px; padding: 0 12px; }
textarea { padding: 8px 12px; width: 100%; resize: vertical; }
button { cursor: pointer; white-space: nowrap; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.primary, a.button { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--bad); }
a.button { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 8px; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; align-items: end; }
.form.single { grid-template-columns: 1fr; }
.form p { margin: 0; }
.field { display: grid; gap: 4px; }
.field > span { font-size: .87rem; color: var(--muted); }
.field input, .field select { width: 100%; min-width: 0; }
.field.wide, .form > .wide, .form > .actions { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; min-height: 36px; }
.check input { width: 16px; height: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
.nowrap { white-space: nowrap; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; min-width: 7em; padding: 9px 12px; border-bottom: 1px solid var(--line); }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td .actions { min-width: 13em; align-items: flex-start; }
td .actions:has(> :only-child) { min-width: 0; }
td small { display: block; color: var(--muted); }
.badge { display: inline-block; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; white-space: nowrap; }
.badge.warn { border-color: var(--bad); color: var(--bad); }
.message { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; background: var(--card); white-space: pre-wrap; overflow-wrap: anywhere; }
.message.staff { border-left: 3px solid var(--accent); }
.message small { display: block; color: var(--muted); white-space: normal; }
.qr { display: block; width: 210px; max-width: 100%; margin: 0 auto 12px; border-radius: 8px; }
input[type="file"] { padding: 5px 8px; height: auto; min-height: 36px; width: 100%; }
.keys { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.keys .secret { margin: 0; flex: 1 1 14em; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .05em; overflow-wrap: anywhere; user-select: all; }
.notice { white-space: pre-line; position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: min(92vw, 560px); padding: 10px 16px; border-radius: 8px; background: var(--text); color: var(--bg); z-index: 10; }
.notice.bad { background: var(--bad); color: var(--card); }
dialog { width: min(92vw, 440px); border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog .actions { justify-content: flex-end; margin-top: 12px; }
@media (max-width: 960px) {
  header, nav, main { padding-left: 12px; padding-right: 12px; }
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border-bottom: 1px solid var(--line); padding: 6px 0; }
  tr:last-child { border-bottom: 0; }
  td { border: 0; padding: 3px 12px; min-width: 0; }
  .nowrap { white-space: normal; }
  td::before { content: attr(data-label) "："; color: var(--muted); font-size: .85rem; }
  td .actions { min-width: 0; }
}

.bot-check { min-height: 65px; margin: 8px 0; }
