/* 管理端的样子。配色、字号、圆角照公司别的管理后台那一套规范（深蓝侧栏、白顶栏、13px 正文、表头浅底、色调标签）。
   只引用下面的变量，别处不写十六进制色。 */
:root {
  --ink: #182b48; --ink-2: #3f5170; --muted: #62738b; --disabled: #98a6b8;
  --blue: #245cdb; --blue-h: #1d4fc4; --blue-a: #1a45ab; --blue-t1: #eef3fd; --blue-t2: #dfe8fb;
  --navy: #102b56; --navy-2: #0c2348; --nav-text: #b8c6da; --gold-2: #e6ac42; --badge-bg: rgba(230, 172, 66, .18); --badge-text: #f0c36e; --btn-disabled: #c9d4e6;
  --line: #e4eaf2; --line-2: #eef2f7; --bg: #f3f6fa; --tint: #f7f9fc; --ctl: #8493a9; --ctl-hover: #62738b;
  --green: #187a66; --green-d: #145f50; --green-t: #e7f3f0; --green-line: #bcdcd4;
  --gold: #9b691f; --gold-d: #7c5213; --gold-t: #fbf3e3; --gold-line: #eadfc4; --row-pending: #fffdf8;
  --red: #ba4a50; --red-d: #a03c42; --red-t: #f9ecec; --red-line: #e6c3c5;
  --neutral-d: #4b5d76; --neutral-t: #edf1f6;
  --r-xs: 4px; --r-s: 6px; --r-m: 8px; --r-l: 12px;
  --sh-pop: 0 6px 20px rgba(16, 43, 86, .14); --sh-modal: 0 16px 48px rgba(16, 43, 86, .26); --mask: rgba(16, 43, 86, .5);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.54 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin-top: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue-t2); }
code, .mono { font-family: var(--mono); font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--red-d); margin: 8px 0 0; min-height: 0; }
.error:empty { display: none; }

