:root {
  --bg: #f5f6f3;
  --card: #ffffff;
  --ink: #1d2019;
  --ink-2: #5b6157;
  --ink-3: #8d938a;
  --line: #e4e6df;
  --brand: #3f6f3a;
  --brand-soft: #eaf3de;
  --out: #c0392b;      /* 支出：红 */
  --in: #1f9248;       /* 收入：绿 */
  --warn: #b4741a;
  --warn-soft: #fdf3e0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 25, 15, .05), 0 6px 18px rgba(20, 25, 15, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15170f;
    --card: #1f221a;
    --ink: #eceee6;
    --ink-2: #b3b8ab;
    --ink-3: #83897c;
    --line: #33372c;
    --brand: #8fbe7f;
    --brand-soft: #26301f;
    --out: #ff7b6b;
    --in: #5fd08a;
    --warn: #e0a94e;
    --warn-soft: #322818;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  /* 微信 / iOS 会按系统字体大小自动放大文字，放大后控件固有宽度撑破栅格、互相压住 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }

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

/* 顶部 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .inner {
  max-width: 760px; margin: 0 auto; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: .3px; white-space: nowrap; }
.brand small { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.spacer { flex: 1; min-width: 0; }

.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex: none; }
.tabs a {
  padding: 4px 12px; border-radius: 8px; font-size: 14px; color: var(--ink-2);
  white-space: nowrap;
}
.tabs a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
#who { display: flex; align-items: center; gap: 6px; flex: none; }
#who .btn { padding: 3px 7px; }

/* 卡片 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-top: 14px;
}

h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; }
h2 .sub { font-weight: 400; color: var(--ink-3); font-size: 13px; margin-left: 8px; }

/* 上传区 */
.drop {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 26px 16px; text-align: center; cursor: pointer;
  transition: .15s; background: var(--bg);
}
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .big { font-size: 30px; line-height: 1; margin-bottom: 8px; }
.drop .t { font-size: 14px; color: var(--ink-2); }
.drop .hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 10px; }
.filters + .row { margin-top: 12px; }   /* 筛选控件和快捷标签之间留白 */
.row > input, .row > select { flex: 1 1 120px; min-width: 0; }

input[type="text"], input[type="date"], input[type="password"], select, input[type="number"] {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }

