/* =====================================================================
   申诉台 · Case Desk
   案卷台账的感觉:暖色纸面、墨色文字、Bumble 黄只当荧光笔用,
   结果用「盖章」表示。标题用宋体,号码 / 金额用等宽字。
   ===================================================================== */
:root {
  color-scheme: light;
  --paper: #f3efe4;
  --paper-2: #fbf9f3;
  --paper-3: #ebe5d5;
  --ink: #1d1a14;
  --ink-2: #4a4538;
  --muted: #827a66;
  --rule: #d6cdb6;
  --rule-soft: #e6dfcd;
  --hl: #ffcf33;
  --hl-soft: #fff0b8;
  --hl-ink: #5a4300;
  --ok: #1f6f3b;  --ok-bg: #e2eedf;  --ok-line: #9cc7a3;
  --err: #a8281d; --err-bg: #f5e0da; --err-line: #e0a69c;
  --warn: #935600; --warn-bg: #f7e8c8; --warn-line: #e2b664;
  --gray: #66625a; --gray-bg: #e9e5dc; --gray-line: #c9c3b6;
  --boost: #8a4b00; --prem: #5b3aa8; --plus: #0c6b58;
  --shadow: 0 1px 0 rgba(60, 45, 10, .05), 0 10px 30px -12px rgba(60, 45, 10, .25);
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --rail-w: 232px;
  --radius: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  /* 反色块(深底浅字):浅色模式是墨色,深色模式改成比纸面略亮的深色,免得变成一大块亮白 */
  --inv: #1d1a14; --inv-hover: #3a352a; --inv-ink: #f3efe4; --inv-muted: #b9b19c; --inv-sub: #cfc7b5;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #15130f;
    --paper-2: #1d1a15;
    --paper-3: #26221b;
    --ink: #f1ece0;
    --ink-2: #cfc7b5;
    --muted: #8f8775;
    --rule: #3b352a;
    --rule-soft: #2b271f;
    --hl-soft: #3d3313;
    --hl-ink: #ffd95a;
    --ok: #86d49c;  --ok-bg: #18301f;  --ok-line: #2f6a40;
    --err: #ff9a8c; --err-bg: #3a1c17; --err-line: #7c3328;
    --warn: #f3c06a; --warn-bg: #352812; --warn-line: #7a5a1c;
    --gray: #b4ae9f; --gray-bg: #2a2721; --gray-line: #4a453b;
    --boost: #f0a857; --prem: #b9a2f0; --plus: #7fcdb8;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 34px -14px rgba(0, 0, 0, .7);
    --inv: #332d20; --inv-hover: #423a29; --inv-ink: #f1ece0; --inv-muted: #a39a85; --inv-sub: #c9c0ad;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--paper); color: var(--ink);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* 纸面颗粒 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--hl); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--rule);
  background: var(--paper-2); color: var(--ink); font-weight: 500; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ink { background: var(--inv); color: var(--inv-ink); border-color: var(--inv); }
.btn-ink:hover { background: var(--inv-hover); border-color: var(--inv-hover); }
.btn-hl { background: var(--hl); color: #1d1a14; border-color: #e3b20f; font-weight: 700; }
.btn-hl:hover { background: #ffd84f; border-color: #c99c00; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--err); border-color: var(--err-line); background: transparent; }
.btn-danger:hover { background: var(--err-bg); border-color: var(--err); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.busy::after {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
select, input[type="text"], input[type="search"] {
  height: 36px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper-2);
  padding: 0 10px; min-width: 0; font-size: 14px;
}
select { padding-right: 26px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23827a66' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 14px; }
input:focus, select:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl) 45%, transparent); }

/* ---------- 登录 ---------- */
.login { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); animation: rise .5s var(--ease) both; }
.login-title { font: 900 64px/1 var(--serif); margin: 22px 0 8px; letter-spacing: .04em; }
.login-title::after { content: ""; display: block; width: 92px; height: 12px; margin-top: -18px; margin-left: -4px; background: var(--hl); transform: skew(-12deg); z-index: -1; position: relative; }
.login-sub { color: var(--ink-2); margin: 18px 0 28px; }
.login form { display: grid; gap: 10px; }
.login label { font-weight: 700; font-size: 13px; }
.login input { height: 44px; font-family: var(--mono); font-size: 15px; }
.login .btn { height: 44px; margin-top: 4px; font-size: 15px; }
.login-msg { color: var(--err); margin: 0; min-height: 1.4em; font-size: 13px; }

/* ---------- 整体布局 ---------- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  padding: 22px 16px 18px; border-right: 1px solid var(--rule);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 6px 20px; border-bottom: 3px double var(--rule); }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--hl); position: relative; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; left: 9px; right: 9px; height: 3px; border-radius: 2px; background: #1d1a14; }
.brand-mark::before { top: 11px; box-shadow: 0 6px 0 #1d1a14; }
.brand-mark::after { top: 23px; right: 15px; }
.brand-title { font: 900 22px/1.1 var(--serif); letter-spacing: .06em; }
.nav { display: grid; gap: 2px; margin-top: 18px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 8px;
  text-decoration: none; color: var(--ink-2); font-weight: 500; position: relative;
}
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item.active { color: var(--ink); font-weight: 700; }
.nav-item.active .nav-label { background: linear-gradient(transparent 55%, var(--hl) 55%, var(--hl) 90%, transparent 90%); padding: 0 2px; }
@media (prefers-color-scheme: dark) {
  .nav-item.active .nav-label { background: var(--hl); color: #1d1a14; border-radius: 3px; padding: 0 4px; }
}
.nav-item.active::before { content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px; background: var(--ink); border-radius: 0 3px 3px 0; }
.nav-count { margin-left: auto; font: 500 12px var(--mono); color: var(--muted); }
.nav-count.alert { color: var(--warn); font-weight: 600; }
.sync { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--rule-soft); font-size: 12px; color: var(--muted); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-line); flex: none; }
.sync[data-state="ok"] .sync-dot { background: #3fa65a; box-shadow: 0 0 0 3px color-mix(in srgb, #3fa65a 22%, transparent); }
.sync[data-state="busy"] .sync-dot { background: var(--hl); animation: pulse 1s ease-in-out infinite; }
.sync[data-state="error"] .sync-dot { background: var(--err); }
.sync[data-state="error"] { color: var(--err); }
@keyframes pulse { 50% { transform: scale(.6); opacity: .6; } }

.main { min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 60px; }
.view { display: none; max-width: 1280px; }
.view.active { display: block; animation: fade .3s var(--ease) both; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--ink); margin-bottom: 16px; }
.view-head h1 { font: 900 clamp(26px, 3.4vw, 36px)/1.1 var(--serif); margin: 0; letter-spacing: .03em; }
.view-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- 状态计数条(也是筛选) ---------- */
.tally { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); overflow: hidden; margin-bottom: 14px; }
.tally-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tally button {
  border: 0; border-right: 1px solid var(--rule-soft); background: transparent; text-align: left;
  padding: 10px 14px 11px; display: grid; gap: 2px; position: relative; min-width: 0;
}
.tally button:last-child { border-right: 0; }
.tally button:hover { background: var(--paper-3); }
.tally .t-label { font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tally .t-num { font: 600 24px/1.1 var(--mono); letter-spacing: -.02em; }
.tally button[data-tone="ok"] .t-num { color: var(--ok); }
.tally button[data-tone="err"] .t-num { color: var(--err); }
.tally button[data-tone="warn"] .t-num { color: var(--warn); }
.tally button[data-tone="gray"] .t-num { color: var(--gray); }
.tally button.active { background: var(--hl-soft); }
.tally button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--ink); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.search { position: relative; flex: 1 1 260px; display: flex; align-items: center; }
.search svg { position: absolute; left: 10px; color: var(--muted); width: 16px; height: 16px; }
.search input { width: 100%; padding-left: 34px; }
.toolbar select { flex: 0 1 170px; }
.ledger-meta { font-size: 12px; color: var(--muted); margin: 4px 2px 8px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- 台账(记录列表) ---------- */
.ledger { border-top: 1px solid var(--rule); }
.ledger-head, .row {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 100px minmax(130px, 1fr) minmax(150px, 1.3fr) minmax(80px, .9fr) 140px 96px var(--tw, 86px) 24px;
  padding: 0 10px;
}
.ledger { container-type: inline-size; container-name: ledger; }
@container ledger (max-width: 920px) {
  .ledger-head, .row { grid-template-columns: 100px minmax(130px, 1fr) minmax(150px, 1.3fr) 140px 96px var(--tw, 86px) 24px; }
  .c-nick, .ledger-head .h-nick { display: none; }
}
@container ledger (max-width: 820px) {
  .ledger-head, .row { grid-template-columns: 96px minmax(120px, 1fr) minmax(130px, 1.3fr) 132px var(--tw, 80px) 20px; gap: 10px; }
  .c-mail, .ledger-head .h-mail { display: none; }
}
.ledger-head { height: 34px; font: 600 12px var(--mono); letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--rule); text-transform: uppercase; }
.row {
  min-height: 52px; border-bottom: 1px solid var(--rule-soft); position: relative; cursor: pointer;
  animation: rise .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 14ms);
}
.row:hover { background: var(--paper-2); }
.row.selected { background: var(--hl-soft); }
.row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.row[data-status="processing"]::before { background: var(--warn-line); }
.row[data-status="unblocked"]::before { background: var(--ok-line); }
.row[data-status="rejected"]::before { background: var(--err-line); }
.row[data-status="not_found"]::before { background: var(--gray-line); }
.c-phone { display: flex; align-items: center; gap: 6px; min-width: 0; }
.c-phone .mono { font-size: 14.5px; font-weight: 500; white-space: nowrap; }
.hist { font: 600 12px var(--mono); color: var(--muted); border: 1px solid var(--rule); border-radius: 99px; padding: 0 6px; line-height: 17px; white-space: nowrap; }
/* 不在这里 overflow:hidden:里面的 .cell-edit / .cell-input 用负 margin 往外伸 7px,还有聚焦光圈,会被裁掉。省略号由 .cell-edit 自己处理 */
.c-email { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.c-nick { font-size: 13px; white-space: nowrap; }
.c-nick.empty, .c-email.empty { color: var(--muted); }
.ledger.abs-time { --tw: 128px; }
.c-time { font: 12px var(--mono); color: var(--muted); white-space: nowrap; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* 点时间切换完整 / 相对 */
.tt { cursor: pointer; border-bottom: 1px dotted transparent; transition: border-color .15s var(--ease), color .15s var(--ease); }
.tt:hover { color: var(--ink); border-bottom-color: currentColor; }
/* 可点的表头 */
.h-sort { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; min-width: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; padding: 4px 0; border-radius: 4px; }
.h-sort i { font-style: normal; opacity: .35; transition: opacity .15s var(--ease); }
.h-sort:hover { color: var(--ink); }
.h-sort:hover i { opacity: .8; }
.h-sort.on { color: var(--ink); }
.h-sort.on i { opacity: 1; color: var(--hl-ink); }
.h-sort:focus-visible { outline: 2px solid var(--hl); outline-offset: 2px; }
.h-time { justify-content: flex-end; }
.sort-m { display: none; gap: 6px; }
.toolbar #ap-sort { flex: 0 0 auto; }
.c-open { color: var(--muted); display: grid; place-items: center; }
.row:hover .c-open { color: var(--ink); }

/* 盖章式状态 */
.stamp, .stamp-select {
  font: 700 12px/1 var(--sans); letter-spacing: .12em; text-align: center;
  border: 1.5px solid currentColor; border-radius: 5px; padding: 5px 8px 5px 10px; white-space: nowrap;
  background: transparent; display: inline-block;
}
.stamp-select { height: 28px; width: 92px; padding: 0 20px 0 9px; background-position: right 4px center; background-size: 12px; text-align: left; }
.stamp-select option { color: var(--ink); background: var(--paper-2); letter-spacing: 0; }
[data-tone="ok"].stamp, .stamp-select[data-status="unblocked"] { color: var(--ok); background-color: var(--ok-bg); }
[data-tone="err"].stamp, .stamp-select[data-status="rejected"] { color: var(--err); background-color: var(--err-bg); }
[data-tone="warn"].stamp, .stamp-select[data-status="processing"] { color: var(--warn); background-color: var(--warn-bg); }
[data-tone="gray"].stamp, .stamp-select[data-status="not_found"] { color: var(--gray); background-color: var(--gray-bg); }
[data-tone="info"].stamp { color: var(--ink-2); background-color: var(--paper-3); }
.mem-select { height: 28px; font-size: 12.5px; width: 100%; padding: 0 22px 0 8px; border-color: transparent; background-color: transparent; }
.mem-select:hover { border-color: var(--rule); }
.mem-select[data-group="Boost"] { color: var(--boost); font-weight: 600; }
.mem-select[data-group="Premium"] { color: var(--prem); font-weight: 600; }
.mem-select[data-group="Premium+"] { color: var(--plus); font-weight: 600; }
.mem-select[data-group="none"] { color: var(--muted); }
.mail-tag { font-size: 12px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; color: var(--ink-2); }
.mail-tag::before { content: ""; width: 7px; height: 7px; border-radius: 2px; transform: rotate(45deg); flex: none; background: var(--gray-line); }
.mail-tag[data-tone="ok"]::before { background: var(--ok); }
.mail-tag[data-tone="err"]::before { background: var(--err); }
.mail-tag[data-tone="warn"]::before { background: var(--warn); }
.mail-tag.none { color: var(--muted); }
.mail-tag.none::before { background: transparent; border: 1px solid var(--gray-line); }

.empty-state { padding: 56px 16px; text-align: center; color: var(--muted); }
.empty-state .btn { margin-top: 12px; }
.empty-state b { display: block; font: 900 20px var(--serif); color: var(--ink-2); margin-bottom: 6px; }
.more-btn { display: flex; margin: 14px auto 0; }

/* ---------- 申诉结果:信件卡片 ---------- */
.notice { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border: 1px dashed var(--warn-line); background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); margin-bottom: 12px; font-size: 13px; }
.notice span { flex: 1; }
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 12px; }
.letter {
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px 12px;
  display: flex; flex-direction: column; gap: 8px; position: relative; box-shadow: var(--shadow);
  animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms);
}
.letter { min-width: 0; }
.letter-top { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.letter-phone .mono { min-width: 0; overflow-wrap: anywhere; }
.letter .stamp { transform: rotate(-3deg); font-size: 13px; padding: 6px 10px 6px 12px; letter-spacing: .18em; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 25%, transparent); }
.letter-id { min-width: 0; flex: 1; }
.letter-phone { display: flex; align-items: center; gap: 6px; }
.letter-phone .mono { font-size: 17px; font-weight: 600; }
.letter-phone .none { color: var(--muted); font-size: 13px; }
.letter-mail { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.letter-time { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.letter-reason { font: 600 15px/1.55 var(--serif); color: var(--ink); padding: 8px 0 2px; border-top: 1px solid var(--rule-soft); }
.letter-meta { font: 12px/1.6 var(--mono); color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.letter-link { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 9px; border-top: 1px dashed var(--rule); font-size: 12.5px; }
.letter-link .rec { color: var(--ink-2); }
.letter-link .rec b { color: var(--ink); }
.letter-link .spacer { flex: 1; }
.letter-link .ok { color: var(--ok); font-weight: 700; }
.letter-link .warn { color: var(--warn); flex-basis: 100%; }
/* 回信入口:卡片底部一条,点开抽屉;卡片自己不变高 */
.letter { transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease); }
.letter.is-open { border-color: var(--hl); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl) 35%, transparent), var(--shadow); }
.letter-thread {
  margin-top: auto; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 1px solid var(--rule-soft); border-radius: 9px; background: var(--paper); color: var(--ink-2);
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.letter-thread:hover { background: var(--paper-3); border-color: var(--rule); color: var(--ink); }
.letter.is-open .letter-thread { border-color: var(--hl); background: var(--hl-soft); color: var(--ink); }
.lt-icon svg { width: 18px; height: 18px; display: block; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lt-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.lt-main b { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.lt-main span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-arrow svg { width: 16px; height: 16px; display: block; stroke: currentColor; fill: none; stroke-width: 2; transition: transform .2s var(--ease); }
.letter-thread:hover .lt-arrow svg { transform: translateX(3px); }
.mail-body { margin-top: 8px; padding: 10px 12px; background: var(--paper); border-left: 3px solid var(--rule); border-radius: 0 6px 6px 0; font-size: 12.5px; line-height: 1.65; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow-y: auto; }
.mail-body + .mail-body { margin-top: 6px; }
.mail-body .mh { display: block; font: 12px var(--mono); color: var(--muted); margin-bottom: 4px; }
.icon-btn { width: 28px; height: 28px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--paper-3); color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; }

/* ---------- 统计 ---------- */
.st-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr); gap: 14px; margin-bottom: 14px; }
.st-big { background: var(--inv); color: var(--inv-ink); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px 24px; position: relative; overflow: hidden; }
.st-big::after { content: "¥"; position: absolute; right: -10px; bottom: -48px; font: 900 180px/1 var(--serif); color: rgba(255, 207, 51, .12); }
.st-big .lbl { font: 600 13px var(--sans); letter-spacing: .04em; color: var(--inv-muted); }
.st-big .amt { font: 600 clamp(36px, 5vw, 54px)/1.05 var(--mono); color: var(--hl); margin: 12px 0 6px; letter-spacing: -.03em; }
.st-big .sub { font-size: 13px; color: var(--inv-sub); }
.st-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); }
.st-card { padding: 18px 18px 16px; border-right: 1px solid var(--rule-soft); display: grid; align-content: start; gap: 4px; }
.st-card:last-child { border-right: 0; }
.st-card .lbl { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.st-card .lbl::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.st-card .amt { font: 600 26px/1.15 var(--mono); color: var(--c); letter-spacing: -.02em; }
.st-card .sub { font-size: 12px; color: var(--muted); }
.st-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--paper-3); margin: 4px 0 8px; }
.st-bar span { display: block; height: 100%; }
.st-notes { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 18px; }
.st-notes .warn { color: var(--warn); }
.st-table { width: 100%; border-collapse: collapse; background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; font-size: 13px; }
.st-table th { text-align: left; font: 600 12px var(--mono); letter-spacing: .1em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--rule); background: var(--paper-3); }
.st-table td { padding: 10px 14px; border-bottom: 1px solid var(--rule-soft); }
.st-table tr:last-child td { border-bottom: 0; }
.st-table td:not(:first-child), .st-table th:not(:first-child) { text-align: right; font-family: var(--mono); }
.st-table .grp { font-weight: 700; }
.st-caption { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.7; }

