:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --faint: #9a9aa0;
  --line: #e6e4df;
  --accent: #3d6be0;
  --accent-ink: #ffffff;
  --ok: #1f8a4c;
  --wait: #b26a00;
  --bad: #c4352b;
  --chip: #efede8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1b1d;
    --surface: #242427;
    --text: #ececee;
    --muted: #a4a4aa;
    --faint: #75757b;
    --line: #36363a;
    --accent: #7b9cff;
    --accent-ink: #10131c;
    --ok: #5fd08f;
    --wait: #f0b45a;
    --bad: #ff7b70;
    --chip: #303034;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1b1b1d;
  --surface: #242427;
  --text: #ececee;
  --muted: #a4a4aa;
  --faint: #75757b;
  --line: #36363a;
  --accent: #7b9cff;
  --accent-ink: #10131c;
  --ok: #5fd08f;
  --wait: #f0b45a;
  --bad: #ff7b70;
  --chip: #303034;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 650; color: var(--text); letter-spacing: .02em; }
.brand:hover { text-decoration: none; }

nav { display: flex; gap: 4px; overflow-x: auto; margin-left: auto; }
nav a {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
nav a.active { color: var(--text); background: var(--chip); }
nav a:hover { text-decoration: none; color: var(--text); }

main { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; }

h1 { font-size: 22px; margin: 4px 0 4px; }
h2 { font-size: 17px; margin: 24px 0 8px; }
.sub { color: var(--muted); margin: 0 0 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 0;
}

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

input, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }

button, .btn {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { border-color: var(--faint); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
button.danger.confirm { background: var(--bad); color: #fff; border-color: var(--bad); }
button.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }

.badge {
  display: inline-block;
  font-size: 12px;
  line-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--chip);
  white-space: nowrap;
}
.badge.ok { color: var(--ok); }
.badge.wait { color: var(--wait); }
.badge.bad { color: var(--bad); }
.badge.muted { color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }
.item { padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { color: var(--faint); font-size: 13px; }
.item-msg { color: var(--bad); font-size: 13px; margin-top: 4px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }

.hint { color: var(--faint); font-size: 13px; }
.warn { color: var(--wait); }
.notice {
  border: 1px solid color-mix(in srgb, var(--wait) 45%, var(--line));
  background: color-mix(in srgb, var(--wait) 10%, var(--surface));
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 14px;
}
.err { color: var(--bad); }
.empty { color: var(--muted); text-align: center; padding: 28px 0; }

.meter { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; background: var(--accent); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
  background: var(--chip);
  border-radius: 8px;
  padding: 8px 10px;
}

.help-h { margin: 0 0 4px; font-size: 16px; }
.help p { margin: 0; }
ol.steps, ul.steps { padding-left: 20px; margin: 8px 0; }
ol.steps li { margin: 4px 0; }

/* 推送记录表 */
.table-wrap { overflow-x: auto; margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .t-title { min-width: 160px; }
.table .t-title a { color: var(--text); }
.table .t-num { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .t-time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 笔记正文 */
.note h1 { font-size: 22px; line-height: 1.35; }
.note h2 { font-size: 18px; margin-top: 28px; padding-top: 4px; }
.note h3 { font-size: 16px; }
.note p, .note li { line-height: 1.75; }
.note blockquote { margin: 16px 0; padding: 4px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.note table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: 14px; }
.note th, .note td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.note th { background: var(--chip); }
.note code { background: var(--chip); border-radius: 4px; padding: 1px 4px; font-size: 13px; }
.note pre { background: var(--chip); border-radius: 8px; padding: 10px; overflow-x: auto; }
.note a[href*="t="] {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--chip);
  border-radius: 4px;
  padding: 0 4px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; }

#toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  max-width: calc(100vw - 32px);
  font-size: 14px;
  z-index: 10;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }

@media (max-width: 520px) {
  .top { gap: 8px; }
  nav a { padding: 6px 8px; }
  h1 { font-size: 20px; }
}

/* 笔记批量选择 */
.item.pick { display: flex; gap: 10px; align-items: flex-start; }
.item.pick > input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; margin-top: 3px; flex: none; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; color: var(--text); white-space: nowrap; }
label.inline input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; }
.batch select { width: auto; min-height: 32px; padding: 4px 8px; }
.batch { position: sticky; bottom: 8px; z-index: 4; }

/* 使用说明：截图、快速开始、常见问题 */
.shot { margin: 12px auto 4px; max-width: 300px; text-align: center; }
.shot img { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line);
            box-shadow: var(--shadow); background: var(--bg); }
.shot figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.quick { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.quick .steps { margin-bottom: 4px; }
.faq dt { font-weight: 600; margin-top: 12px; }
.faq dt:first-child { margin-top: 0; }
.faq dd { margin: 4px 0 0; color: var(--muted); }
.shot.wide { max-width: 560px; }
.shot.wide img { border-radius: 10px; }

/* 下载入口 */
.dl { display: flex; flex-direction: column; gap: 12px; }
.dl-row { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.dl-row:first-child { border-top: 0; padding-top: 0; }
.dl-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.small { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 12px; font-size: 13px; color: var(--text); }
.btn.small:hover { text-decoration: none; border-color: var(--faint); }
