:root {
  --bg: #f1f3f8;
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --surface-3: #ebeff5;
  --text: #171a20;
  --text-2: #5a6473;
  --text-3: #8b93a2;
  --line: #e4e8ef;
  --accent: #2f6fed;
  --accent-strong: #2860d8;
  --accent-wash: #eaf1ff;
  --danger: #cf3c3c;
  --danger-wash: #fdecec;
  --sh-1: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 10px rgba(17, 24, 39, .04);
  --sh-2: 0 2px 5px rgba(17, 24, 39, .05), 0 10px 24px rgba(17, 24, 39, .07);
  --sh-3: 0 14px 44px rgba(17, 24, 39, .17), 0 2px 8px rgba(17, 24, 39, .06);
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1217;
    --surface: #171b22;
    --surface-2: #1e232b;
    --surface-3: #262c36;
    --text: #e9ebf0;
    --text-2: #a2abba;
    --text-3: #79828f;
    --line: #262c36;
    --accent: #6f9dff;
    --accent-strong: #8fb3ff;
    --accent-wash: #1b2942;
    --danger: #ff7373;
    --danger-wash: #332024;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-2: 0 2px 6px rgba(0, 0, 0, .38), 0 10px 24px rgba(0, 0, 0, .3);
    --sh-3: 0 18px 50px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 控件 ---------- */
input, textarea, select, button { font: inherit; color: inherit; }

input[type="text"],
input[type="password"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  outline: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

textarea { resize: vertical; line-height: 1.55; }

/* 按钮默认无边框无底色：避免浅色底上被看成一张张小卡片 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background .15s, color .15s, box-shadow .15s, transform .1s;
}

.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: scale(.98); }
/* Chrome 83 没有 :focus-visible，这里手动统一聚焦环颜色，避免出现浏览器默认的橙/黑描边 */
.btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary:focus { outline-color: var(--accent-strong); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:disabled:hover { background: transparent; }

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(47, 111, 237, .35), 0 4px 12px rgba(47, 111, 237, .2);
}
.btn.primary:hover { background: var(--accent-strong); color: #fff; }

.btn.soft {
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 600;
}
.btn.soft:hover { background: var(--accent-wash); color: var(--accent-strong); }

.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-wash); color: var(--danger); }

.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.tiny { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.icon {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  border-radius: 50%;
  color: var(--text-2);
}

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.grow { flex: 1; }

/* ---------- 解锁屏 ---------- */
.gate {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  overflow: auto;
  background:
    radial-gradient(900px 480px at 20% -10%, var(--accent-wash), transparent 65%),
    var(--bg);
}

.gate-card {
  width: min(380px, 100%);
  display: grid;
  gap: 13px;
  padding: 30px 26px 24px;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--sh-3);
}

.gate-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--accent), #8fb0ff);
  box-shadow: 0 8px 20px rgba(47, 111, 237, .3);
}

.gate-title {
  margin: 2px 0 0;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: .5px;
}

.gate-hint { margin: 0; color: var(--text-2); font-size: 14px; }
.gate-field { display: block; }
.gate-field input { padding: 11px 13px; }
.gate-submit { margin-top: 2px; padding: 12px 14px; font-size: 15px; }
.gate-note {
  margin: 0;
  min-height: 18px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------- 框架 ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  padding: 10px 18px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line), var(--sh-1);
  position: relative;
  z-index: 30;
}

.topbar > * + * { margin-left: 12px; }

.brand {
  display: flex;
  align-items: center;
  font-weight: 650;
  font-size: 15.5px;
  letter-spacing: .3px;
  white-space: nowrap;
}

.brand > * + * { margin-left: 8px; }

.brand-dot {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(140deg, var(--accent), #8fb0ff);
}

.search-wrap { flex: 1; max-width: 520px; }
.search-wrap input { padding: 8px 13px; }

.actions { margin-left: auto; display: flex; align-items: center; }
.actions > * + * { margin-left: 6px; }

.menu { position: relative; }
.menu > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  user-select: none;
  transition: background .15s, color .15s;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--surface-3); color: var(--text); }
.menu[open] > summary { background: var(--surface-3); color: var(--text); }

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  padding: 6px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--sh-3);
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.menu-panel > * + * { margin-top: 2px; }