/* ---------- 设置 ---------- */
.settings { display: grid; gap: 14px; max-width: 720px; }
.set-block { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; }
.set-block h2 { font: 900 17px var(--serif); margin: 0 0 10px; }
.set-note { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 38px; height: 22px; border-radius: 99px; background: var(--gray-line); position: relative; flex: none; margin-top: 1px; transition: background-color .2s var(--ease); }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch-row input:checked + .switch { background: var(--inv); }
.switch-row input:checked + .switch::after { transform: translateX(16px); background: var(--hl); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--hl); outline-offset: 2px; }
.switch-row small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- 案卷侧页 ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 16, 8, .35); z-index: 30; animation: fade .2s both; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); z-index: 31;
  background: var(--paper-2); border-left: 1px solid var(--rule); box-shadow: -20px 0 50px -20px rgba(0,0,0,.35);
  display: flex; flex-direction: column; animation: slide-in .28s var(--ease) both;
}
.sheet-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--ink); display: flex; align-items: flex-start; gap: 12px; }
.sheet-head h2 { font: 600 22px/1.2 var(--mono); margin: 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.sheet-head .close { margin-left: auto; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px 20px 20px; display: grid; gap: 14px; align-content: start; }
.field { display: grid; gap: 5px; }
.field label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.field input, .field select { height: 40px; width: 100%; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); display: flex; gap: 8px; }
.sheet-foot .grow { flex: 1; }
.sec-title { font: 600 12px var(--mono); letter-spacing: .18em; color: var(--muted); padding-bottom: 6px; border-bottom: 1px solid var(--rule-soft); margin-top: 4px; }
.mini-list { display: grid; gap: 6px; }
.mini-item { display: flex; align-items: center; gap: 10px; font-size: 12.5px; padding: 8px 10px; border: 1px solid var(--rule-soft); border-radius: 8px; background: var(--paper); }
.mini-item .mono { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.mini-item .stamp { font-size: 12px; padding: 3px 6px 3px 8px; }
.mini-item .txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item.link { cursor: pointer; }
.mini-item.link:hover { border-color: var(--rule); }

/* ---------- 对话框 / 提示 ---------- */
.dialog { border: 1px solid var(--rule); border-radius: 14px; background: var(--paper-2); color: var(--ink); padding: 0; width: min(440px, calc(100% - 32px)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(20, 16, 8, .35); }
.dialog-body { padding: 20px; display: grid; gap: 12px; }
.dialog-body h2 { font: 900 20px var(--serif); margin: 0; }
.field-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.dialog-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.toasts { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: var(--inv); color: var(--inv-ink); padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); animation: rise .25s var(--ease) both; }
.toast.err { background: var(--err); color: #fff; }
.toast button { border: 0; background: var(--hl); color: #1d1a14; font-weight: 700; border-radius: 6px; padding: 3px 10px; }
.toast.out { animation: fade .2s reverse both; }
.tabbar { display: none; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 中等宽度:台账去掉几列 ---------- */
@media (max-width: 980px) {
  :root { --rail-w: 76px; }
  .brand { justify-content: center; padding: 0 0 16px; }
  .brand > div, .nav-label, .nav-count, .sync-text { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item.active { background: var(--hl); }
  .nav-item.active::before { display: none; }
  .sync { justify-content: center; }
}

/* ---------- 手机 ---------- */
@media (max-width: 720px) {
  .app { display: block; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .rail { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-right: 0; border-bottom: 1px solid var(--rule); }
  .brand { border: 0; padding: 0; gap: 10px; }
  .brand > div { display: block; }
  .brand-mark { width: 28px; height: 28px; border-radius: 7px; }
  .brand-mark::before, .brand-mark::after { left: 7px; right: 7px; height: 2.5px; }
  .brand-mark::before { top: 8px; box-shadow: 0 5px 0 #1d1a14; }
  .brand-mark::after { top: 18px; right: 12px; }
  .brand-title { font-size: 18px; }
  .nav { display: none; }
  .sync { margin: 0 0 0 auto; border: 0; padding: 0; }
  .sync-text { display: inline; }
  .main { padding: 16px 16px 24px; }
  .view-head { margin-bottom: 12px; }
  .view-head h1 { font-size: 26px; }
  .tally { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tally-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tally-6 button:nth-child(3) { border-right: 0; }
  .tally-6 button:nth-child(-n+3) { border-bottom: 1px solid var(--rule-soft); }
  .tally button { padding: 8px 6px 9px; text-align: center; }
  .tally .t-num { font-size: 19px; }
  .tally .t-label { font-size: 12px; }
  .toolbar select { flex: 1 1 0; }
  .search { flex-basis: 100%; }
  .ledger { border-top: 0; display: grid; gap: 8px; }
  .ledger-head { display: none; }
  .sort-m { display: flex; flex: 1 1 100%; }
  .view-head { flex-wrap: wrap; align-items: flex-end; }
  .view-head h1 { white-space: nowrap; }
  .toolbar #ap-link, .toolbar #ap-range { flex: 1 1 0; min-width: 0; }
  .sort-m select { flex: 1 1 auto; }
  .sort-m .btn { flex: none; }
  .row {
    grid-template-columns: 92px minmax(0, 1fr) auto; grid-template-areas: "status phone open" "email email email" "mem mail time";
    gap: 6px 10px; padding: 12px 12px 10px 14px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); min-height: 0;
  }
  .row::before { top: 12px; bottom: 12px; }
  .c-status { grid-area: status; }
  .c-phone { grid-area: phone; }
  .c-time { grid-area: time; align-self: center; }
  .c-phone .mono { overflow: hidden; text-overflow: ellipsis; }
  .c-email { grid-area: email; }
  .c-nick { display: none; }
  .c-mem { grid-area: mem; }
  .c-mail { grid-area: mail; display: block !important; min-width: 0; }
  .c-open { grid-area: open; }
  .mem-select { width: auto; max-width: 150px; padding-left: 0; }
  .letters { grid-template-columns: minmax(0, 1fr); }
  .letter-time { font-size: 12px; }
  .letter .stamp { font-size: 12px; padding: 5px 7px 5px 9px; }
  .letter-phone .mono { font-size: 15.5px; }
  .st-hero { grid-template-columns: 1fr; }
  .st-cards { grid-template-columns: 1fr; }
  .st-card { border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .st-card:last-child { border-bottom: 0; }
  .st-table th, .st-table td { padding: 9px 10px; }
  .sheet { width: 100%; top: auto; height: 92dvh; border-left: 0; border-top: 1px solid var(--rule); border-radius: 16px 16px 0 0; animation-name: sheet-up; }
  .field-2 { grid-template-columns: 1fr; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--paper-2) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--rule);
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 7px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 500; }
  .tabbar a.active { color: var(--ink); font-weight: 700; }
  .tabbar a.active svg { background: var(--hl); border-radius: 99px; padding: 2px 10px; box-sizing: content-box; color: #1d1a14; }
  .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
  input[type="text"], input[type="search"], select { font-size: 16px; } /* 防止 iOS 聚焦放大 */
  .mem-select, .stamp-select { font-size: 13px; }
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 触屏没有悬停:tap 之后「粘住」的悬停效果在文件末尾统一处理 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ---------- 回信时间线抽屉 ---------- */
.thread-scrim { z-index: 32; background: rgba(12, 10, 6, .42); backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); }
@media (prefers-color-scheme: dark) { .thread-scrim { background: rgba(0, 0, 0, .55); } }
.sheet.thread { z-index: 33; width: min(520px, 100%); animation: drawer-in .32s cubic-bezier(.16, 1, .3, 1) both; }
.sheet.thread.closing { animation: drawer-out .2s cubic-bezier(.4, 0, 1, 1) both; }
.scrim.closing { animation: fade-out .2s both; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawer-out { from { transform: none; } to { transform: translateX(100%); } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
.sheet-grip { display: none; }
.thread-title { min-width: 0; flex: 1; }
.thread-title h2 .none { font: 500 15px var(--sans); color: var(--muted); }
.thread-sub { display: flex; align-items: center; gap: 10px; margin-top: 8px; min-width: 0; }
.thread-sub .stamp { font-size: 12px; padding: 3px 6px 3px 8px; transform: rotate(-3deg); }
.thread-count { font-size: 12.5px; color: var(--muted); white-space: nowrap; margin-left: auto; }
.thread-addr { font-size: 12.5px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline { list-style: none; margin: 0; padding: 18px 20px 24px 18px; flex: 1; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 14px; align-content: start; }
.tl-item { position: relative; padding-left: 26px; animation: rise .36s var(--ease) both; animation-delay: calc(120ms + var(--i, 0) * 45ms); }
.tl-item::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: -14px; width: 2px; background: var(--rule-soft); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 10px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper-2); border: 3px solid var(--gray-line); }
.tl-dot[data-tone="ok"] { border-color: var(--ok); }
.tl-dot[data-tone="err"] { border-color: var(--err); }
.tl-dot[data-tone="warn"] { border-color: var(--warn); }
.tl-item:first-child .tl-dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--hl) 40%, transparent); }
.tl-card { background: var(--paper); border: 1px solid var(--rule-soft); border-radius: 10px; padding: 10px 12px 8px; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.tl-time { font-size: 12px; color: var(--muted); }
.tl-kind { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--gray-bg); color: var(--gray); }
.tl-kind[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.tl-kind[data-tone="err"] { background: var(--err-bg); color: var(--err); }
.tl-kind[data-tone="warn"] { background: var(--warn-bg); color: var(--warn); }
.tl-latest { font: 600 12px var(--mono); letter-spacing: .1em; color: var(--hl-ink); background: var(--hl-soft); padding: 1px 6px; border-radius: 4px; }
.tl-text { font-size: 13px; line-height: 1.7; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-text.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.tl-actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.tl-actions .spacer { flex: 1; }
@media (max-width: 720px) {
  .sheet.thread { top: auto; height: 88dvh; width: 100%; border-left: 0; border-top: 1px solid var(--rule); border-radius: 16px 16px 0 0; box-shadow: 0 -20px 50px -20px rgba(0,0,0,.4); animation-name: drawer-up; }
  .sheet.thread.closing { animation-name: drawer-down; }
  .sheet-grip { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--rule); margin: 8px auto 0; flex: none; }
  .timeline { padding: 14px 14px 20px 12px; }
}
@keyframes drawer-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes drawer-down { from { transform: none; } to { transform: translateY(100%); } }

/* ---------- 新动态铃铛 ---------- */
.bell {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; margin-top: 14px;
  border: 1px dashed var(--rule); border-radius: 8px; background: transparent; color: var(--ink-2); font-weight: 500; position: relative; text-align: left;
}
.bell:hover { background: var(--paper-3); color: var(--ink); }
.bell.has-news { border-style: solid; border-color: var(--hl); background: var(--hl-soft); color: var(--ink); }
.bell-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--err); color: #fff; font: 600 12px/20px var(--mono); text-align: center; }
.bell.has-news svg { animation: ring 1.6s var(--ease) 2; transform-origin: 50% 10%; }
@keyframes ring { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-12deg); } }

/* ---------- 对话框(新动态 / 原邮件) ---------- */
.dialog-wide { width: min(620px, calc(100% - 32px)); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-body .field select { height: 40px; width: 100%; }
.dialog-foot { gap: 8px; padding-top: 4px; }

.news-list { display: grid; gap: 6px; max-height: min(56vh, 460px); overflow-y: auto; }
.news-group { font: 600 12px var(--mono); letter-spacing: .16em; color: var(--muted); padding: 8px 2px 2px; }
.news-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--rule-soft); border-radius: 9px; background: var(--paper); }
.news-item.unread { border-color: var(--hl); box-shadow: inset 3px 0 0 var(--hl); }
.news-item .stamp { font-size: 12px; padding: 3px 6px 3px 8px; }
.news-item .who { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.news-item .who .mono { font-weight: 600; }
.news-item .when { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.news-item .why { grid-column: 2 / 4; font-size: 12px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-item .acts { grid-column: 1 / 4; display: flex; gap: 6px; flex-wrap: wrap; }
.news-empty { padding: 28px 8px; text-align: center; color: var(--muted); }

.dialog-mail { width: min(860px, calc(100% - 32px)); height: min(88vh, 900px); }
.dialog-mail[open] { display: flex; }
.mail-view { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; width: 100%; min-height: 0; }
.mail-head { margin-bottom: -4px; }
.mail-subject { font: 900 20px/1.3 var(--serif); margin: 0; overflow-wrap: anywhere; }
.mail-headers { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; padding: 10px 12px; border: 1px solid var(--rule-soft); border-radius: 9px; background: var(--paper); font-size: 12.5px; }
.mail-headers dt { font: 600 12px/1.8 var(--mono); letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.mail-headers dd { margin: 0; overflow-wrap: anywhere; line-height: 1.6; min-width: 0; }
.mail-headers .hv { all: unset; box-sizing: border-box; cursor: copy; display: inline; padding: 1px 4px; margin: 0 -4px; border-radius: 5px; overflow-wrap: anywhere; transition: background-color .15s var(--ease); }
.mail-headers .hv.mono { font-family: var(--mono); font-size: 12px; }
.mail-headers .hv:hover { background: var(--hl-soft); }
.mail-headers .hv:focus-visible { outline: 2px solid var(--hl); outline-offset: 1px; }
.mail-headers .hv-ic svg { width: 13px; height: 13px; margin-left: 6px; vertical-align: -2px; stroke: currentColor; fill: none; stroke-width: 1.8; opacity: 0; transition: opacity .15s var(--ease); }
.mail-headers .hv:hover .hv-ic svg, .mail-headers .hv:focus-visible .hv-ic svg { opacity: .7; }
@media (hover: none) { .mail-headers .hv-ic svg { opacity: .45; } }
.mail-headers dd.mono { font-size: 12px; }
.mail-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); }
.mail-tabs button { border: 0; background: transparent; padding: 7px 12px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mail-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }
.mail-tabs button:disabled { opacity: .4; cursor: default; }
.mail-frame-wrap { flex: 1; min-height: 240px; border: 1px solid var(--rule); border-radius: 9px; overflow: hidden; background: #fff; }
.mail-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.mail-frame-wrap pre { margin: 0; height: 100%; overflow: auto; padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.65 var(--mono); color: #222; }
.mail-frame-wrap .loading { padding: 30px; text-align: center; color: #888; }
.mail-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: -4px; }
.mail-tools .spacer { flex: 1; }
.mail-tools-note { font-size: 12px; color: var(--muted); }
.mail-tools-note.warn { color: var(--warn); }
.shot-panel { border: 1px solid var(--rule); background: var(--paper); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.shot-panel .spacer { flex: 1; }
.shot-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.shot-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.shot-check { white-space: nowrap; }
.shot-check input { all: revert; width: 15px; height: 15px; margin: 0; padding: 0; flex: none; accent-color: var(--ink); }
.shot-panel .share-tip { color: var(--muted); }
.shot-crop-note { font-size: 12px; color: var(--muted); }
.shot-crop-note.warn { color: var(--warn); }
.interval-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule-soft); }
.interval-row label b { font-size: 14px; }
.interval-input { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.interval-input input { width: 76px; text-align: center; font-family: var(--mono); }
.interval-presets { display: inline-flex; gap: 4px; }
.interval-presets .btn { min-width: 34px; padding: 0 8px; font-family: var(--mono); }
.shot-preview { flex: 1; min-height: 240px; overflow: auto; border: 1px solid var(--rule); border-radius: 9px; background: repeating-conic-gradient(var(--paper-3) 0 25%, var(--paper) 0 50%) 0 0 / 16px 16px; padding: 14px; text-align: center; }
.shot-preview img { display: block; margin: 0 auto; max-width: 100%; height: auto; box-shadow: 0 6px 24px -10px rgba(0,0,0,.45); background: #fff; }
.shot-preview .loading { padding: 30px; color: var(--muted); }
.share-panel { border: 1px solid var(--hl); background: var(--hl-soft); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.share-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.share-row input { flex: 1 1 240px; min-width: 0; height: 32px; font: 13px var(--mono); background: var(--paper-2); }
.share-sub label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.share-sub select { height: 28px; padding: 0 8px; font-size: 12.5px; }
.share-sub .spacer { flex: 1; }
.share-info { font-size: 12px; color: var(--hl-ink); }
.share-tip { margin: 0; font-size: 12px; line-height: 1.6; color: var(--hl-ink); }
.mail-row-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.mail-row-actions .mh { margin: 0; }

@media (max-width: 980px) {
  .bell { justify-content: center; padding: 0; }
  .bell-label { display: none; }
  .bell-badge { position: absolute; top: -6px; right: -6px; margin: 0; }
}
@media (max-width: 720px) {
  .bell { margin: 0 4px 0 auto; width: 38px; height: 34px; border-style: solid; }
  .rail .sync { margin-left: 4px; }
  .dialog-wide, .dialog-mail { width: 100%; max-width: 100%; height: auto; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .dialog-mail { height: 92dvh; }
  .dialog-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .mail-view { padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
  .mail-headers { grid-template-columns: 1fr; gap: 0; }
  .mail-headers dd { margin-bottom: 4px; }
}

/* =====================================================================
   2026-11 改版:选择器 / 行内修改 / 两个时间 / 申诉结果清单 / 手机端
   ===================================================================== */

/* ---------- 手机基础:不放大输入框、点按不闪、打开面板时页面宽度不跳 ---------- */
html { scrollbar-gutter: stable; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
html.scroll-locked, html:has(dialog[open]) { overflow: hidden; }
button, a, label, [role="button"], [role="option"] { touch-action: manipulation; }
button, [role="button"], [role="option"], .tabbar a, .nav-item, .tally button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; } /* 小于 16px 时 iOS 一聚焦就放大整页 */
}

/* ---------- 颜色语义:data-tone 统一给出 --tc 文字 / --tb 底 / --tl 边 ---------- */
[data-tone="ok"] { --tc: var(--ok); --tb: var(--ok-bg); --tl: var(--ok-line); }
[data-tone="err"] { --tc: var(--err); --tb: var(--err-bg); --tl: var(--err-line); }
[data-tone="warn"] { --tc: var(--warn); --tb: var(--warn-bg); --tl: var(--warn-line); }
[data-tone="gray"] { --tc: var(--gray); --tb: var(--gray-bg); --tl: var(--gray-line); }
[data-tone="info"] { --tc: var(--ink-2); --tb: var(--paper-3); --tl: var(--rule); }
[data-tone="none"] { --tc: var(--muted); --tb: var(--paper-3); --tl: var(--rule); }
[data-tone="boost"] { --tc: var(--boost); --tb: color-mix(in srgb, var(--boost) 11%, var(--paper-2)); --tl: color-mix(in srgb, var(--boost) 45%, transparent); }
[data-tone="prem"] { --tc: var(--prem); --tb: color-mix(in srgb, var(--prem) 11%, var(--paper-2)); --tl: color-mix(in srgb, var(--prem) 45%, transparent); }
[data-tone="plus"] { --tc: var(--plus); --tb: color-mix(in srgb, var(--plus) 11%, var(--paper-2)); --tl: color-mix(in srgb, var(--plus) 45%, transparent); }

/* ---------- 选择器:触发按钮 ---------- */
.pk-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip-path: inset(50%); }
.pk-trigger {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 9px 0 11px; min-width: 0; max-width: 100%;
  border: 1px solid var(--rule); border-radius: 9px; background: var(--paper-2); color: var(--ink);
  font: 500 14px/1 var(--sans); text-align: left; cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
}
.pk-trigger .pk-tl { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.pk-trigger .pk-tl b { font-weight: 700; }
.pk-chev { width: 14px; height: 14px; color: var(--muted); flex: none; transition: transform .2s var(--ease); }
.pk-trigger[aria-expanded="true"] { border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl) 40%, transparent); }
.pk-trigger[aria-expanded="true"] .pk-chev { transform: rotate(180deg); }
.pk-trigger:active { transform: scale(.98); }
.pk-trigger:disabled { opacity: .5; cursor: default; }
.pk-trigger.is-placeholder .pk-tl { color: var(--muted); }
.pk-dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tc); flex: none; }
.pk-trigger[data-tone]:not([data-tone=""]) .pk-dot { display: block; }
.pk-trigger[data-tone="none"] .pk-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--gray-line); }
.toolbar .pk-trigger { flex: 0 1 180px; }
.field .pk-trigger, .dialog-body .field .pk-trigger { width: 100%; height: 40px; }
.share-sub .pk-trigger { height: 28px; font-size: 12.5px; border-radius: 7px; }
#st-range + .pk-trigger { min-width: 170px; }
/* 状态:一颗带色的药丸 */
.pk-t-status { height: 30px; padding: 0 8px 0 10px; border-radius: 99px; gap: 6px; font-weight: 700; font-size: 13px; letter-spacing: .04em; color: var(--tc); background: var(--tb); border-color: var(--tl); }
.pk-t-status .pk-chev { color: currentColor; opacity: .55; width: 13px; height: 13px; }
.field .pk-t-status { border-radius: 9px; padding-left: 12px; }
.c-status .pk-t-status { width: 100%; }
/* 会员:平时像文字,颜色按档位 */
.pk-t-mem { height: 30px; padding: 0 6px 0 8px; margin-left: -8px; border-color: transparent; background: transparent; font-size: 13px; color: var(--tc); }
.pk-t-mem .pk-tl b { font-weight: 700; }
.pk-t-mem .pk-dot { width: 7px; height: 7px; border-radius: 2px; transform: rotate(45deg); }
.field .pk-t-mem { margin-left: 0; border-color: var(--rule); background: var(--paper-2); }
.c-mem .pk-t-mem { max-width: 100%; }

/* ---------- 选择器:弹出层(电脑)/ 底部面板(手机) ---------- */
.pk-layer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.pk-pop {
  position: fixed; pointer-events: auto; background: var(--paper-2); color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; padding: 6px;
  box-shadow: 0 18px 48px -12px rgba(40, 30, 10, .35), 0 2px 6px rgba(40, 30, 10, .08);
  overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top center;
  transition: opacity .14s var(--ease), transform .16s var(--ease);
}
.pk-pop.up { transform-origin: bottom center; transform: translateY(4px) scale(.98); }
.pk-layer.in .pk-pop { opacity: 1; transform: none; }
.pk-layer.out .pk-pop { opacity: 0; transition-duration: .12s; }
.pk-list { display: grid; gap: 2px; }
.pk-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); text-align: left; font-size: 14px; cursor: pointer;
  transition: background-color .1s var(--ease), transform .1s var(--ease);
}
.pk-opt .pk-dot { display: block; width: 9px; height: 9px; box-shadow: 0 0 0 3px var(--tb, transparent); }
.pk-opt[data-tone=""] .pk-dot { display: none; }
.pk-opt[data-tone="none"] .pk-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--gray-line); }
.pk-opt .pk-l { flex: 1; font-weight: 500; }
.pk-opt .pk-s { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pk-check { width: 16px; height: 16px; opacity: 0; flex: none; stroke-width: 2.4; }
.pk-opt[aria-selected="true"] { background: var(--hl-soft); font-weight: 700; }
.pk-opt[aria-selected="true"] .pk-check { opacity: 1; }
.pk-status .pk-opt { font-weight: 600; }
.pk-status .pk-opt .pk-l { color: var(--tc); }
.pk-status .pk-opt[aria-selected="true"] { background: var(--tb); }
.pk-opt:disabled { opacity: .45; cursor: default; }
.pk-opt:active, .pk-chip:active { transform: scale(.98); }
.pk-opt:focus-visible, .pk-chip:focus-visible { outline: 2px solid var(--hl); outline-offset: -2px; }
.pk-group { padding: 10px 4px 6px; border-top: 1px solid var(--rule-soft); }
.pk-body > .pk-group:first-child { border-top: 0; padding-top: 4px; }
.pk-list + .pk-group { margin-top: 6px; }
.pk-ghead { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; font: 700 12px/1 var(--sans); letter-spacing: .08em; color: var(--tc); }
.pk-ghead::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--tc); transform: rotate(45deg); }
.pk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pk-chip {
  display: grid; gap: 3px; justify-items: start; align-content: center; min-height: 50px; padding: 8px 10px;
  border: 1px solid var(--rule-soft); border-radius: 10px; background: var(--paper); text-align: left; cursor: pointer;
  transition: border-color .12s var(--ease), background-color .12s var(--ease), transform .1s var(--ease);
}
.pk-chip .pk-l { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.pk-chip .pk-s { font: 500 12px var(--mono); color: var(--muted); }
.pk-chip[aria-selected="true"] { border-color: var(--tc); background: var(--tb); box-shadow: inset 0 0 0 1px var(--tc); }
.pk-chip[aria-selected="true"] .pk-l { color: var(--tc); }
.pk-grip { display: block; width: 40px; height: 5px; border-radius: 5px; background: var(--rule); margin: 8px auto 2px; touch-action: none; }
.pk-title { font: 900 17px var(--serif); padding: 6px 4px 12px; text-align: center; touch-action: none; }
.pk-layer.is-sheet { pointer-events: auto; }
.pk-scrim { position: absolute; inset: 0; background: rgba(20, 16, 8, .38); opacity: 0; transition: opacity .2s; }
.pk-layer.is-sheet.in .pk-scrim { opacity: 1; }
.pk-layer.is-sheet.out .pk-scrim { opacity: 0; }
.pk-layer.is-sheet .pk-pop {
  left: 0; right: 0; bottom: 0; top: auto; max-height: 82dvh; border-radius: 18px 18px 0 0; border-bottom: 0;
  padding: 0 12px calc(14px + env(safe-area-inset-bottom)); opacity: 1; transform: translateY(100%);
  transition: transform .32s cubic-bezier(.16, 1, .3, 1);
}
.pk-layer.is-sheet.in .pk-pop { transform: none; }
.pk-layer.is-sheet.out .pk-pop { transform: translateY(100%); transition: transform .18s cubic-bezier(.4, 0, 1, 1); }
.pk-layer.is-sheet .pk-opt { min-height: 50px; font-size: 16px; padding: 0 12px; }
.pk-layer.is-sheet .pk-grid { gap: 8px; }
.pk-layer.is-sheet .pk-chip { min-height: 58px; }
.pk-layer.is-sheet .pk-chip .pk-l { font-size: 15px; }
@media (prefers-color-scheme: dark) { .pk-pop { box-shadow: 0 18px 48px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .02); } }