.btn {
  font: inherit; font-size: 14px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; transition: .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #10200c; } }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg); }
/* 当前生效的快捷筛选标签 */
.btn.active {
  background: var(--brand-soft); border-color: var(--brand);
  color: var(--brand); font-weight: 600;
}

/* 进度 */
.progress { margin-top: 12px; display: none; }
.progress.show { display: block; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s; }
.progress .meta { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

/* 结果流 */
.feed { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.item {
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden;
}
.item .head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
}
.item .head:hover { background: var(--bg); }
.thumb {
  width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex: none;
  background: var(--bg); border: 1px solid var(--line);
}
.item .fname { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .stat { font-size: 12px; color: var(--ink-3); }
.item .amt { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }

.pill {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--ink-3); vertical-align: 1px; white-space: nowrap;
}
.pill.ok { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.dup { background: var(--bg); }

/* 明细表 */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 7px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { font-size: 12px; color: var(--ink-3); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--bg); }
tbody tr.pending td.seq { box-shadow: inset 3px 0 0 var(--warn); }
.out { color: var(--out); }
.in { color: var(--in); }
.muted { color: var(--ink-3); font-size: 12px; }
.cp { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.ops { white-space: nowrap; text-align: right; }
td.ops .btn { padding: 4px 5px; }

/* 汇总 */
.sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.sum .k { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.sum .k .lbl { font-size: 12px; color: var(--ink-3); }
.sum .k .v { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.sum .k .v small { font-size: 12px; font-weight: 400; color: var(--ink-3); }

.cats { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.cat { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.cat .n { width: 76px; color: var(--ink-2); flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat .b { flex: 1 1 0; min-width: 0; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.cat .b > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.cat .v { width: 74px; text-align: right; font-variant-numeric: tabular-nums; flex: none; }

.empty { text-align: center; color: var(--ink-3); padding: 34px 10px; font-size: 14px; }
/* 原图放大 */
.lightbox-mask {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .4);
  display: flex; align-items: flex-end; justify-content: center;
}
.lightbox {
  position: fixed; inset: 0; z-index: 500; background: rgba(0, 0, 0, .88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px; cursor: zoom-out;
}
.lightbox img {
  max-width: 100%; max-height: 86vh; object-fit: contain;
  border-radius: 8px; background: #fff;
}
.lightbox-cap { color: #ddd; font-size: 13px; text-align: center; }

/* 设置页 */
.col-head { display: flex; align-items: baseline; gap: 10px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.col-grid { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.col-grid label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.col-grid input { accent-color: var(--brand); width: 16px; height: 16px; }
.col-grid label.off { opacity: .45; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.switch input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
/* 登录：卡片与其他页一致，表单控件同宽同高 */
.login-card { max-width: 560px; margin: 40px auto; }
/* 作者样式里的 display 会盖掉 [hidden] 的 display:none，统一钉死 */
[hidden] { display: none !important; }

.login-form { display: grid; grid-template-columns: 1fr; gap: 12px; }
.login-form input, .login-form .btn {
  width: 100%; height: 44px; font-size: 15px; border-radius: 10px;
  padding: 0 14px; box-sizing: border-box;
}
.login-form input {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.login-form .btn { border: 1px solid var(--brand); }

/* 筛选区：桌面「关键词 + 时间」一行、「方向 / 分类 / 状态」一行，两行按列对齐；
   小屏两列，搜索独占一行、日期两两并排。控件统一 36px 高。 */
.filters {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 12px;
  align-items: end;
}
.filters label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filters label > span { font-size: 12px; color: var(--ink-3); line-height: 1; }
.filters input, .filters select {
  width: 100%; min-width: 0; height: 36px; padding: 6px 9px; font: inherit; font-size: 14px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 9px;
}
/* iOS / 微信里的日期控件是原生控件：宽度按系统固有值撑开、高度也不听我们的，
   会直接溢出卡片右边。appearance:none 把它打回普通输入框，尺寸完全由 CSS 说了算；
   点上去照样弹系统日期选择器，不影响使用。 */
.filters input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%; max-width: 100%; min-width: 0;
  overflow: hidden;
}
/* WebKit 把日期文字放在这个伪元素里，默认居中且自带固有宽度（iOS 上就是它撑破卡片的） */
.filters input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-width: 0;
}
.filters input[type="date"]::-webkit-datetime-edit { min-width: 0; overflow: hidden; }

/* 没有搜索框的页面（统计）三列等宽 */
.filters.even { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 卡片头部：标题在左，动作在右 */
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

/* 筛选卡片底部：快捷区间 + 有误 + 清空，和上面用一条线隔开 */
.filter-foot {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.qchips { display: flex; gap: 6px; flex-wrap: wrap; }

/* Safari / iOS 的日历按钮是 input 内部的 flex 子项，字段变窄时会被压缩，
   压到日期文字上（看着像「日期和图标重叠」）。钉死它的大小、让它自己靠右，
   宁可文字被裁也不和图标叠在一起。 */
.filters input[type="date"]::-webkit-calendar-picker-indicator {
  flex: none;
  margin-left: auto;
}

/* 多选下拉：和筛选区的 input/select 同高同宽 */
.filters .ms { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ms-label { font-size: 12px; color: var(--ink-3); }
.ms-btn {
  width: 100%; height: 36px; padding: 6px 9px; font: inherit; font-size: 14px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 9px;
  display: flex; align-items: center; gap: 6px; text-align: left; cursor: pointer;
}
.ms-btn:hover { border-color: var(--ink-3); }
.ms.on .ms-btn { border-color: var(--brand); background: var(--brand-soft); }
.ms-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-caret { color: var(--ink-3); font-size: 11px; flex: none; }
.ms-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  width: max-content; min-width: 132px; max-width: min(240px, 80vw);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(20, 25, 15, .14);
  padding: 6px; max-height: 260px; overflow: auto;
}
.ms-pop[hidden] { display: none; }
.ms-opts { display: flex; flex-direction: column; gap: 2px; }
/* 覆盖 .filters label 的纵向排列，复选框和文字必须同一行 */
.ms-opts label,
.filters .ms-opts label {
  display: flex; flex-direction: row; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 7px; cursor: pointer;
  font-size: 14px; white-space: nowrap;
}
.ms-opts label:hover { background: var(--bg); }
.ms-opts label:has(input:checked) { background: var(--brand-soft); color: var(--brand); }
.ms-opts input { width: 15px; height: 15px; margin: 0; flex: none; accent-color: var(--brand); }
.ms-opts .ms-empty { padding: 8px; color: var(--ink-3); font-size: 12px; }
.ms-actions { display: flex; gap: 6px; border-top: 1px solid var(--line); margin-top: 5px; padding: 7px 2px 1px; }
.ms-actions button {
  font: inherit; font-size: 12px; padding: 3px 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); border-radius: 6px;
}
.ms-actions button:hover { border-color: var(--brand); color: var(--brand); }

/* 序号与有误标记 */
td.seq, th.seq { width: 40px; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: center; }
tbody tr.flagged { background: var(--warn-soft); }
.pill.err { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.flag-btn.marked { color: var(--warn); }

/* 置信度：一条细进度条 + 百分比，颜色分三档，扫一眼就知道哪笔虚 */
.conf { white-space: nowrap; }
.conf-bar {
  display: inline-block; vertical-align: middle; width: 16px; height: 4px;
  background: var(--line); border-radius: 3px; overflow: hidden;
}
.conf-bar i { display: block; height: 100%; border-radius: 3px; background: var(--ink-3); }
.conf-bar.hi i { background: var(--in); }
.conf-bar.mid i { background: var(--warn); }
.conf-bar.lo i { background: var(--out); }
.conf b, .conf-pct {
  font-size: 11px; font-variant-numeric: tabular-nums; margin-left: 3px;
  color: var(--ink-2); font-weight: 600;
}
.conf b.hi, .conf-pct.hi { color: var(--in); }
.conf b.mid, .conf-pct.mid { color: var(--warn); }
.conf b.lo, .conf-pct.lo { color: var(--out); }
/* 识别来源：OCR=本地规则（有真实分值）；模型=大模型兜底（没有分值，必人工） */
.src-tag {
  display: inline-block; margin-left: 3px; padding: 0 2px; border-radius: 4px;
  font-size: 9px; line-height: 13px; vertical-align: 1px; cursor: help; white-space: nowrap;
}
.src-tag.ocr { background: var(--bg); color: var(--ink-3); }
.src-tag.llm { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.conf-na { color: var(--ink-3); font-size: 12px; }
/* 已确认的来源：绿色=人工核对过，灰色=解析器自动判的（工具提示里有说明） */
.pill.auto { background: var(--bg); color: var(--ink-3); border-color: var(--line); }
/* 弹窗里空间够，进度条放大一点，方便对着截图判断 */
.conf-line .conf-bar { width: 64px; height: 6px; }
.conf-line .conf-pct { font-size: 13px; margin-right: 8px; }
textarea {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; resize: vertical;
}
textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.flag-note {
  background: var(--warn-soft); color: var(--warn); border-radius: 9px;
  padding: 8px 10px; font-size: 13px; margin-bottom: 12px;
}

/* 修改弹窗：上方大图，下方字段，方便对着截图核对 */
.edit-photo {
  margin: 0 -16px 14px; background: var(--bg);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.edit-photo-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 16px;
}
.edit-photo-scroll {
  max-height: 46vh; overflow: auto; -webkit-overflow-scrolling: touch;
  background: var(--card);
}
.edit-photo-scroll img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.ocr-details { padding: 4px 16px 8px; }
.ocr-details summary { cursor: pointer; font-size: 12px; color: var(--ink-3); list-style: none; }
.ocr-details summary::before { content: "▸ "; }
.ocr-details[open] summary::before { content: "▾ "; }
.ocr-meta { color: var(--ink-3); }
.ocr-details .ocr-box {
  margin-top: 6px; max-height: 42vh; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
  font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink-2);
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px;
}
.ocr-ops { display: flex; justify-content: flex-end; margin-top: 4px; }

/* 统计页 */
.pie-layout { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { flex: none; }
.donut-t1 { fill: var(--ink-3); font-size: 10px; }
.donut-t2 { fill: var(--ink); font-size: 14px; font-weight: 700; }
.legend { flex: 1 1 260px; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 3px 0; }
.legend-row i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-row .n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-row .pct { width: 44px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .pie-layout { justify-content: center; } .legend { width: 100%; } }

.chart { display: flex; align-items: flex-end; gap: 4px; height: 180px; overflow-x: auto; padding-top: 8px; }
.bar-col { flex: 1 1 26px; min-width: 26px; max-width: 60px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-val { font-size: 11px; color: var(--ink-3); margin-bottom: 3px; white-space: nowrap; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 3px; }
.bar-label { font-size: 11px; color: var(--ink-3); margin-top: 5px; white-space: nowrap; }

@media (max-width: 420px) {
  #who .pill { display: none; }        /* 极窄屏只留退出按钮 */
  .tabs a { padding: 4px 8px; font-size: 12px; }
  .topbar .inner { gap: 5px; padding: 9px 8px; }
}

@media (max-width: 640px) {
  .filters, .filters.even { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .filters .fld-search, .filters .span-full-sm { grid-column: 1 / -1; }
  /* 手机上开始 / 结束各占一整行：日期控件的固有宽度在 iOS / 微信里收不窄，
     并排时两个框会互相压住，独占一行就彻底没这个问题，手指也更好点。 */
  .filters .fld-date { grid-column: 1 / -1; }
  /* 小屏弹层改成和控件同宽左对齐，既不溢出屏幕也不会挡住右边 */
  .ms-pop { left: 0; right: auto; width: 100%; min-width: 0; max-width: none; }
  .edit-photo-scroll { max-height: 40vh; }
}

/* 设置页页内标签 */
.subtabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin-top: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px;
}
.subtabs button {
  flex: none; font: inherit; font-size: 14px; padding: 6px 12px; border: 0;
  border-radius: 8px; background: transparent; color: var(--ink-2);
  cursor: pointer; white-space: nowrap;
}
.subtabs button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tab-pane[hidden] { display: none; }

/* 分类折叠：默认只显示一行，点开才编辑 */
.cat-editor { border: 1px solid var(--line); border-radius: 11px; margin-top: 8px; }
.cat-editor summary {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer; list-style: none;
}
.cat-editor summary::-webkit-details-marker { display: none; }
.cat-editor summary::before { content: "▸"; color: var(--ink-3); font-size: 11px; }
.cat-editor[open] summary::before { content: "▾"; }
.cat-editor summary .n { font-weight: 600; }
.cat-editor summary .muted:last-of-type { margin-left: auto; }
.cat-body { padding: 0 12px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
/* 备份列表：一行一份，时间在左、操作在右，窄屏自动换行 */
.bk-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.bk-row:last-child { border-bottom: 0; }
.bk-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bk-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.bk-ops a.btn { text-decoration: none; }

/* 备份设置里的「每天 02:00 / 保留 7 份」：整体换行，单位不会单独掉到下一行 */
.bk-fld { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.bk-fld input[type="time"] { width: 122px; }
.bk-fld input[type="number"] { width: 68px; }

/* 账号列表 */
.user-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.user-row:last-child { border-bottom: 0; }
.user-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.user-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.user-ops { display: flex; gap: 6px; flex-wrap: wrap; }

/* 操作日志：时间 / 谁 / 动作 / 详情 */
.audit-row {
  display: grid; grid-template-columns: 132px 72px 92px minmax(0, 1fr);
  gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line);
  font-size: 12px; align-items: baseline;
}
.audit-row:last-child { border-bottom: 0; }
.audit-at { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.audit-who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-act { color: var(--brand); white-space: nowrap; }
.audit-detail { color: var(--ink-2); word-break: break-word; }

@media (max-width: 640px) {
  /* 手机上改成「时间 谁 · 动作」一行、详情换行，比四列硬挤好读 */
  .audit-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  .audit-at { font-size: 11px; }
  .audit-who::after { content: "·"; margin-left: 7px; color: var(--ink-3); }
  .audit-detail { flex-basis: 100%; }
}

/* 开关行：整行可点 */
.switch-row {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 14px;
}
.switch-row input { width: 16px; height: 16px; margin: 0; flex: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px 3px 9px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px; font-size: 12px;
}
.chip button { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.chip button:hover { color: var(--out); }
.keyword-add { display: flex; gap: 6px; margin-top: 10px; }
.keyword-add input { flex: 1; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pager .info { color: var(--ink-3); font-size: 12px; margin-right: auto; }
.pager .btn { min-width: 34px; text-align: center; }
.pager .btn.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .pager .btn.cur { color: #10200c; } }
.legend-line { margin-top: 8px; font-size: 11px; color: var(--ink-3); line-height: 1.6; }

/* 导出对话框里的二选一：整行可点，选项说明跟在标题下面 */
.opt {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; background: var(--card);
}
.opt + .opt { margin-top: 8px; }
.opt input { margin: 3px 0 0; flex: none; }
.opt > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.opt b { font-weight: 600; font-size: 14px; }
.opt .muted { font-size: 12px; line-height: 1.55; }
.opt:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--card)); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--bg); padding: 9px 18px; border-radius: 22px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .22s; z-index: 600;
  max-width: 86vw;
}
.toast.show { opacity: .95; transform: translateX(-50%) translateY(0); }

/* 手机端 */
@media (max-width: 560px) {
  .wrap { padding: 0 10px 96px; }
  .topbar .inner { padding: 9px 10px; gap: 6px; }
  .brand { font-size: 15px; }
  .brand small { display: none; }          /* 窄屏只留「记一笔」，给标签腾地方 */
  .tabs a { padding: 4px 10px; font-size: 13px; }
  .sum { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .sum .k { padding: 9px; }
  .sum .k .v { font-size: 17px; }
  th, td { padding: 8px 4px; font-size: 12px; }
  .hide-sm { display: none; }
  .cp { max-width: 88px; }
  .pill { font-size: 10px; padding: 1px 5px; }
  td.ops .btn { padding: 3px 5px; font-size: 12px; }
}