/* ---------- 进入 ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; padding: 32px 28px; background: white; border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--sh-pop); }
.login-card .eyebrow { margin: 0 0 4px; color: var(--blue); font-size: 12px; line-height: 18px; font-weight: 600; letter-spacing: .08em; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; line-height: 30px; }
.login-card > .muted { margin: 0 0 20px; }
.login-card label { display: block; margin-bottom: 16px; color: var(--ink-2); }
.login-card input { display: block; width: 100%; margin-top: 6px; }
.login-card form > .muted { margin: 0 0 20px; }
.login-card h2 { margin: 20px 0 6px; font-size: 14px; line-height: 22px; }
.login-card .plain { display: block; margin: 12px auto 0; }
.login-card .error:empty { display: none; }
.login-card .error { margin: 16px 0 0; }
.code-input { font-family: var(--mono); font-size: 20px; letter-spacing: .3em; text-align: center; }
.code-input::placeholder { font-family: inherit; font-size: 14px; letter-spacing: normal; }
.qr { display: block; margin: 12px auto; border: 1px solid var(--line); border-radius: var(--r-s); image-rendering: pixelated; }
.secret { display: flex; flex-direction: column; gap: 2px; align-items: center; margin: 0 0 4px; }
.secret code, .one-time code { font-family: var(--mono); font-size: 13px; letter-spacing: .04em; text-align: center; user-select: all; }
.one-time code { word-break: break-all; }
.accounts td:first-child, .accounts .row-actions { white-space: nowrap; }
/* 客户端设置（Story 16.5）：找人的结果很长，不能把名字和说明那一栏挤成一个字一行 */
.client-settings { table-layout: fixed; }
.client-settings th:first-child { width: 34%; }
.client-settings th:nth-child(2) { width: 26%; }
.client-settings td { overflow-wrap: anywhere; }
.client-settings input[type="text"] { width: 100%; max-width: 280px; }
.client-settings .found { flex-basis: 100%; }
.client-settings .found button.link { white-space: normal; text-align: left; display: block; }
/* 记录页明细的分页（2026-11-22）：共几条、每页几条、页码 */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.pager .pages { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.pager button.page { min-width: 30px; height: 30px; padding: 0 8px; background: white; }
.pager button.page[aria-current="page"] { border-color: var(--blue); color: var(--blue); font-weight: 600; }
.pager select { width: auto; }
.pager-note { margin: 0; padding: 8px 16px 0; color: var(--red-d); font-size: 13px; }
.one-time { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 12px 0; background: var(--gold-t); border-radius: var(--r-s); }
.one-time code { font-size: 18px; flex: 1; text-align: left; }

/* ---------- 外框：侧栏、顶栏 ---------- */
.shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 100vh; }
.sider { background: var(--navy); color: var(--nav-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 12px; }
.brand-mark { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: var(--r-m); background: var(--blue); color: white; font-weight: 600; font-size: 15px; }
.brand strong { display: block; color: white; font-size: 14px; line-height: 18px; }
.brand span:not(.brand-mark) { display: block; font-size: 12px; line-height: 16px; }
.menu { padding: 6px 8px 24px; }
.menu .group { display: flex; align-items: center; gap: 8px; height: 36px; margin-top: 4px; padding: 0 10px; color: white; font-weight: 600; }
.menu .group::before { content: ""; width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; opacity: .75; }
.menu .sub { background: var(--navy-2); margin: 0 -8px; padding: 4px 8px; }
.menu button { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 36px; padding: 0 12px 0 32px; border: 0; border-left: 3px solid transparent; border-radius: var(--r-s); background: transparent; color: var(--nav-text); text-align: left; cursor: pointer; }
.menu button:hover:not(:disabled) { color: white; border-color: transparent; }
.menu button[aria-current="page"], .menu button[aria-current="page"]:hover:not(:disabled) { background: var(--blue); color: white; font-weight: 600; border-color: transparent; border-left-color: var(--gold-2); }
.menu .count { min-width: 22px; padding: 0 6px; border-radius: 9px; background: var(--badge-bg); color: var(--badge-text); font-size: 12px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.menu button[aria-current="page"] .count { background: rgba(255, 255, 255, .22); color: white; }
.work { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 48px; padding: 0 20px; background: white; border-bottom: 1px solid var(--line); }
.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; }
.crumb b { color: var(--blue); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.topbar-actions .pair { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.me { color: var(--ink-2); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level { padding: 1px 8px; border-radius: var(--r-xs); background: var(--blue-t1); color: var(--blue-h); font-size: 12px; line-height: 20px; }
.level.read { background: var(--gold-t); color: var(--gold-d); }
.main { width: 100%; max-width: 1600px; margin: 0 auto; padding: 16px 20px 48px; }
.page-head { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 12px; }
.page-head h1 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.page-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- 基本件：按钮、输入、标签 ---------- */
button { height: 32px; padding: 0 14px; border: 1px solid var(--ctl); border-radius: var(--r-s); background: white; color: var(--ink); cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
button:disabled { color: var(--disabled); border-color: var(--line); background: var(--tint); cursor: not-allowed; }
button.primary { border-color: var(--blue); background: var(--blue); color: white; font-weight: 500; }
button.primary:hover:not(:disabled) { background: var(--blue-h); border-color: var(--blue-h); color: white; }
button.primary:disabled { background: var(--btn-disabled); border-color: var(--btn-disabled); color: white; }
button.primary.danger { border-color: var(--red); background: var(--red); }
button.primary.danger:hover:not(:disabled) { border-color: var(--red-d); background: var(--red-d); }
button.big { width: 100%; height: 44px; font-size: 16px; }
button.plain { background: white; }
button.ghost { border-color: transparent; background: transparent; color: var(--ink-2); padding: 0 8px; }
button.ghost:hover:not(:disabled) { border-color: transparent; color: var(--blue); }
button.link { height: auto; padding: 0; border: 0; background: none; color: var(--blue); white-space: normal; text-align: left; }
button.link:hover:not(:disabled) { color: var(--blue-h); text-decoration: underline; }
button.link.danger, button.link.danger:hover:not(:disabled) { color: var(--red); }
button.link.good, button.link.good:hover:not(:disabled) { color: var(--green); }
button.link.below { display: block; margin-top: 2px; font-size: 12px; }
.row-actions button.link { white-space: nowrap; }
/* 禁用的写在最后：只读密钥下红的、绿的文字按钮也要变灰。 */
button.link:disabled, button.link.danger:disabled, button.link.good:disabled { background: none; color: var(--disabled); text-decoration: none; }
input, select, textarea { height: 32px; padding: 0 10px; border: 1px solid var(--ctl); border-radius: var(--r-s); background: white; }
textarea { height: 76px; padding: 6px 10px; resize: vertical; line-height: 1.54; }
input:hover, select:hover, textarea:hover { border-color: var(--ctl-hover); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
input::placeholder, textarea::placeholder { color: var(--muted); }
.tag, .stage, .outcome, .kind { display: inline-block; padding: 0 7px; border-radius: var(--r-xs); font-size: 12px; line-height: 20px; white-space: nowrap; background: var(--neutral-t); color: var(--neutral-d); }
.tag { margin-left: 8px; }
.tag.gold, .stage.learn, .outcome.would { background: var(--gold-t); color: var(--gold-d); }
.tag.green, .stage.enforce, .outcome.allowed { background: var(--green-t); color: var(--green-d); }
.outcome.blocked { background: var(--red-t); color: var(--red-d); }
.tag.blue, .kind { background: var(--blue-t1); color: var(--blue-h); }
.tag.red, .kind.ban { background: var(--red-t); color: var(--red-d); }
/* 「已解除 15:20」（Story 4.9）：是个按钮（点了去操作日志），样子还是标签，虚线框和别的标签分开。 */
button.tag.lifted { height: auto; border: 1px dashed var(--ctl); background: var(--neutral-t); color: var(--neutral-d); font: inherit; font-size: 12px; line-height: 18px; cursor: pointer; }
button.tag.lifted:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
/* 明细里插的「解除今天的限制」那一行。 */
tbody tr.event > td, tbody tr.event:hover > td { background: var(--blue-t1); color: var(--ink-2); border-top: 1px solid var(--blue-t2); border-bottom: 1px solid var(--blue-t2); }
tr.event b { color: var(--blue-h); font-weight: 600; }
.kind.promote { background: var(--green-t); color: var(--green-d); }
.kind.demote { background: var(--gold-t); color: var(--gold-d); }
.kind { margin-right: 8px; }
.dot::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.notice { margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--green-line); border-radius: var(--r-s); background: var(--green-t); color: var(--green-d); }
.notice.bad, .warn { border: 1px solid var(--gold-line); background: var(--gold-t); color: var(--gold-d); }
#notice { scroll-margin-top: 64px; } /* 翻到提示那里时让开顶上钉住的那一条（48px） */
.warn { margin: 12px 0 0; padding: 8px 12px; border-radius: var(--r-s); }
.hint { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.who { font-family: var(--font); }
.who .kv { white-space: nowrap; }
.find-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: -6px 0 12px; }
.find-line:empty { display: none; }
.found button.link { margin-left: 8px; }

/* ---------- 白底的一块：标题、筛选条、表格 ---------- */
.card { margin-bottom: 12px; padding: 16px; background: white; border: 1px solid var(--line); border-radius: var(--r-m); min-width: 0; }
.card.wrap { padding: 0; overflow-x: auto; }
.card h2 { margin: 0 0 12px; font-size: 14px; line-height: 22px; font-weight: 600; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; }
.card-head > button { margin-left: auto; flex-shrink: 0; }
.card-head h2 { margin: 0; }
.card-head .sum { color: var(--muted); }
.card-head .row-actions { margin-left: auto; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { padding: 9px 16px; background: var(--tint); color: var(--muted); font-weight: 400; text-align: left; white-space: nowrap; border-block: 1px solid var(--line-2); }
td { padding: 11px 16px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tbody tr:hover > td { background: var(--tint); }
tbody tr:last-child > td { border-bottom: 0; }
tr.group th { background: white; color: var(--ink); font-weight: 600; border-top: 1px solid var(--line); }
tr.group .policy { margin-left: 12px; color: var(--muted); font-weight: 400; font-size: 12px; }
tr.pending > td, tr.observe > td { color: var(--muted); }
tr.attn > td { background: var(--row-pending); }
tr.attn > td:first-child { box-shadow: inset 3px 0 0 var(--gold-2); }
.rule-text { font-weight: 500; }
footer.note, .note { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 12px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* 「只记录不拦截」：一行一个拨动开关（Story 4.5） */
.card.switches { padding: 0; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.switch-row:first-child { border-top: 0; border-radius: var(--r-m) var(--r-m) 0 0; }
.switch-row:last-child { border-radius: 0 0 var(--r-m) var(--r-m); }
.switch-row:only-child { border-radius: var(--r-m); }
.switch-row.on { background: var(--gold-t); }
.switch-row strong { margin-right: 8px; }
.switch-row .state { margin-right: 8px; padding: 0 7px; border-radius: var(--r-xs); font-size: 12px; line-height: 20px; background: var(--green-t); color: var(--green-d); display: inline-block; }
.switch-row.on .state { background: white; color: var(--gold-d); }
.switch-row .hint { display: inline; margin-left: 8px; }
.switch-row.note { display: block; }
.switch-row.note .warn { margin: 0 0 8px; }
.toggle { position: relative; flex: none; width: 44px; height: 22px; padding: 0; border: 0; border-radius: 11px; background: var(--ctl); }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: left .12s; }
.toggle[aria-checked="true"] { background: var(--gold-2); }
.toggle[aria-checked="true"]::after { left: 24px; }
.toggle:disabled, .toggle[aria-checked="true"]:disabled { opacity: .55; }
.toggle:disabled { background: var(--ctl); }
.toggle[aria-checked="true"]:disabled { background: var(--gold-2); }

/* 规则页：一张表单，分节，整页一个「保存配置」（Story 4.5） */
.info { margin: 0; padding: 10px 14px; border: 1px solid var(--blue-t2); border-radius: var(--r-s); background: var(--blue-t1); color: var(--blue-a); line-height: 1.6; }
.card.wrap > .info { margin: 12px 16px; }
.card.form { padding: 16px 20px 0; }
.form-sec { margin-top: 20px; }
.form-sec h2 { margin: 0; padding-bottom: 8px; border-bottom: 2px solid var(--line); font-size: 15px; line-height: 22px; }
.form-sec h2 .policy { margin-left: 12px; color: var(--muted); font-weight: 400; font-size: 12px; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: start; padding: 12px 4px 12px 12px; border-bottom: 1px solid var(--line-2); border-left: 3px solid transparent; }
.form-row:last-child { border-bottom: 0; }
.form-row.dirty { background: var(--row-pending); border-left-color: var(--gold-2); }
.form-row.idle .rule-text { color: var(--muted); }
.form-row .what { min-width: 0; }
.form-row .rule-text { font-size: 14px; line-height: 32px; font-weight: 500; }
.form-row .under { display: flex; flex-wrap: wrap; gap: 2px 18px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.form-row .under button.link { font-size: 12px; }
.form-row .under > :empty { display: none; }
.form-row .diff { color: var(--gold-d); font-weight: 600; }
.form-row .diff.bad { color: var(--red-d); }
.form-row .ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-top: 1px; min-width: 120px; }
.stepper { display: inline-flex; align-items: stretch; height: 32px; margin: 0 8px; border: 1px solid var(--ctl); border-radius: var(--r-s); overflow: hidden; vertical-align: middle; background: white; }
.stepper button { width: 32px; height: auto; padding: 0; border: 0; border-radius: 0; background: var(--tint); color: var(--ink-2); font-size: 16px; line-height: 1; }
.stepper input { width: 64px; height: auto; padding: 0 4px; border: 0; border-inline: 1px solid var(--line); border-radius: 0; text-align: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper input:focus { box-shadow: none; }
.stepper:focus-within { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.stepper input.bad { color: var(--red-d); background: var(--red-t); }
.stepper input:disabled { background: var(--tint); color: var(--ink); }
.seg { display: inline-flex; flex: none; border: 1px solid var(--ctl); border-radius: var(--r-s); overflow: hidden; background: white; }
.seg button { height: 30px; padding: 0 14px; border: 0; border-radius: 0; background: white; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--blue); color: white; font-weight: 600; }
.seg button[data-stage="learn"][aria-pressed="true"] { background: var(--gold-t); color: var(--gold-d); }
.seg button[data-stage="enforce"][aria-pressed="true"] { background: var(--green); color: white; }
.seg button:disabled { background: var(--tint); color: var(--disabled); }
.seg button[aria-pressed="true"]:disabled { opacity: .7; }
.form-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 16px -20px 0; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--tint); border-radius: 0 0 var(--r-m) var(--r-m); }
.form-foot > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.pending-note.on { color: var(--gold-d); font-weight: 600; }
.pending-note:empty { display: none; }
ul.changes { margin: 0 0 14px; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r-m); }
ul.changes li { padding: 8px 12px; border-bottom: 1px solid var(--line-2); }
ul.changes li:last-child { border-bottom: 0; }
ul.changes strong { display: block; font-weight: 500; }
ul.changes .to { color: var(--gold-d); font-weight: 600; }

/* 记录页：日期、一格一个数的概览、排行（Story 4.5） */
.daybar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.daybar .tag { margin-left: 0; white-space: normal; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; height: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-m); background: white; color: var(--ink); text-align: left; white-space: normal; }
button.stat:hover:not(:disabled) { border-color: var(--blue); color: var(--ink); }
.stat .label { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stat b { font-size: 26px; line-height: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat.bad b { color: var(--red-d); }
.stat.would b { color: var(--gold-d); }
.stat.idle b { color: var(--disabled); }
.stat .sub { color: var(--muted); font-size: 12px; }

/* 名单页的页签、表格上面那一条 */
.tabs { display: flex; gap: 24px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tabs button { height: 42px; padding: 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--ink-2); font-size: 14px; }
.tabs button:hover:not(:disabled) { border-color: transparent; color: var(--blue); }
.tabs button[aria-selected="true"], .tabs button[aria-selected="true"]:hover:not(:disabled) { color: var(--blue); font-weight: 600; border-bottom-color: var(--blue); }
.tabs .n { font-weight: 400; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; }
.toolbar > input[type="search"] { width: 280px; max-width: 100%; }
.toolbar > button.primary { margin-left: auto; }

/* 人：名字在上，编号这些在下面一行 */
.person { display: inline-block; }
.person.inline { display: inline; }
.person .pname { font-weight: 500; }
.person .pname.mono { font-weight: 400; }
td .left { color: var(--muted); font-size: 12px; }
td .left.soon { color: var(--gold-d); }
td.strong { font-weight: 600; }
td .bad { color: var(--red-d); font-weight: 600; }
td.reason { max-width: 340px; }
td > .tag:first-child, .row-actions .tag { margin-left: 0; }

/* 筛选条：一格一格带标题的输入，整行铺满、一样宽（.wide 的宽一些），搜索按钮在最右；放不下就折到下一行。
   一格是 label（标题 + 输入），也可以是 .fld 的 div（标题 + 输入 + 贴在右端的按钮，例如记录页账号框的「找人」）。 */
.toolbar > .filters { flex: 1 1 auto; min-width: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters > label, .filters > .fld { flex: 1 1 180px; min-width: 0; display: flex; align-items: stretch; height: 32px; border: 1px solid var(--ctl); border-radius: var(--r-s); background: white; color: var(--ink-2); overflow: hidden; }
.filters > .fld.wide { flex: 1.6 1 260px; }
.filters > label > span, .filters > .fld > span, .filters > .fld > label { display: flex; align-items: center; flex: none; padding: 0 10px; background: var(--tint); border-right: 1px solid var(--line); white-space: nowrap; }
.filters > label input, .filters > label select, .filters > .fld input, .filters > .fld select { flex: 1 1 auto; width: 100%; height: 30px; border: 0; border-radius: 0; box-shadow: none; min-width: 0; }
.filters > label:hover, .filters > .fld:hover { border-color: var(--ctl-hover); }
.filters > label:focus-within, .filters > .fld:focus-within { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.filters > .fld > button.link { flex: none; height: auto; padding: 0 12px; border-left: 1px solid var(--line); border-radius: 0; background: var(--tint); color: var(--blue); }
.filters > .fld > button.link:hover:not(:disabled) { background: var(--blue-t1); text-decoration: none; }
.filters > button[type="submit"] { flex: none; min-width: 80px; }
/* 找人的结果：在筛选条下面单独一行，找到的人一个一个列成小块。 */
.filters > .found { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.filters > .found:empty { display: none; }
.filters > .found button.link { margin: 0; padding: 2px 10px; border: 1px solid var(--blue-t2); border-radius: var(--r-xs); background: var(--blue-t1); color: var(--blue-h); font-size: 12px; line-height: 18px; }
.filters > .found button.link:hover:not(:disabled) { border-color: var(--blue); text-decoration: none; }

/* 记录页按账号查的时候，明细上面那张账号卡（2026-11-25）：一条横带，从左到右是谁、几个数、今天的额度、能做的事。
   卡窄了（按卡自己有多宽，不按屏幕）先折成两层：上面一行是谁和按钮，下面是数和额度；再窄就一块一层。 */
.acct-box { margin: 0 16px 12px; container-type: inline-size; }
.acct-box.msg { padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--r-m); color: var(--muted); }
.acct { display: grid; grid-template-columns: fit-content(380px) auto minmax(0, 1fr) auto; border: 1px solid var(--line); border-radius: var(--r-m); background: white; overflow: hidden; }
.acct > * { grid-row: 1; min-width: 0; margin: 0; padding: 10px 16px; border-left: 1px solid var(--line-2); }
.acct-who { grid-column: 1; border-left: 0 !important; background: var(--tint); }
.acct-stats, .acct-empty { grid-column: 2; }
.acct-quotas { grid-column: 3; }
.acct-actions { grid-column: 4; }
.acct-who .person .pname { font-size: 15px; line-height: 22px; font-weight: 600; }
.acct-who .person .pname.mono { font-size: 14px; }
.acct-who .person .hint { margin-top: 2px; line-height: 18px; }
.acct-state { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: 10px; vertical-align: 2px; }
.acct-state .tag { margin-left: 0; }
.acct-stats { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.acct-stat { display: flex; flex-direction: column; min-width: 56px; }
.acct-stat .label { color: var(--muted); font-size: 12px; line-height: 18px; white-space: nowrap; }
.acct-stat b { font-size: 20px; line-height: 28px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-stat b small { margin-left: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }
.acct-stat.bad b { color: var(--red-d); }
.acct-stat .sub { color: var(--muted); font-size: 12px; line-height: 18px; white-space: nowrap; }
.acct-stat.would .sub, .acct-stat.bad .sub { color: var(--gold-d); }
.acct-empty { align-self: center; color: var(--muted); }
/* 额度：一条一行，几条的名字、条、数各自对齐（subgrid）。名字、补的那句太长就截断，悬停看全。 */
.acct-quotas { display: grid; grid-template-columns: minmax(0, max-content) minmax(56px, 1fr) max-content minmax(0, max-content); align-content: start; align-items: center; gap: 4px 12px; }
.acct-quotas h3 { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; line-height: 18px; font-weight: 400; }
.acct-quotas > p { grid-column: 1 / -1; margin: 0; }
.quota { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; min-width: 0; min-height: 22px; }
.quota .q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.quota .q-num { white-space: nowrap; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.quota .q-num b { color: var(--ink); font-size: 14px; font-weight: 600; }
.quota.full .q-num b { color: var(--red-d); }
.quota.near .q-num b { color: var(--gold-d); }
.quota .q-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.quota.soft .q-note { color: var(--gold-d); }
.quota progress { display: block; width: 100%; height: 6px; margin: 0; border: 0; border-radius: 3px; background: var(--line-2); overflow: hidden; -webkit-appearance: none; appearance: none; }
.quota progress::-webkit-progress-bar { background: var(--line-2); border-radius: 3px; }
.quota progress::-webkit-progress-value { background: var(--blue); border-radius: 3px; }
.quota progress::-moz-progress-bar { background: var(--blue); border-radius: 3px; }
.quota.near progress::-webkit-progress-value { background: var(--gold-2); }
.quota.near progress::-moz-progress-bar { background: var(--gold-2); }
.quota.full progress::-webkit-progress-value { background: var(--red); }
.quota.full progress::-moz-progress-bar { background: var(--red); }
.quota.soft progress::-webkit-progress-value { background: var(--disabled); }
.quota.soft progress::-moz-progress-bar { background: var(--disabled); }
.acct-actions { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 4px; }
.acct > .acct-foot { grid-column: 1 / -1; grid-row: 2; padding: 6px 16px; border-left: 0; border-top: 1px solid var(--gold-line); background: var(--gold-t); color: var(--gold-d); font-size: 12px; }
@container (max-width: 1080px) {
  .acct { grid-template-columns: auto minmax(0, 1fr) auto; }
  .acct-who { grid-column: 1 / 3; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
  .acct-who .person { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
  .acct-who .person .hint { margin-top: 0; }
  .acct-actions { grid-column: 3; flex-direction: row-reverse; align-items: center; border-left: 0; background: var(--tint); }
  .acct-stats, .acct-empty { grid-column: 1; grid-row: 2; border-left: 0; border-top: 1px solid var(--line-2); }
  .acct-quotas { grid-column: 2 / -1; grid-row: 2; border-top: 1px solid var(--line-2); }
  .acct > .acct-foot { grid-row: 3; }
}
@container (max-width: 640px) {
  .acct { grid-template-columns: minmax(0, 1fr) auto; }
  .acct-who { grid-column: 1; }
  .acct-actions { grid-column: 2; }
  .acct-stats, .acct-empty { grid-column: 1 / -1; }
  .acct-quotas { grid-column: 1 / -1; grid-row: 3; border-left: 0; }
  .acct > .acct-foot { grid-row: 4; }
}
/* 记录页的明细：一页几十条，行矮一些。 */
table.records td { padding-top: 8px; padding-bottom: 8px; }

/* 建议 */
.suggestion { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 14px 16px; border-top: 1px solid var(--line-2); }
.card-head + .suggestion { border-top: 1px solid var(--line-2); }
.suggestion .facts { grid-column: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.suggestion .facts span { padding: 1px 8px; border-radius: var(--r-xs); background: var(--tint); color: var(--ink-2); font-size: 12px; line-height: 20px; }
.suggestion .row-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.suggestion .title strong { font-weight: 600; }
.suggestion .title .person .pname { font-weight: 600; }

/* ---------- 弹窗：标题在左，操作在右上 ---------- */
dialog { width: min(560px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: var(--r-l); box-shadow: var(--sh-modal); color: var(--ink); }
/* 弹窗的顶边钉住，不上下居中：「确定」在右上角，里面的内容变高（要再确认的提醒、晚到的人名和「最近 7 天」）时，
   居中的弹窗会整个往上挪半截，正要点、点着的那一下就落空了（测试组 2026-11-22 第 9 条）。 */
dialog:modal { margin-top: 10vh; margin-bottom: auto; max-height: calc(90vh - 24px); max-height: calc(90dvh - 24px); }
dialog::backdrop { background: var(--mask); }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
#dialog-body h3 { margin: 16px 0 8px; font-size: 13px; line-height: 20px; font-weight: 600; }
#dialog-body h3:first-of-type { margin-top: 4px; }
.picker-search { display: flex; gap: 8px; }
.picker-search input { flex: 1; min-width: 0; }
.picker-results { max-height: 248px; margin-top: 8px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-m); }
.picker-results th { position: sticky; top: 0; padding: 7px 12px; }
.picker-results td { padding: 8px 12px; vertical-align: middle; }
.picker-results tr.pickable { cursor: pointer; }
.picker-results tr:has(input:checked) td { background: var(--blue-t1); }
#dialog-body .picker-search + p { margin: 8px 0 0; }
.picker-results input[type="checkbox"] { width: 16px; height: 16px; padding: 0; vertical-align: middle; }
.picker-results .tag { margin-left: 6px; }
.picker-results tbody:empty::after { content: "还没有结果"; display: block; padding: 20px; color: var(--muted); text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.chips:empty::after { content: "还没有选人"; color: var(--muted); font-size: 12px; line-height: 26px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--r-xs); background: var(--blue-t1); color: var(--blue-h); font-variant-numeric: tabular-nums; }
.chip button.link { color: var(--blue-h); font-size: 14px; line-height: 1; }
.picker-form { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 0 16px; align-items: start; }
.picker-form textarea { height: 56px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
/* 弹窗高过屏幕、往下翻着填原因时，标题和「确定」留在上面（评审 低）。 */
.dialog-head { position: sticky; top: 0; z-index: 2; background: white; }
.dialog-head h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.dialog-head .actions { display: flex; gap: 8px; flex: none; }
.dialog-head button { height: 36px; padding: 0 18px; font-size: 14px; }
#dialog-body { padding: 16px 20px 6px; }
#dialog-body p { margin: 0 0 12px; }
#dialog-body label { display: block; margin-bottom: 14px; color: var(--ink-2); }
#dialog-body label > input, #dialog-body label > select, #dialog-body label > textarea { display: block; width: 100%; margin-top: 6px; }
#dialog-error { margin: 0; padding: 0 20px 14px; }
#dialog-form::after { content: ""; display: block; height: 10px; }
dl.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0; margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
dl.kv dt { padding: 8px 12px; background: var(--tint); color: var(--muted); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
dl.kv dd { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--line-2); overflow-wrap: anywhere; }
dl.kv dt:last-of-type, dl.kv dd:last-of-type { border-bottom: 0; }

/* 操作日志（Story 4.8） */
.oplog .toolbar + .toolbar { padding-top: 0; }
.oplog .daybar { margin-bottom: 0; }
.oplog .daybar input[type="date"] { width: auto; }
.oplog .filters input[type="search"] { min-width: 220px; }
.oplog .found-note { margin: 0; padding: 0 16px 8px; }
.oplog td { vertical-align: top; }
.oplog td.chgs { min-width: 220px; max-width: 420px; }
.oplog td.act, .oplog td.act button { white-space: nowrap; }
.oplog td.who { white-space: nowrap; }
.oplog td.empty.bad { color: var(--red-d); }
.oplog td.reason { min-width: 120px; }
.oplog .chg { overflow-wrap: anywhere; }
.oplog .chg + .chg { margin-top: 2px; }
.oplog .chg .what { color: var(--muted); }
.oplog .chg .arrow { color: var(--muted); }
.oplog .chg b { font-weight: 600; color: var(--ink); }
.oplog .chg.muted { color: var(--muted); font-size: 12px; }
.oplog .chg.bad, .oplog tr.bad-entry td.num { color: var(--red-d); }
.oplog tr.more > td { background: var(--tint); padding: 12px 16px; }
.oplog .oplog-more dl.kv { max-width: 760px; background: white; }
.oplog .raw-list .raw { padding: 4px 0; border-top: 1px solid var(--line-2); overflow-wrap: anywhere; }
.oplog .raw-list .raw .chg { margin-bottom: 2px; }
.oplog .raw code, .oplog .raw .mono { white-space: pre-wrap; word-break: break-all; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sider { position: static; height: auto; }
  .menu { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 8px; }
  .menu .group { width: 100%; }
  .menu .sub { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; background: none; }
  .menu button { width: auto; padding: 0 12px; }
  .topbar { position: static; height: auto; flex-wrap: wrap; padding: 8px 12px; }
  .main { padding: 12px; }
  .me { display: none; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .form-row .ctl { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
  .card.form { padding: 12px 12px 0; }
  .form-foot { margin: 16px -12px 0; padding: 12px; }
  .page-head { flex-wrap: wrap; }
}