/* ---------- 台账:行内修改 ---------- */
.ledger-head, .row { grid-template-columns: 112px minmax(130px, 1fr) minmax(150px, 1.3fr) minmax(80px, .9fr) 150px 84px var(--tw, 132px) 32px; }
.ledger.abs-time { --tw: 172px; }
@container ledger (max-width: 920px) {
  .ledger-head, .row { grid-template-columns: 112px minmax(130px, 1fr) minmax(150px, 1.3fr) 150px 84px var(--tw, 132px) 32px; }
}
@container ledger (max-width: 820px) {
  .ledger-head, .row { grid-template-columns: 108px minmax(120px, 1fr) minmax(130px, 1.3fr) 140px var(--tw, 132px) 32px; gap: 10px; }
}
.ledger-head .h-time { display: inline-flex; justify-content: flex-end; align-items: center; gap: 4px; }
.h-sep { font-style: normal; opacity: .4; }
.row { cursor: default; }
.row.open { background: var(--paper-2); }
.row.flash { animation: row-flash 1.6s var(--ease); }
@keyframes row-flash { 0%, 35% { background: var(--hl-soft); box-shadow: inset 0 0 0 2px var(--hl); } 100% { background: transparent; box-shadow: none; } }
.c-phone, .c-email, .c-nick { min-width: 0; }
.cell-edit {
  /* 只往左伸 7px 让文字和表头对齐;右边不伸,否则和隔壁格子的框挤在一起(列间距才 10~12px) */
  all: unset; box-sizing: border-box; display: block; min-width: 0; max-width: calc(100% + 7px); padding: 5px 7px; margin: 0 0 0 -7px;
  border-radius: 7px; cursor: text; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 13px; color: var(--ink-2); transition: background-color .12s var(--ease), box-shadow .12s var(--ease);
}
.c-phone .cell-edit { font-size: 14.5px; font-weight: 500; color: var(--ink); flex: 0 1 auto; }
.cell-edit.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.cell-edit.empty { color: var(--muted); }
.c-nick .cell-edit.empty { opacity: .55; }
.cell-edit:focus-visible { outline: 2px solid var(--hl); outline-offset: 0; }
.cell-edit:active { background: var(--paper-3); }
.cell-input {
  box-sizing: border-box; width: calc(100% + 7px); height: 32px; margin: 0 0 0 -7px; padding: 0 7px;
  border: 1px solid var(--ink-2); border-radius: 7px; background: var(--paper); color: var(--ink); font-size: 13px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl) 45%, transparent);
}
.c-phone .cell-input { font-size: 14.5px; }
.cell-input:focus { outline: none; border-color: var(--ink-2); }
.c-mail .mail-tag { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: 12px; color: var(--ink-2); cursor: pointer; padding: 3px 6px; margin-left: -6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-mail .mail-tag::before { content: ""; width: 7px; height: 7px; border-radius: 2px; transform: rotate(45deg); flex: none; background: var(--tc, var(--gray-line)); }
.c-mail .mail-tag.none { cursor: default; color: var(--muted); }
.c-mail .mail-tag.none::before { background: transparent; border: 1px solid var(--gray-line); }
/* 两个时间 */
.tp { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; min-width: 0; }
.tp-k { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; font-family: var(--sans); }
.tp .tt { font: 12px var(--mono); color: var(--ink-2); }
.tp.none .tt { color: var(--muted); font-family: var(--sans); }
.tp[data-k="出结果"]:not(.none) .tt { color: var(--ink); font-weight: 500; }
.c-time { display: grid; grid-template-columns: auto auto; justify-content: end; align-items: baseline; gap: 1px 6px; font: inherit; overflow: hidden; }
.c-time .tp { display: contents; }
.c-time .tp-k { text-align: right; }
.c-open { all: unset; box-sizing: border-box; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); cursor: pointer; }
.c-open svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.row.open .c-open svg { transform: rotate(180deg); }
.c-open:focus-visible { outline: 2px solid var(--hl); }
.c-open:active { background: var(--paper-3); }

