/* Ability Ledger 网页版：移动优先，iPhone / iPad Safari 为主要目标。无外部字体与框架。 */
:root {
  --bg: #f6f5f2; --card: #ffffff; --ink: #1d2320; --muted: #69716d; --line: #e2e0da;
  --accent: #2f5d50; --accent-ink: #ffffff; --ok: #1b7f3b; --warn: #8a5a00; --bad: #b3261e;
  --soft: #eef3f0; --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151917; --card: #1e2421; --ink: #e8ece9; --muted: #9aa49f; --line: #2f3833;
          --accent: #7fb8a5; --accent-ink: #0f1513; --ok: #6fcf8c; --warn: #e0b35a; --bad: #f08a80;
          --soft: #23302b; color-scheme: dark; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", system-ui, sans-serif;
  padding-bottom: calc(68px + var(--safe-b)); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 24px; }
h1 { font-size: 1.35rem; margin: 8px 0 12px; }
h2 { font-size: 1.08rem; margin: 18px 0 8px; }
h3 { font-size: 1rem; margin: 12px 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .85rem; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.pre { white-space: pre-wrap; word-break: break-word; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin: 10px 0; }
.card.soft { background: var(--soft); border-color: transparent; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); padding: 10px 0; }
.list > li:first-child { border-top: 0; }
.item-title { font-weight: 600; word-break: break-word; }
.tag { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: 99px;
  background: var(--soft); color: var(--muted); margin-right: 4px; white-space: nowrap; }
.tag.accent { background: var(--accent); color: var(--accent-ink); }
.tag.warn { color: var(--warn); }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line);
  flex: none; }
.photo { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line);
  display: block; margin: 8px 0; }

/* 表单 */
label { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 4px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: normal; margin: 6px 12px 6px 0; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=number],
textarea, select {
  width: 100%; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; -webkit-appearance: none; appearance: none; }
textarea { min-height: 96px; resize: vertical; }
textarea.tall { min-height: 180px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--accent); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=file] { font-size: .9rem; max-width: 100%; }
.btn, button { font: inherit; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover, button:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger, button.danger { color: var(--bad); }
.btn.small, button.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn.block, button.block { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }
form.inline { display: inline; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { margin: 0; font-weight: normal; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: inline-flex; min-height: 44px; align-items: center; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.choice input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); }
details summary { cursor: pointer; color: var(--accent); min-height: 32px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* 提示 */
.flash { border-radius: 10px; padding: 10px 14px; margin: 8px 0; background: var(--soft); }
.flash.error { color: var(--bad); border: 1px solid var(--bad); background: transparent; }
.notice { border-left: 4px solid var(--warn); padding: 6px 12px; margin: 10px 0; color: var(--warn); }
.notice.bad { border-color: var(--bad); color: var(--bad); }

/* 顶栏与底部标签栏 */
header.top { position: sticky; top: 0; z-index: 5; background: var(--bg);
  border-bottom: 1px solid var(--line); padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); }
header.top .wrap { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
header.top .brand { font-weight: 700; color: var(--ink); }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--card);
  border-top: 1px solid var(--line); display: flex; padding-bottom: var(--safe-b); }
nav.tabs a { flex: 1; text-align: center; padding: 8px 2px 6px; color: var(--muted); font-size: .78rem;
  min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
nav.tabs a .ico { font-size: 1.3rem; line-height: 1.1; }
nav.tabs a.on { color: var(--accent); font-weight: 600; }
nav.tabs a.capture .ico { background: var(--accent); color: var(--accent-ink); border-radius: 99px;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
nav.tabs a:hover { text-decoration: none; }
.badge { background: var(--bad); color: #fff; border-radius: 99px; font-size: .7rem; padding: 0 6px; margin-left: 2px; }

/* 收集箱选择 */
.select-row { display: flex; gap: 10px; align-items: flex-start; }
.select-row input[type=checkbox] { margin-top: 4px; flex: none; }
.bulkbar { position: sticky; bottom: calc(64px + var(--safe-b)); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-top: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.seg a { white-space: nowrap; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line);
  color: var(--ink); background: var(--card); font-size: .9rem; }
.seg a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg a:hover { text-decoration: none; }
table.plain { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.plain td, table.plain th { border-top: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
.scroll-x { overflow-x: auto; }
.timer { font-variant-numeric: tabular-nums; }
.token { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all;
  background: var(--soft); padding: 10px; border-radius: 8px; user-select: all; }
.revoked { opacity: .5; }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  nav.tabs { position: static; max-width: 760px; margin: 0 auto; border: 1px solid var(--line);
    border-radius: var(--radius); }
  .bulkbar { bottom: 8px; }
}
.mt { margin-top: 8px; }
h2.flush, h3.flush { margin-top: 0; }
.pre.prompt { font-size: 1.05rem; }
a.capture-link { color: inherit; align-items: flex-start; flex-wrap: nowrap; }
a.capture-link:hover { text-decoration: none; }
.js-only { display: none; }
.js .js-only { display: inline; }
.js .bulkbar.active .js-only { display: none; }
/* 有脚本时：没选中就收起批量操作，不占屏幕；选中后才固定在底部 */
.js .bulkbar:not(.active) { position: static; box-shadow: none; }
.js .bulkbar:not(.active) .bulk-actions { display: none; }
