:root {
  --bg: #fafafa; --surface: #fff; --text: #111418; --muted: #6b7280; --line: #e3e6ea;
  --accent: #0a7cff; --accent-text: #fff; --danger: #d92d20;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0d10; --surface: #12151a; --text: #e8eaed; --muted: #8b93a1; --line: #242932; --accent: #4c9dff; --accent-text: #06101f; --danger: #f97066; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, "SF Pro Text", "Segoe UI", "PingFang SC", sans-serif; -webkit-font-smoothing: antialiased; }
main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px 24px; }
.brand { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.brand::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--accent); border-radius: 2px; margin-right: 8px; }
h1 { font-size: 20px; font-weight: 600; margin: 0 0 6px; }
p.sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input { width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
input.code { font-family: var(--mono); font-size: 22px; letter-spacing: .4em; text-align: center; }
button { width: 100%; margin-top: 20px; padding: 10px 12px; font: inherit; font-weight: 600; color: var(--accent-text); background: var(--accent); border: 0; border-radius: 6px; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: none; color: var(--muted); font-weight: 400; margin-top: 10px; border: 1px solid var(--line); }
.err { color: var(--danger); font-size: 13px; min-height: 1.4em; margin: 12px 0 0; }
.qr { display: flex; justify-content: center; padding: 12px; margin: 4px 0 12px; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.qr svg, .qr img { width: 180px; height: 180px; }
.secret { font-family: var(--mono); font-size: 13px; word-break: break-all; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; user-select: all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 13px; }
.codes li { padding: 6px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; text-align: center; }
button.link { color: var(--accent); background: none; border: 0; width: auto; margin: 12px 0 0; padding: 0; font-weight: 400; font-size: 13px; cursor: pointer; }

/* ---- 登录后的后台外壳 ---- */
main.shell { display: block; place-items: unset; padding: 0; }
.top { display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 52px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.top .brand { margin: 0; }
.tabs { display: flex; gap: 2px; flex: 1; }
.tabs button { width: auto; margin: 0; padding: 6px 12px; background: none; color: var(--muted); font-weight: 500; border-radius: 6px; }
.tabs button.on { color: var(--text); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.content { max-width: 1100px; margin: 0 auto; padding: 24px 20px 64px; }
.content h2 { font-size: 18px; margin: 0 0 16px; }
.content h3 { font-size: 14px; margin: 24px 0 10px; }
.panel h3 { margin-top: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 0 0 12px; }
.panel.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 16px; }
.panel .full { grid-column: 1 / -1; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.ok { color: #12a05c; }
.err { color: var(--danger); }
.note { min-height: 1.4em; margin: 8px 0 0; font-size: 13px; }
.note.ok { color: #12a05c; } .note.err { color: var(--danger); }
select, textarea { width: 100%; padding: 9px 10px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
textarea { resize: vertical; margin-top: 4px; }
textarea.keys { font-family: var(--mono); font-size: 12.5px; margin: 8px 0; }
.content button, .btn { width: auto; margin: 0; padding: 8px 14px; font-size: 14px; }
.content button.small, .btn.small { padding: 4px 10px; font-size: 12.5px; }
.content button.ghost, .btn.ghost { background: none; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.content button.danger { color: var(--danger); }
.content button.link, .who button.link { width: auto; padding: 0; margin: 0; border: 0; background: none; color: var(--accent); font-weight: 400; }
.btn { display: inline-block; text-decoration: none; border-radius: 6px; color: var(--text); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; align-items: center; }
.bar input, .bar select { width: auto; flex: 1 1 160px; max-width: 260px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
td.wrap { word-break: break-all; max-width: 260px; }
td.acts { display: flex; flex-wrap: wrap; gap: 6px; }
code.key { cursor: pointer; }
code.key:hover { color: var(--accent); }
.badge { display: inline-block; padding: 1px 8px; margin-left: 6px; border-radius: 10px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
.badge.used { color: #12a05c; } .badge.revoked { color: var(--danger); } .badge.unused { color: var(--accent); }
td .badge:first-child { margin-left: 0; }
.pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
details.fold { margin: 0 0 12px; }
details.fold summary { cursor: pointer; padding: 8px 0; font-weight: 600; font-size: 14px; }
.log { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow: auto; width: 100%; margin: 6px 0 0; }
.log[hidden] { display: none; }
.qrow { display: grid; grid-template-columns: 1fr 160px 120px; gap: 12px; align-items: center; padding: 6px 0; }
progress { width: 100%; }
.check { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; margin: 8px 0; }
.check input { width: auto; }
.actions { display: flex; gap: 10px; margin: 14px 0 4px; }
@media (max-width: 720px) { .top { flex-wrap: wrap; height: auto; padding: 10px 16px; } .qrow { grid-template-columns: 1fr; } }
.content a { color: var(--accent); }
.content a.btn { color: var(--text); }
input[type=file] { width: auto; padding: 6px 8px; margin-right: 8px; }
.panel > .actions, .panel > button { margin-top: 10px; }