/* ---------- 展开的详情 ---------- */
.row-detail { border-bottom: 1px solid var(--rule-soft); background: var(--paper-2); padding: 2px 14px 16px; animation: rise .25s var(--ease) both; box-shadow: inset 3px 0 0 var(--hl); }
.rd { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; }
@container ledger (max-width: 900px) { .rd { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .rd-main { grid-column: 1 / -1; } }
.rd-sec { min-width: 0; display: grid; gap: 8px; align-content: start; }
.rd-h { display: flex; align-items: center; gap: 8px; font: 600 12px var(--mono); letter-spacing: .1em; color: var(--muted); padding: 10px 0 6px; border-bottom: 1px solid var(--rule-soft); }
.rd-h .linkish { margin-left: auto; letter-spacing: 0; }
.linkish { all: unset; cursor: pointer; color: var(--ink-2); font: 500 12.5px var(--sans); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; padding: 2px 0; }
.linkish:focus-visible { outline: 2px solid var(--hl); border-radius: 3px; }
.rd-times { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.rd-times dt { color: var(--muted); font-size: 12px; }
.rd-times dd { margin: 0; }
.muted { color: var(--muted); }
.rd-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rd-acts .spacer { flex: 1; }
.rd-fields { display: grid; gap: 6px; padding: 8px 10px; border: 1px dashed var(--rule); border-radius: 10px; background: var(--paper); }
.rd-f { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 12px; color: var(--muted); min-height: 32px; }
.rd-f .cell-edit { margin: 0; max-width: 100%; }
.rd-f .cell-input { margin: 0; width: 100%; }
.rd-f .pk-trigger { justify-self: start; }
.rd-f .pk-t-mem { margin-left: 0; }
.rd-empty { margin: 0; font-size: 12.5px; color: var(--muted); }
.rd-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rd-hist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--rule-soft); border-radius: 9px; background: var(--paper); }
.rh-top { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: 12px; color: var(--muted); }
.rh-top .mono { white-space: nowrap; }
.rh-top .mono { color: var(--ink-2); }
.rh-diff { grid-column: 1; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.rd-hist li .btn { grid-column: 2; grid-row: 1 / 3; }
.mini-list { grid-template-columns: minmax(0, 1fr); }
.mini-item { width: 100%; min-width: 0; color: inherit; font: inherit; text-align: left; }
button.mini-item { font-size: 12.5px; }
.mini-item.cur { border-color: var(--hl); background: var(--hl-soft); }
.mini-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tc, var(--gray-line)); flex: none; }
.mini-k { font-weight: 700; white-space: nowrap; font-size: 12px; }

