:root {
  --bg: #f5f6f8;
  --panel: #fff;
  --text: #1f2328;
  --muted: #6a737d;
  --line: #e1e4e8;
  --brand: #1f6feb;
  --brand-weak: #e8f0fe;
  --ok: #1a7f37;
  --ok-weak: #e6f4ea;
  --warn: #9a6700;
  --warn-weak: #fff4d6;
  --bad: #cf222e;
  --bad-weak: #ffebe9;
  --info: #0969da;
  --info-weak: #ddf4ff;
  --radius: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 14px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.55;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* 布局 */
.topbar {
  position: sticky; top: 0; z-index: 10; background: #24292f; color: #fff;
  display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem; height: 48px;
}
.topbar .brand { font-weight: 600; color: #fff; white-space: nowrap; }
.topbar nav { display: flex; gap: .15rem; overflow-x: auto; flex: 1; }
.topbar nav a {
  color: #d0d7de; padding: .35rem .6rem; border-radius: 6px; white-space: nowrap;
}
.topbar nav a:hover { background: #32383f; color: #fff; text-decoration: none; }
.topbar nav a.active { background: #424a53; color: #fff; }
.topbar .who { display: flex; align-items: center; gap: .6rem; white-space: nowrap; color: #d0d7de; }
.topbar .who a { color: #d0d7de; }
.topbar .who form { margin: 0; }
.topbar .who button { background: none; border: 1px solid #57606a; color: #d0d7de; padding: .15rem .55rem; border-radius: 6px; cursor: pointer; }
.pill { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 99px; background: var(--bad); color: #fff; font-size: .78rem; text-align: center; }
main { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat .label { color: var(--muted); font-size: .88rem; }
.stat .value { font-size: 1.45rem; font-weight: 600; margin-top: .15rem; }
.stat .sub { color: var(--muted); font-size: .85rem; }

/* 提示 */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: .5rem; border: 1px solid transparent; }
.messages .success { background: var(--ok-weak); border-color: #aceebb; }
.messages .error { background: var(--bad-weak); border-color: #ffcecb; }
.messages .warning { background: var(--warn-weak); border-color: #f5e0a0; }
.messages .info { background: var(--info-weak); border-color: #b6e3ff; }
.callout { padding: .7rem .9rem; border-radius: var(--radius); background: var(--info-weak); border: 1px solid #b6e3ff; margin-bottom: 1rem; }
.callout.warn { background: var(--warn-weak); border-color: #f5e0a0; }
.callout.bad { background: var(--bad-weak); border-color: #ffcecb; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .88rem; background: #fafbfc; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 600; background: #fafbfc; }
table.kvtable th { width: 160px; background: none; color: var(--muted); font-weight: normal; }
.empty { color: var(--muted); padding: 1rem; text-align: center; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .8rem; background: #eaeef2; color: #424a53; white-space: nowrap; }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.bad { background: var(--bad-weak); color: var(--bad); }
.badge.info { background: var(--info-weak); color: var(--info); }
.badge.muted { background: #eaeef2; color: var(--muted); }
span.warn { color: var(--warn); } span.bad { color: var(--bad); } span.ok { color: var(--ok); }

/* 按钮与表单 */
.btn, button.btn {
  display: inline-flex; align-items: center; gap: .3rem; padding: .4rem .85rem; border-radius: 6px;
  border: 1px solid #d0d7de; background: #f6f8fa; color: var(--text); cursor: pointer; font-size: .95rem; line-height: 1.3;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #eef1f4; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #1a5fd0; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: .15rem .5rem; font-size: .85rem; }
.btn.link { background: none; border: none; color: var(--brand); padding: 0; }
form.inline { display: inline; margin: 0; }

.form { max-width: 760px; }
.form .section { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
.form .section:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.form .section > h3 { margin-top: 0; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; align-items: start; }
.field { margin-bottom: .8rem; min-width: 0; }
.field > label, .field legend { display: block; font-weight: 600; margin-bottom: .2rem; padding: 0; }
.field fieldset { border: none; padding: 0; margin: 0; min-width: 0; }
.field fieldset > div { display: flex; gap: .4rem 1.25rem; flex-wrap: wrap; }
.field fieldset label { font-weight: normal; display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.field fieldset input[type=radio] { margin: 0; }
.field label.check { display: inline-flex; align-items: center; gap: .1rem; font-weight: normal; cursor: pointer; }
.field.has-error input, .field.has-error select { border-color: var(--bad); }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], input[type=datetime-local],
select, textarea {
  width: 100%; padding: .42rem .55rem; border: 1px solid #d0d7de; border-radius: 6px; font-size: .95rem; background: #fff; font-family: inherit;
}
input[type=file] { max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-weak); border-color: var(--brand); }
input[type=checkbox] { width: auto; margin-right: .35rem; }
.helptext { display: block; color: var(--muted); font-size: .85rem; margin-top: .15rem; }
ul.errorlist { list-style: none; padding: 0; margin: .2rem 0; color: var(--bad); font-size: .88rem; }
ul.errorlist.nonfield { padding: .6rem .9rem; background: var(--bad-weak); border-radius: var(--radius); margin-bottom: 1rem; }
.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }
.secret-wrap { display: flex; gap: .4rem; }
.secret-wrap input { flex: 1; }
.select-filter { margin-bottom: .3rem; font-size: .88rem !important; padding: .25rem .5rem !important; }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters > div { min-width: 140px; }
.filters label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .15rem; }

.secret { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.secret .value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #f6f8fa; padding: .05rem .4rem; border-radius: 4px; }

.pagination { display: flex; gap: .5rem; align-items: center; margin-top: .8rem; }
ul.kv { margin: 0; padding-left: 1rem; }
ul.kv li { word-break: break-all; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li { padding: .5rem 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: .75rem; align-items: center; flex-wrap: wrap; }
.todo-list li:last-child { border-bottom: none; }
.who-tag { font-size: .8rem; color: var(--muted); font-weight: normal; }

.auth-box { max-width: 420px; margin: 8vh auto; }
.auth-box .panel { padding: 1.5rem; }
.qr { display: block; margin: .5rem auto; width: 220px; height: 220px; image-rendering: pixelated; }
.secret-key { font-family: ui-monospace, Menlo, monospace; letter-spacing: .05em; text-align: center; background: #f6f8fa; padding: .5rem; border-radius: 6px; word-spacing: .4em; }

.steps { display: flex; gap: .75rem; flex-wrap: wrap; }
.steps .step { flex: 1; min-width: 200px; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; background: #fafbfc; }
.steps .step.done { background: var(--ok-weak); border-color: #aceebb; }

@media print {
  .topbar, .actions, .form-actions, .filters, button { display: none !important; }
  body { background: #fff; }
}

/* 设置页的分页签 */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .5rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }

/* 待办卡片 */
.task { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .8rem; background: #fff; }
.task-head { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: baseline; margin-bottom: .4rem; }
.task-head b { font-size: 1.02rem; }
.task .creds { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .3rem 1rem; background: #f6f8fa; border-radius: 6px; padding: .5rem .7rem; margin: .4rem 0 .6rem; }
.task .creds > div { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.task .creds .k { color: var(--muted); min-width: 4.5em; }
.task form .row { gap: 0 .8rem; }
.task details { margin-top: .4rem; }
.task summary { cursor: pointer; color: var(--brand); }
.section-title { display: flex; align-items: baseline; gap: .5rem; margin: 1.2rem 0 .6rem; }
.section-title h2 { margin: 0; }
details.others > summary { cursor: pointer; font-weight: 600; margin: 1.5rem 0 .6rem; }
.timeline td:first-child { white-space: nowrap; }
div.inline-radio { display: flex; gap: .4rem 1.25rem; flex-wrap: wrap; }
div.inline-radio label { font-weight: normal; display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