.menu-panel button,
.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 11px;
  border: none;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}
.menu-panel button:hover { background: var(--surface-2); }
.menu-row { cursor: default; color: var(--text-2); }
.menu-row > * + * { margin-left: 10px; }
.menu-row select { width: 112px; padding: 4px 8px; }

.body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
}

/* ---------- 侧栏 ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 16px 12px 16px;
  overflow: auto;
}

.sidebar-title {
  margin: 2px 10px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  color: var(--text-3);
}

.categories { display: flex; flex-direction: column; }
.categories > * + * { margin-top: 2px; }

.category {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.category:hover { background: var(--surface); color: var(--text); }
.category.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--sh-1); }

.category > * + * { margin-left: 8px; }

.category-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 19px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.category.active .category-count { background: var(--accent-wash); color: var(--accent); }

.categories-empty {
  margin: 8px 6px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.6;
}

.sidebar-foot {
  margin: auto 6px 0;
  color: var(--text-3);
  font-size: 12px;
}

/* ---------- 列表 / 详情 ---------- */
.content {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(258px, 330px) minmax(0, 1fr);
}

.list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--line);
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px 18px 8px;
}

.list-head span:first-child {
  font-weight: 650;
  color: var(--text);
  font-size: 13px;
  letter-spacing: .4px;
}

.list-count { color: var(--text-3); font-size: 12px; }

.list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 14px 32px;
  display: flex;
  flex-direction: column;
}
.list > * + * { margin-top: 8px; }

.item {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: var(--surface);
  border: none;
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  text-align: left;
  cursor: pointer;
  transition: box-shadow .15s, background .15s;
}
.item:hover { box-shadow: var(--sh-2); }
.item.active { background: var(--accent-wash); box-shadow: var(--sh-1); }
.item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.item.active .item-title { color: var(--accent-strong); }

.item > * + * { margin-top: 5px; }

.item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta { display: flex; align-items: center; font-size: 12px; color: var(--text-3); }
.item-meta > * + * { margin-left: 8px; }
.item-time { white-space: nowrap; }