/* ---------- 申诉结果:按天分组的清单 ---------- */
.letters { display: block; }
.res-day { display: flex; align-items: baseline; gap: 8px; margin: 20px 2px 8px; font: 900 15px var(--serif); color: var(--ink); }
.res-day:first-child { margin-top: 2px; }
.res-day i { font: 500 12px var(--mono); color: var(--muted); font-style: normal; }
.res {
  position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 4px 14px; align-items: start;
  padding: 12px 12px 12px 16px; margin-bottom: 8px; border: 1px solid var(--rule-soft); border-radius: 12px; background: var(--paper-2);
  animation: rise .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 14ms);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.res::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--tc); }
.res-hit { position: absolute; inset: 0; z-index: 0; border: 0; padding: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.res-hit:focus-visible { outline: 2px solid var(--hl); outline-offset: 2px; }
.res-kind { position: relative; z-index: 1; pointer-events: none; display: flex; align-items: center; gap: 7px; font: 700 13.5px/1.7 var(--sans); color: var(--tc); white-space: nowrap; }
.res-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tc); box-shadow: 0 0 0 3px var(--tb); flex: none; }
.res-main { position: relative; z-index: 1; pointer-events: none; min-width: 0; display: grid; gap: 3px; }
.res-main button, .res-main .tt { pointer-events: auto; }
.res-l1 { display: flex; align-items: center; gap: 6px 10px; min-width: 0; flex-wrap: wrap; }
.res-phone { font-size: 15px; font-weight: 600; }
.res-nick { font-size: 13px; color: var(--ink-2); }
.res-count { font: 500 12px var(--mono); color: var(--muted); }
.res-tag { font: 500 12px/18px var(--sans); padding: 0 7px; border-radius: 99px; border: 1px solid var(--rule); color: var(--muted); background: transparent; white-space: nowrap; }
.res-tag.ok { color: var(--ok); border-color: var(--ok-line); cursor: pointer; }
.res-tag.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.res-reason { font-size: 13px; color: var(--ink-2); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.res-l3 { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 1px; }
.res-addr { min-width: 0; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-warn { font-size: 12px; color: var(--warn); }
.res-side { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; align-self: center; }
.res-arrow { color: var(--muted); display: grid; pointer-events: none; }
.res-arrow svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.res.is-open { border-color: var(--hl); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl) 35%, transparent); }
.res-kindtag { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--tc); white-space: nowrap; }
.thread-times { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 8px; }
.copy-txt { all: unset; cursor: copy; border-radius: 5px; padding: 0 3px; margin: 0 -3px; overflow-wrap: anywhere; }
.copy-txt:focus-visible { outline: 2px solid var(--hl); }
.copy-txt:active { background: var(--hl-soft); }

/* ---------- 原邮件:表头点一下复制(不再放图标) ---------- */
.mail-headers .hv { cursor: copy; }
.mail-headers .hv.copied { animation: copied .9s var(--ease); }
@keyframes copied { 0% { background: var(--hl); } 100% { background: transparent; } }
.mail-meta-line { display: none; }
.dialog-grip { display: none; }

/* ---------- 设置:收信间隔 ---------- */
.interval-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.iv-label { display: grid; gap: 2px; }
.iv-label small { color: var(--muted); font-size: 12.5px; }
.iv-ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: stretch; height: 40px; border: 1px solid var(--rule); border-radius: 11px; background: var(--paper); overflow: hidden; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.stepper:focus-within { border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl) 45%, transparent); }
.st-btn { width: 38px; border: 0; background: transparent; color: var(--ink-2); display: grid; place-items: center; transition: background-color .1s var(--ease); }
.st-btn svg { width: 16px; height: 16px; stroke-width: 2.2; }
.st-btn:active { background: var(--paper-3); }
.st-field { display: flex; align-items: center; gap: 5px; padding: 0 12px; border-left: 1px solid var(--rule-soft); border-right: 1px solid var(--rule-soft); background: var(--paper-2); cursor: text; }
.st-field input { all: unset; width: 4ch; text-align: right; font: 600 17px var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.st-field input:focus { box-shadow: none; }
.st-field span { font-size: 12.5px; color: var(--muted); }
.iv-ctl.saving .st-field span::after { content: ""; display: inline-block; width: 9px; height: 9px; margin-left: 6px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }
.iv-presets { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--rule); border-radius: 11px; background: var(--paper); }
.iv-presets button { min-width: 40px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; font: 500 13px var(--mono); color: var(--ink-2); transition: background-color .15s var(--ease), color .15s var(--ease); }
.iv-presets button[aria-checked="true"] { background: var(--inv); color: var(--inv-ink); font-weight: 600; }
.iv-presets button:active { transform: scale(.96); }