.item-fields {
  font-size: 12.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-tags { display: flex; flex-wrap: wrap; margin-top: 2px; }
.item-tags > * + * { margin-left: 5px; }

.tag {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 17px;
  white-space: nowrap;
}

.item.active .tag { background: rgba(255, 255, 255, .62); color: var(--accent-strong); }

.empty { padding: 40px 18px; text-align: center; color: var(--text-3); }
.empty-title { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty-sub { margin: 0; font-size: 13px; }

.detail-pane {
  min-height: 0;
  overflow: auto;
  padding: 18px 20px 40px;
}

.detail-empty {
  margin: 56px auto 0;
  max-width: 320px;
  padding: 0 16px;
  text-align: center;
  color: var(--text-3);
}

/* 详情本身是一张卡片，和列表卡片构成同一套层级 */
.detail {
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 22px 24px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}

.detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-head-text { min-width: 0; }
.detail-title {
  margin: 0 0 7px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -.2px;
  overflow-wrap: anywhere;
}
.detail-meta {
  display: flex;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.detail-meta > * + * { margin-left: 9px; }
.detail-actions { display: flex; align-items: center; flex-shrink: 0; }
.detail-actions > * + * { margin-left: 6px; }

/* 返回箭头用单字形，这里放大到看得清的手指目标 */
.btn.icon.back-btn {
  width: 36px;
  height: 36px;
  margin-left: -8px;
  font-size: 21px;
  line-height: 1;
  padding-bottom: 1px;
}

/* 字段块：浅底分组，和卡片区分开 */
.kv-list { display: flex; flex-direction: column; }
.kv {
  padding: 12px 14px;
  margin-top: 10px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

.kv-top { display: flex; align-items: center; justify-content: space-between; }

.kv-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.kv-value {
  margin: 7px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.kv-value.mono { font-size: 13.5px; }
.masked-text { color: var(--text-2); letter-spacing: 4px; font-size: 14px; }

.kv-link {
  display: block;
  margin-top: 7px;
  color: var(--accent);
  text-decoration: none;
  white-space: normal;
  word-break: break-all;
}
.kv-link:hover { text-decoration: underline; }

.kv-image { margin-top: 9px; }
.kv-image-loading, .kv-image-error { color: var(--text-3); font-size: 13px; }
.kv-image-error { color: var(--danger); }

.kv-thumb {
  display: block;
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  background: var(--surface-3);
  cursor: zoom-in;
}

.kv-tools { display: flex; align-items: center; flex-shrink: 0; }
.kv-tools > * + * { margin-left: 2px; }
.kv-tools .btn { color: var(--text-3); }
.kv-tools .btn:hover { background: var(--surface-3); color: var(--text); }

.detail-placeholder {
  margin: 16px 0 0;
  padding: 18px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  color: var(--text-3);
  font-size: 13.5px;
  text-align: center;
}

.detail-notes { margin-top: 18px; }
.detail-notes .kv-label { display: block; margin-bottom: 8px; }
.notes-body {
  margin: 0;
  padding: 13px 15px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 对话框 ---------- */
.dialog {
  width: min(660px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: none;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--sh-3);
}
.dialog.narrow { width: min(430px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(12, 16, 24, .52); }

.dialog form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
}

.dlg-head {
  display: flex;
  align-items: center;
  padding: 18px 20px 10px;
}
.dlg-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.dlg-head > * + * { margin-left: 10px; }
.dlg-close { margin-left: auto; }

.dlg-body { padding: 4px 20px 18px; overflow: auto; }

.dlg-foot {
  display: flex;
  align-items: center;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
}
.dlg-foot > * + * { margin-left: 8px; }

.dlg-text { margin: 0 0 14px; color: var(--text-2); font-size: 14px; line-height: 1.65; }
.dlg-error { margin: 10px 0 0; min-height: 16px; color: var(--danger); font-size: 13px; }

.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--text-3);
}

.fields-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 9px;
}

.ed-fields { margin-bottom: 16px; }

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
  padding: 9px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

.field-row .f-label,
.field-row .f-value,
.field-row .f-type {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
}
.field-row .f-label:focus,
.field-row .f-value:focus,
.field-row .f-type:focus { border-color: var(--accent); }

.field-row .f-type {
  padding: 8px 6px;
  color: var(--text-2);
  cursor: pointer;
}

.field-row .f-value,
.field-row .f-image {
  grid-column: 1 / -1;
}

.field-row .f-value {
  min-height: 38px;
  padding-top: 9px;
  padding-bottom: 9px;
  overflow: hidden;
  resize: none;
}

.f-value.mono-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

/* 图片字段：选图、预览、清除 */
.f-image { display: flex; flex-wrap: wrap; align-items: flex-start; }
.f-image > * + * { margin-left: 6px; }

.f-image-preview { flex-basis: 100%; margin-top: 8px; margin-left: 0 !important; }
.f-image-preview img {
  display: block;
  max-width: 100%;
  max-height: 200px;
  border-radius: 9px;
  background: var(--surface-3);
}

/* Chrome/WebView 支持；不支持时退化为明文，只是编辑时可见 */
.secret-mask { -webkit-text-security: disc; }

.field-tools {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 2px;
}
.field-tools > * + * { margin-left: 4px; }

.chk {
  display: inline-flex;
  align-items: center;
  margin-right: auto;
  padding: 4px 6px;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
}
.chk > * + * { margin-left: 6px; }
.chk input { width: 15px; height: 15px; accent-color: var(--accent); }

/* ---------- AI 与体检 ---------- */
.dlg-warn {
  padding: 10px 12px;
  background: var(--danger-wash);
  border-radius: 9px;
  color: var(--text-2);
  font-size: 12.5px;
}

.ai-out {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 46vh;
  overflow: auto;
}

.audit-wrap { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }

.audit-score {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

.audit-score-num {
  min-width: 66px;
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -2px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.audit-score-num.good { color: #1f9d55; }
.audit-score-num.mid { color: #c77700; }
.audit-score-num.bad { color: var(--danger); }

.audit-score-meta { padding-left: 14px; }
.audit-score-label { font-size: 15px; font-weight: 650; }
.audit-score-sub { margin-top: 2px; font-size: 12px; color: var(--text-3); }

.audit-issues { display: flex; flex-direction: column; }
.audit-issues > * + * { margin-top: 9px; }

.audit-issue {
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border-left: 3px solid var(--text-3);
}
.audit-issue.level-high { border-left-color: var(--danger); }
.audit-issue.level-medium { border-left-color: #c77700; }
.audit-issue.level-low { border-left-color: var(--accent); }

.audit-issue-head { display: flex; align-items: center; }
.audit-level {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.audit-issue.level-high .audit-level { background: var(--danger-wash); color: var(--danger); }

.audit-issue-title { padding-left: 8px; font-size: 14px; font-weight: 600; }
.audit-issue-detail { margin: 6px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.6; }

.audit-issue-items { display: flex; flex-wrap: wrap; margin-top: 8px; }
.audit-issue-items > * + * { margin-left: 5px; margin-top: 4px; }
.audit-issue-items .btn { background: var(--surface); }
.audit-more { color: var(--text-3); font-size: 12px; line-height: 26px; }

.audit-ok { padding: 26px 14px; text-align: center; }
.audit-ok-title { font-size: 15px; font-weight: 650; }
.audit-ok-sub { margin-top: 4px; color: var(--text-3); font-size: 13px; }

.audit-ai { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.audit-ai .ai-out { margin: 12px 0 0; }

/* 看大图 */
.viewer-dialog { width: min(880px, calc(100vw - 24px)); }
.viewer-wrap { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  overflow: auto;
  background: var(--surface-2);
}
.viewer-body img {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  background: var(--surface);
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(23, 26, 32, .94);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--sh-2);
  z-index: 80;
}
.toast.error { background: var(--danger); }

.only-mobile { display: none; }

/* ---------- 移动端 ---------- */
@media (max-width: 880px) {
  .app { height: 100vh; }

  .topbar { padding: 8px 12px; flex-wrap: wrap; }
  .topbar > * + * { margin-left: 8px; }

  .brand { font-size: 15px; }
  .brand-dot { width: 12px; height: 12px; }

  .search-wrap { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; margin-top: 8px; }
  .actions { margin-left: auto; }
  .actions > * + * { margin-left: 2px; }
  .actions .btn { padding: 8px 12px; }
  .menu > summary { padding: 8px 12px; }

  .body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }

  .sidebar {
    flex-direction: row;
    align-items: center;
    padding: 8px 12px 10px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .sidebar > * + * { margin-top: 0; margin-left: 8px; }

  .categories { flex-direction: row; }
  .categories > * + * { margin-top: 0; margin-left: 7px; }

  .category {
    width: auto;
    padding: 6px 12px;
    background: var(--surface);
    border-radius: 999px;
    box-shadow: var(--sh-1);
    white-space: nowrap;
    font-size: 13px;
  }
  .category.active { background: var(--accent-wash); box-shadow: none; color: var(--accent-strong); }
  .category.active .category-count { background: rgba(47, 111, 237, .16); }
  .categories-empty, .sidebar-foot, .sidebar-title { display: none; }

  .content { grid-template-columns: 1fr; }
  .list-pane { border-left: none; }
  .list-head { padding: 14px 16px 4px; }
  .list { padding: 4px 12px 96px; }

  .detail-pane { display: none; padding: 12px 12px 40px; }
  .content.detail-open .list-pane { display: none; }
  .content.detail-open .detail-pane { display: block; }

  .only-mobile { display: inline-flex; }

  .detail { padding: 16px 16px 20px; border-radius: var(--r-lg); }
  .detail-head { gap: 10px; padding-bottom: 14px; }
  .detail-title { font-size: 18.5px; }
  .detail-actions .btn { padding: 6px 11px; font-size: 13px; }
  .kv { padding: 11px 12px; margin-top: 9px; }
  .kv-value { font-size: 14.5px; }

  .dialog { width: calc(100vw - 16px); max-height: calc(100vh - 24px); border-radius: 16px; }
  .dialog form { max-height: calc(100vh - 24px); }
  .dlg-head { padding: 16px 16px 8px; }
  .dlg-body { padding: 4px 16px 14px; }
  .dlg-foot { padding: 12px 16px 16px; }

  .field-row { grid-template-columns: 1fr; }
  .field-tools { grid-column: 1; }
}