/* ---------- 设置:云端备份 ---------- */
.warn-note { color: var(--warn); }
.snap-list { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--rule-soft); border-radius: 10px; overflow: hidden; background: var(--paper); }
.snap-list li { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding: 8px 10px 8px 12px; border-bottom: 1px solid var(--rule-soft); font-size: 13px; }
.snap-list li:last-child { border-bottom: 0; }
.snap-at { font-size: 12.5px; }
.snap-why { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--paper-3); color: var(--ink-2); white-space: nowrap; }
.snap-why[data-r^="before"] { background: var(--warn-bg); color: var(--warn); }
.snap-n { font-size: 12px; color: var(--muted); }
.snap-list .spacer { flex: 1; }

/* ---------- 新记录面板 ---------- */
.sheet-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.draft-note { display: flex; align-items: center; gap: 10px; margin: 12px 20px 0; padding: 8px 12px; border-radius: 9px; background: var(--hl-soft); color: var(--hl-ink); font-size: 13px; }
.draft-note span { flex: 1; }
.sheet-head, .thread-head, .dialog-head, .sheet-grip, .dialog-grip { touch-action: pan-x; }

/* ---------- 只有鼠标才有悬停(触屏上点过之后不会「粘住」) ---------- */
@media (hover: hover) and (pointer: fine) {
  .pk-trigger:hover { border-color: var(--ink-2); }
  .pk-t-status:hover { border-color: var(--tc); }
  .pk-t-mem:hover { border-color: var(--rule); background: var(--paper-2); }
  .pk-opt:hover { background: var(--paper-3); }
  .pk-opt[aria-selected="true"]:hover { background: var(--hl-soft); }
  .pk-status .pk-opt[aria-selected="true"]:hover { background: var(--tb); }
  .pk-chip:hover { border-color: var(--tl); background: var(--tb); }
  .cell-edit:hover { background: var(--paper-3); box-shadow: inset 0 0 0 1px var(--rule); color: var(--ink); }
  .row:hover .c-nick .cell-edit.empty { opacity: 1; }
  .c-mail .mail-tag:not(.none):hover { background: var(--paper-3); color: var(--ink); }
  .c-open:hover { background: var(--paper-3); color: var(--ink); }
  .res:hover { border-color: var(--rule); box-shadow: var(--shadow); }
  .res:hover .res-arrow { color: var(--ink); }
  .res:hover .res-arrow svg { transform: translateX(3px); }
  .res-tag.ok:hover { background: var(--ok-bg); }
  .linkish:hover { color: var(--ink); text-decoration-color: currentColor; }
  .copy-txt:hover { background: var(--hl-soft); }
  .st-btn:hover { background: var(--paper-3); color: var(--ink); }
  .iv-presets button:not([aria-checked="true"]):hover { background: var(--paper-3); color: var(--ink); }
}
@media (hover: none) {
  .tally button:hover, .nav-item:hover, .bell:hover, .icon-btn:hover, .letter-thread:hover { background: transparent; }
  .tally button.active:hover { background: var(--hl-soft); }
  .bell.has-news:hover { background: var(--hl-soft); }
  .mini-item.link:hover { border-color: var(--rule-soft); }
  .mini-item.cur:hover { border-color: var(--hl); }
  .tt:hover { color: inherit; border-bottom-color: transparent; }
  .btn:hover { border-color: var(--rule); }
  .btn-ink:hover { background: var(--inv); border-color: var(--inv); }
  .btn-hl:hover { background: var(--hl); border-color: #e3b20f; }
  .btn-danger:hover { background: transparent; border-color: var(--err-line); }
  .btn:active { filter: brightness(.94); }
}

/* ---------- 手机 ---------- */
@media (max-width: 720px) {
  /* 记录卡片:第一行 状态 + 手机号 + 展开;第二行 邮箱 · 昵称;第三行 会员 · 回信;第四行 两个时间 */
  .row {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, auto) auto;
    grid-template-areas: "status phone phone open" "email email nick nick" "mem mem mail mail" "time time time time";
    gap: 6px 10px; padding: 12px 10px 10px 14px;
  }
  .c-status { grid-area: status; }
  .c-status .pk-t-status { width: auto; }
  .c-phone { grid-area: phone; }
  .c-email { grid-area: email; }
  .c-nick { grid-area: nick; display: block !important; justify-self: end; max-width: 100%; }
  .c-nick .cell-edit { text-align: right; }
  .c-nick .cell-edit.empty { opacity: .7; }
  .c-mem { grid-area: mem; }
  .c-mail { grid-area: mail; display: flex !important; justify-content: flex-end; }
  .c-time { grid-area: time; display: flex; justify-content: flex-start; gap: 16px; padding-top: 6px; border-top: 1px dashed var(--rule-soft); }
  .c-time .tp { display: inline-flex; }
  .c-phone .cell-edit { font-size: 15px; }
  .c-open { grid-area: open; width: 34px; height: 34px; margin: -2px -4px 0 0; }
  .cell-edit { padding: 7px 7px; }
  .cell-input { height: 36px; }
  .pk-t-status { height: 32px; }
  .pk-t-mem { height: 32px; }
  .row.open { border-radius: 12px 12px 0 0; border-bottom-color: var(--rule-soft); background: var(--paper-2); }
  .row-detail { margin-top: -8px; padding: 0 12px 14px; border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 12px 12px; box-shadow: none; }
  .rd { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .rd-acts .btn { height: 34px; }
  .mini-item { min-height: 40px; }
  /* 申诉结果 */
  .res { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "kind side" "main main"; padding: 12px 12px 12px 14px; gap: 6px 10px; }
  .res-kind { grid-area: kind; }
  .res-main { grid-area: main; }
  .res-side { grid-area: side; align-self: center; }
  .res-addr { max-width: 100%; flex-basis: 100%; }
  .res-day { margin-top: 16px; }
  /* 设置 */
  .interval-row { align-items: flex-start; }
  .iv-ctl { width: 100%; justify-content: space-between; }
  .iv-presets button { min-width: 0; flex: 1; }
  .iv-presets { flex: 1 1 auto; }
  .snap-list li .spacer { display: none; }
  .snap-list li .btn { flex: 1; }
  /* 新记录面板 / 对话框:顶上的抓手,按住往下拖就关 */
  .sheet .sheet-grip, .dialog-grip { display: block; width: 40px; height: 5px; border-radius: 5px; background: var(--rule); margin: 8px auto 0; flex: none; }
  .sheet-head { padding-top: 10px; }
  .draft-note { margin: 10px 16px 0; }
  .toolbar .pk-trigger { flex: 1 1 0; height: 40px; }
  .sort-m .pk-trigger { flex: 1 1 auto; }
  .is-dragging { transition: none !important; }
  /* 原邮件:表头收成一行,点开才看全部;标签和工具各一行、横向滑,正文区尽量大 */
  .mail-view { gap: 8px; padding: 0 12px calc(10px + env(safe-area-inset-bottom)); }
  .mail-head { margin-bottom: 0; align-items: center; }
  .mail-subject { font-size: 16px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .mail-meta-line { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 1px solid var(--rule-soft); border-radius: 9px; background: var(--paper); color: var(--ink-2); font-size: 12.5px; text-align: left; flex: none; }
  .ml-from { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42%; }
  .ml-date { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px var(--mono); }
  .ml-more { font-size: 12px; color: var(--muted); white-space: nowrap; }
  .ml-more::after { content: " ▾"; }
  .mail-meta-line[aria-expanded="true"] .ml-more::after { content: " ▴"; }
  .mail-headers { display: none; }
  .mail-view.hd-open .mail-headers { display: grid; flex: none; }
  .mail-tabs { flex: none; overflow-x: auto; scrollbar-width: none; }
  .mail-tabs button { flex: none; padding: 8px 12px; }
  .mail-tools { flex: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-top: 0; padding-bottom: 1px; }
  .mail-tools::-webkit-scrollbar, .mail-tabs::-webkit-scrollbar { display: none; }
  .mail-tools .btn, .mail-tools .mail-tools-note { flex: none; }
  .mail-tools .spacer { display: none; }
  .mail-frame-wrap, .shot-preview { min-height: 0; }
  .shot-panel, .share-panel { flex: none; }
}

/* ---------- 2026-11 第二轮 ---------- */
/* 重画时不再整页淡入(只有切到这一页时播一次) */
.ledger.calm .row, .ledger.calm .row-detail, .letters.calm .res { animation: none; }
/* 台账的时间列:表头已经写了「创建 / 出结果」,格子里不再重复文字;两行左对齐,出结果加粗 */
@media (min-width: 721px) {
  .c-time { display: grid; grid-template-columns: auto; justify-content: start; justify-items: start; gap: 2px; padding-left: 4px; }
  .c-time .tp { display: block; }
  .c-time .tp-k { display: none; }
  .c-time .tt { font-size: 12.5px; letter-spacing: -.01em; }
  .c-time .tp[data-k="创建"] .tt { color: var(--muted); }
  .c-time .tp[data-k="出结果"]:not(.none) .tt { color: var(--ink); font-weight: 600; }
  .c-time .tp.none .tt { color: var(--muted); font-size: 12px; opacity: .8; }
  .ledger-head .h-time { justify-content: flex-start; padding-left: 4px; }
  .ledger { --tw: 118px; }
  .ledger.abs-time { --tw: 150px; }
}
/* 回信时间线:按原邮件分行显示 */
.tl-text { white-space: pre-line; }

/* 浏览器自带的滚动锚定(Chrome / Android)和上面 JS 里手动放回位置会叠加,关掉自带的 */
.ledger { overflow-anchor: none; }

/* ---------- 详情更好读:小标题、带颜色的结果、内容两行 ---------- */
.rd-h { font: 700 13px/1.3 var(--sans); letter-spacing: .02em; color: var(--ink); padding: 12px 0 7px; border-bottom: 1px solid var(--rule-soft); }
.rd-h::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--hl); flex: none; }
.rd-n { font: 600 11.5px/18px var(--mono); font-style: normal; padding: 0 7px; border-radius: 99px; background: var(--paper-3); color: var(--ink-2); letter-spacing: 0; }
.rd-times dt { color: var(--muted); }
.rd-times dd { color: var(--ink); }
/* 条目:第一行 结果(带颜色)+ 时间,第二行 内容(最多两行,不再一行截断) */
.rd .mini-item, #sheet-lists .mini-item {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "dot k time" "txt txt txt";
  align-items: center; gap: 3px 7px; padding: 9px 11px; border-color: var(--rule-soft); background: var(--paper);
}
.rd .mini-item .mini-dot, #sheet-lists .mini-item .mini-dot { grid-area: dot; background: var(--tc, var(--gray-line)); box-shadow: 0 0 0 3px var(--tb, transparent); }
.rd .mini-item .mini-k, #sheet-lists .mini-item .mini-k { grid-area: k; color: var(--tc, var(--ink)); font-size: 13px; }
.rd .mini-item .mono, #sheet-lists .mini-item .mono { grid-area: time; justify-self: end; margin: 0; font-size: 12px; color: var(--muted); }
.rd .mini-item .txt, #sheet-lists .mini-item .txt {
  grid-area: txt; white-space: normal; color: var(--ink-2); font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rd .mini-item.cur { border-color: var(--hl); background: var(--hl-soft); }
.rd .mini-item.cur .mono { color: var(--hl-ink); font-weight: 600; }
.rd .mini-item:active { transform: scale(.99); }
@media (max-width: 720px) {
  /* 卡片上已经有「创建 / 出结果」,详情里最新这一次就不再重复 */
  .rd-main.is-head .rd-times { display: none; }
  .rd-main.is-head .rd-h { display: none; }
  .rd-main.is-head { padding-top: 10px; }
  .row-detail { background: color-mix(in srgb, var(--paper-2) 60%, var(--paper)); }
  .rd-sec { gap: 7px; }
  .rd .mini-item { padding: 10px 12px; }
}

/* 回到申诉结果时,刚才点过的那张卡片闪一下 */
.res.flash { animation: row-flash 1.6s var(--ease); }
/* 原邮件工具条:左边「机器翻译」这类说明是个小标签,和右边按钮隔开;手机上也一样(以前贴在一起) */
.mail-tools-note { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 99px; background: var(--paper-3); color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.mail-tools-note.warn { background: var(--warn-bg); color: var(--warn); }
@media (max-width: 720px) {
  .mail-tools { gap: 8px; }
  .mail-tools .spacer { display: block; flex: 1 0 8px; }
}

/* 「刚才在这里」的提示:淡黄底 + 细黄圈,0.8 秒内淡掉。
   要写得比 .calm 里的 animation: none 更具体,不然入场动画关掉时提示也跟着没了 */
.ledger .row.flash, .ledger.calm .row.flash { animation: spot .8s ease-out both; }
.letters .res.flash, .letters.calm .res.flash { animation: spot .8s ease-out both; }
@keyframes spot {
  0% { background-color: var(--hl-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--hl) 70%, transparent); }
  100% { box-shadow: 0 0 0 2px transparent; }
}
