/* 访客入厂培训及验证系统 —— 全局样式（移动端优先，无外部依赖）
 *
 * 目录（改样式前先按分区定位，别乱加）：
 *   ① Design tokens   —— :root 变量（色板 / 圆角 / 阴影 / 动效）——**先找现成变量，别写死颜色**
 *   ② Base / 布局      —— body、.wrap、.appbar、.card、.btn、表单控件、.toolbar / .filter-bar
 *   ③ 组件             —— 药丸 / 表格 / toast / 状态块 / 表单网格 / 分页等可复用块
 *   ④ 业务页面         —— 访客端（登记/答题/通行证/被拦）、门卫核验台、后台（含黑名单第 1 步）、
 *                        张贴卡打印样式、车牌键盘与自研月历
 *   ⑤ 打印与响应式     —— @media print、@media (max-width: 640px / 560px / 420px)
 *
 * 约定：新增样式尽量挂在**已有 token** 上（见①），改完跑 `tools.ui_check` + `tools.mobile_check`。
 * 2026-09 决定**不拆成多个文件**：`tests/test_frontend_assets.py` 有大量 `assert "…" in css`
 * 的字符串断言、`app/main.py::_page()` 还要同步 `?v=` 与多个 <link>，拆分收益（可读性）抵不上风险。
 */
:root {
  --blue: #1560a8;
  --blue-dark: #0f4a80;
  --green: #16805a;
  --amber: #c86a0c;
  --red: #c62828;
  --bg: #f2f5f8;
  --card: #ffffff;
  --text: #1f2429;
  --muted: #6e747a;
  --border: #e2e7ec;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(16, 32, 48, .07);
  /* ---- 视觉升级 tokens：只新增，上面 12 个旧变量名与值一字未动 ---- */
  --blue-lite: #1e74c4;      /* 页眉渐变起点（顶部提亮），与通行证证面主色同族 */
  --blue-ink: #0d3e74;       /* 页眉渐变终点，= 通行证证面 secondary 色 */
  --blue-soft: #eaf3fc;
  --green-soft: #e8f6ef;
  --amber-soft: #fdf1e0;
  --red-soft: #fdecec;
  --gray-soft: #eef1f4;
  --hair: #e9edf1;           /* 细分隔线，= 通行证证面 HAIR 色 */
  --border-strong: #d3dae1;
  --shadow-sm: 0 1px 3px rgba(16, 32, 48, .06);
  --shadow-md: 0 6px 20px rgba(16, 32, 48, .10);
  --shadow-lg: 0 14px 40px rgba(16, 32, 48, .16);
  --ring: 0 0 0 3px rgba(21, 96, 168, .18);
  --radius-sm: 10px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --t-fast: .15s;
  --t-med: .25s;
  --ease: cubic-bezier(.4, 0, .2, 1);
  /* ---- 后台概览 v5（2026-10-21）：只在 body.admin-page 里使用，不影响访客端/门卫端 ---- */
  --a-side-1: #1d4ed8;
  --a-side-2: #2563eb;
  --a-side-3: #3b82f6;
  --a-side-4: #60a5fa;
  --a-accent: #38bdf8;
  --a-type-visit: #2563eb;
  --a-type-contractor: #f97316;
  --a-type-driver: #8b5cf6;
  --a-page-bg: #f1f5f9;
  /* ---- 表格 / 浅底语义 token（UI 第二批，2026-09）----
     以前表格里写死 #fff / #f7f9fb / #fafbfd / #f4f9ff：暗色模式只覆盖 token 就能整体适配，
     不用一处处找写死的色值。--surface 与 --card 目前同值，但语义分开：表格外壳走 surface。 */
  --surface: #ffffff;        /* 表格 / 列表外壳底色 */
  --surface-2: #f7f9fb;      /* 表头、次级浅底 */
  --surface-3: #fafbfd;      /* 斑马行 */
  --row-hover: #f4f9ff;      /* 表格行悬浮 */
  /* ---- 暗色模式用的配套 token（UI 第三批，2026-09）----
     这几个是"扫尾"出来的：以前散在各组件里写死，暗色下会露出亮色块。 */
  color-scheme: light;       /* 让浏览器原生控件（滚动条、自动填充、下拉）跟着亮/暗走 */
  --field: #fbfcfd;          /* 输入框默认底 */
  --field-soft: #f7f9fc;     /* 键盘 / 日期面板等浅底 */
  --line-soft: #e6ebf0;      /* 进度条底等 */
  --hover-border: #b9d4ee;   /* 可点卡片 / 选项框的悬浮描边 */
  --amber-border: #f2ddbb;   /* 倒计时药丸的描边 */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55;
}
a { color: var(--blue); text-decoration: none; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 14px calc(40px + env(safe-area-inset-bottom, 0px)); }
.wrap.wide { max-width: 1180px; }

.appbar {
  background: linear-gradient(135deg, var(--blue-lite) 0%, var(--blue) 48%, var(--blue-ink) 100%);
  color: #fff; padding: calc(16px + env(safe-area-inset-top, 0px)) 0 18px; margin-bottom: 16px;
  box-shadow: 0 8px 24px -12px rgba(13, 62, 116, .55);
}
.appbar .inner { max-width: 560px; margin: 0 auto; padding: 0 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; row-gap: 8px; }
.appbar.wide .inner { max-width: 1180px; }
.appbar .brand { font-size: 13px; opacity: .85; }
.appbar h1 { margin: 2px 0 0; font-size: 21px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.appbar .spacer { flex: 1; }
/* 顶栏内容多了不能把标题挤成竖排（2026-09 客户反馈"门卫核验台页面 UI 很乱"）：
   标题块 .bar-head 占剩余宽度，状态/操作药丸收进 .bar-tools —— 手机上整组折到第二行，
   药丸自己 nowrap（窄屏宁可换行，也不要把「2026-09-14 入场 1 次」压成椭圆）。 */
.appbar .bar-head { flex: 1 1 auto; min-width: 0; }
.appbar .bar-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.appbar .chip { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.24); border-radius: var(--radius-pill); padding: 5px 12px; font-size: 13px; flex: 0 0 auto; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) {
  /* 手机上标题独占一行、药丸整行落到第二行并靠左（横排比"标题竖排"好读得多） */
  .appbar .bar-head { flex: 1 1 100%; }
  .appbar .bar-tools { flex: 1 1 100%; justify-content: flex-start; }
}
/* 顶部栏是蓝底：链接必须跟随 .appbar 的白色文字，否则会继承全局 a 的蓝色而看不清 */
.appbar a, .appbar a:visited { color: inherit; }
.appbar .chip.link { cursor: pointer; }
.appbar .chip.link:hover { background: rgba(255,255,255,.34); }

/* 页内小药丸（浅底版）：访客页去掉顶部蓝条后，「入口门岗」「第 N 次答题」这类状态
   要有个放在卡片里的样子（原来只有 .appbar .chip 这个蓝底版本）。
   颜色全走 token，暗色模式自动跟随；只在文字旁做标识，不承担点击。 */
.chip-plain { display: inline-flex; align-items: center; gap: 6px; background: var(--gray-soft); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px 12px; font-size: 13px; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 18px; margin-bottom: 14px; }
.card h2 { position: relative; font-size: 17px; margin: 0 0 12px; padding-left: 12px; }
/* 标题左侧 4px 主色竖条：与通行证证面「注意事项」标题同一视觉语言 */
.card h2::before {
  content: ""; position: absolute; left: 0; top: .22em; bottom: .22em; width: 4px; border-radius: 2px;
  background: linear-gradient(180deg, var(--blue-lite), var(--blue));
}
/* 居中标题（如打印张贴码页 .card.center）不加缩进/竖条，避免标题偏离中心、竖条跑到卡片最左边 */
.center h2 { padding-left: 0; }
.center h2::before { display: none; }
.card .hint { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
/* 网格子项默认 min-width:auto，会被内部"最小内容宽度"撑破容器（手机上表现为整页能左右拖动） */
.grid2 > * { min-width: 0; }
@media (max-width: 720px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

/* ---------- 后台表单网格 / 筛选栏（把"一坨输入框"拆成分组排版） ---------- */
/* 列数固定为 3 / 2 / 1：原来用 auto-fit 会随窗口宽度变列数，同一个后台在不同电脑上排版不一致 */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; margin-top: 12px; }
@media (max-width: 1000px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-grid .field { margin-bottom: 0; }
.form-grid .field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-grid .field input, .form-grid .field select { width: 100%; }
.form-grid .field .small { color: var(--muted); margin-top: 4px; }
/* 注意：不要用 opacity 淡出来"禁用"带交互组件的字段（车牌键盘曾因此"淡着但仍能点开"）。
   要禁就整块 hidden 或调用组件自己的 setEnabled(false)，见 app/static/js/plate.js。 */
/* 分步标题（黑名单页「① 找到人 / 车 → ② 填拉黑信息」）：让"先查后拉黑"的顺序一眼可见 */
.step-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin-top: 18px; }
.step-title > i {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #fff;
  font-style: normal; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
/* 第 2 步的「当前目标」：点「加入黑名单」之前先看清拦住的是谁 / 哪辆车 */
.target-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px;
  padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
/* 「更多设置（可选）」折叠区：把次要字段收起来，默认只留 3 个必填/常用项 */
.more-box { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; }
.more-box > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.more-box[open] > summary { margin-bottom: 4px; color: var(--text); }
/* 候选列表：选中行高亮 + 单选钮放大（操作人常在触摸屏 / 平板上点） */
.data tr.picked td { background: var(--blue-soft); }
.data input[type="radio"], .data input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }
/* 候选行「点整行 = 选中，再点 = 取消」（见 admin_b.js 的 click 委托）：
   行本身可点（含前面的小圆圈），鼠标样式与悬停高亮要跟得上，否则用户不知道能点。 */
.data tbody tr[data-pick-row] { cursor: pointer; }
.data tbody tr[data-pick-row]:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.data tr.picked td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
/* 已在黑名单的候选行：小圆圈是 disabled 的，而浏览器**不会**在 disabled 控件上派发 click，
   点在圆圈上会"没反应" → 让它穿透到行上，由行上的 toast 说明为什么不能选 */
.data tr[data-locked="1"] input[type="radio"] { pointer-events: none; }
/* 跨 2 列：给「车牌键盘」这类需要横向空间的字段用（普通车牌 7 格 / 新能源 8 格，
   3 列网格里单列只有 ~285px，跨 2 列 ≈580px 才放得下完整一格 42px 的键盘）。 */
.form-grid .field.span2 { grid-column: span 2; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar input { flex: 1 1 220px; min-width: 160px; }
.filter-bar select { flex: 0 0 auto; }
/* 筛选栏里的「维度」下拉（黑名单页第 1 步：按姓名 / 手机号 / 车牌号 / 通行证号）：
   select 全局是 width:100%，在 filter-bar 里会独占一整行，看着像排版没做完 → 这里收紧成内容宽度 */
.filter-bar select.pick-dim { width: auto; min-width: 150px; }

/* 黑名单第 1 步：把「输入框 + 车牌键盘」结成**同一列**（.filter-q），键盘才会与输入框对齐。
   背景（2026-09 客户反馈）：键盘原来挂在 .filter-bar 的兄弟节点上，从卡片最左边开始，
   而输入框前面还隔着「维度下拉」，两者错开约 160px，看着像"排版没做完"。 */
.filter-bar .filter-q { flex: 1 1 220px; min-width: 160px; display: flex; flex-direction: column; }
/* 列内的输入框不再自己撑宽：`.filter-bar input` 的 flex: 1 1 220px 在**竖向** flex 列里
   会被当成"高度"来解释，必须在这里覆盖回内容高度 */
.filter-bar .filter-q > input { width: 100%; flex: 0 0 auto; min-width: 0; }
/* 车牌格子随列宽**铺满**：与输入框左右两条边都对齐
   （原来固定 42px + 左对齐，右边会短一截，看着仍然"没对齐"） */
.filter-bar .filter-q .plate-cell { flex: 1 1 42px; }

/* ---------- 手机适配（访客全流程在手机上，门卫也常用手机核验） ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 12px calc(32px + env(safe-area-inset-bottom, 0px)); }
  .card { padding: 14px; }
  .card h2 { font-size: 16px; }
  .status { padding: 16px; }
  .status .big { font-size: 22px; }
  .status .sub { font-size: 13px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
  .btn { min-height: 44px; }          /* 触控目标：安卓/iOS 都建议 ≥44px，戴手套也好点 */
  .btn-row { gap: 8px; }
  .btn-row .btn { flex: 1 1 100%; }    /* 手机上一行一个按钮，拇指够得着 */
  /* 主操作按钮占整行且更高：门卫手机上核验时一眼能看到、好点 */
  .toolbar .btn-primary, .toolbar .btn-green, .toolbar .btn-danger,
  .filter-bar .btn-primary, .filter-bar .btn-green, .filter-bar .btn-danger { flex: 1 1 100%; min-height: 50px; font-size: 17px; }
  .toolbar .checkbox { flex: 0 0 auto; align-items: center; padding: 4px 0; }
  .table-wrap { -webkit-overflow-scrolling: touch; }  /* 宽表格在手机上横滑 */
  .data th, .data td { padding: 8px 10px; font-size: 13px; }
  .toolbar input, .toolbar select, .filter-bar input, .filter-bar select { min-width: 0; flex: 1 1 100%; }
  /* 手机上「输入框 + 车牌键盘」这一列仍独占一整行（与改动前输入框的行为一致，免得跟按钮挤一行） */
  .filter-bar .filter-q { flex: 1 1 100%; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field.span2 { grid-column: auto; }   /* 单列时跨列会造出隐式第二列，必须还原 */
  .filter-bar input { flex: 1 1 100%; }
}
/* 输入控件统一样式。
   注意：后台里大量 <input> 没写 type 属性（默认就是 text），只写 input[type=text] 会**漏掉它们**，
   表现为"同一个页面里输入框高矮不一"（那些漏掉的高度只有 21px）——所以这里用 :not(...) 反向排除，
   兜住所有文本类输入，保证全后台控件高度/边框/字号一致。 */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=image]):not([type=range]),
select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; background: var(--field); color: var(--text); outline: none; min-height: 44px;
}
input[type=file] { min-height: 44px; font-size: 13px; color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); background: var(--surface); box-shadow: var(--ring); }
/* 悬停时给个"可以点"的反馈（原来只有获得焦点才有变化） */
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--border-strong); }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
/* 勾选框统一系统主色：原来用浏览器默认蓝（#0b57d0），和整站蓝不一致 */
input[type=checkbox], input[type=radio] { accent-color: var(--blue); }
.checkbox input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--blue); }

/* 键盘可达性（2026-09）：输入框与 .btn 已有焦点环，但链接 / 标签页 / 药丸 / 车牌按键
   这些"看起来能点"的元素以前没有 —— 键盘 Tab 过去时看不见焦点在哪。
   统一补一圈主色焦点环（鼠标点击不会触发 :focus-visible，所以不影响观感）。 */
a:focus-visible, .tab:focus-visible, .chip:focus-visible,
.plate-key:focus-visible, .plate-collapse:focus-visible,
.pw-toggle:focus-visible, .captcha-options button:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px;
}

/* ---------- 密码框（App.passwordInput，见 app/static/js/app.js） ----------
   👁「显示 / 隐藏」按钮 + 全角自动校准提示。
   背景（2026-09 客户踩到）：中文输入法下句号键打出的是全角「。」，密码又被圆点挡住，
   于是"明明输对了却提示密码不正确"。
   绝对定位是为了**不改调用方布局** —— 密码框散布在页面里与动态渲染的表单里，
   按钮固定贴在输入框右上角（40×44 的触摸目标）即可。 */
.pw-field { position: relative; display: block; }
.pw-field > input { width: 100%; padding-right: 54px; }
.pw-toggle {
  position: absolute; right: 7px; top: 0; width: 40px; height: 44px; padding: 0;
  border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); font-size: 17px; line-height: 1;
}
.pw-toggle:hover { background: var(--gray-soft); color: var(--blue); }
.pw-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.pw-hint {
  margin-top: 6px; color: var(--amber); font-size: 12px; line-height: 1.5;
}

/* ---------- 设计样张页（/styleguide）的色板小格 ----------
   只在那一页用；其它页面别引用，免得把工具页的样式带进业务页面。 */
.sg-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.sg-swatch {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px;
  min-width: 96px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card);
}
.sg-swatch i { display: block; width: 100%; height: 26px; border: 1px solid var(--hair); border-radius: 6px; }
.sg-swatch b { font-size: 12px; }
.sg-swatch em { font-size: 11px; color: var(--muted); font-style: normal; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 12px 18px; border-radius: var(--radius-sm); font-size: 15px; cursor: pointer; font-weight: 600;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
/* 键盘操作才显示焦点环：鼠标点击不留一个空框 */
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary {
  background: linear-gradient(135deg, var(--blue-lite), var(--blue)); border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px -6px rgba(21, 96, 168, .65);
}
.btn-primary:hover { box-shadow: 0 8px 20px -8px rgba(21, 96, 168, .70); }
.btn-green {
  background: linear-gradient(135deg, #1ba173, var(--green)); border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px -6px rgba(22, 128, 90, .60);
}
.btn-danger {
  background: linear-gradient(135deg, #d93b34, var(--red)); border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px -6px rgba(198, 40, 40, .60);
}
/* 次要按钮：白底 + 主色字 + 描边（原来白底黑字，与主按钮抢注意力） */
.btn:not(.btn-primary):not(.btn-green):not(.btn-danger):not(.btn-soft) { border-color: var(--border-strong); color: var(--blue); }
.btn:not(.btn-primary):not(.btn-green):not(.btn-danger):not(.btn-soft):hover { border-color: var(--blue); background: var(--blue-soft); }
.btn-soft { background: var(--blue-soft); border-color: var(--hover-border); color: var(--blue); }
.btn-soft:hover { border-color: var(--blue); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 20px; font-size: 17px; border-radius: var(--radius); }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 登记页安全校验：4 个答案排成一行（原来换行成两行，看着像两组问题） ---------- */
.captcha-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.captcha-options .btn { min-height: 44px; padding: 10px 6px; font-size: 17px; }
@media (max-width: 560px) { .captcha-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- 访客类型选择 ---------- */
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.type-item { border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 14px 8px; text-align: center; cursor: pointer; background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.type-item:hover { border-color: var(--hover-border); background: var(--row-hover); }
.type-item .icon { font-size: 26px; display: block; margin-bottom: 4px; }
.type-item .name { font-weight: 700; font-size: 15px; }
.type-item .desc { color: var(--muted); font-size: 11px; margin-top: 3px; line-height: 1.3; }
.type-item.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 4px 14px -8px rgba(21, 96, 168, .60); }
@media (max-width: 420px) {
  .type-grid { grid-template-columns: 1fr; }
  .type-item { display: flex; gap: 12px; text-align: left; padding: 12px; align-items: center; }
  .type-item .icon { margin: 0; }
}

/* ---------- 状态横幅 ---------- */
.status {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 20px; color: #fff;
  text-align: center; margin-bottom: 14px; box-shadow: 0 12px 28px -16px rgba(16, 32, 48, .55);
}
.status .big { font-size: 26px; font-weight: 800; letter-spacing: 1px; }
.status .sub { opacity: .92; font-size: 14px; margin-top: 6px; }
.status .metric { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 15px; background: rgba(255,255,255,.20); border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius-sm); padding: 10px; }
/* 每项自己一格、绝不拆行：原来用「　·　」拼成一行，窄屏会从分隔符处断成两截（客户反馈"分行不美观"） */
.status .metric .mi { white-space: nowrap; }
.status.ok { background: linear-gradient(135deg, #1a9e6d, #12734e); }
.status.warn { background: linear-gradient(135deg, #e0891a, #b96b06); }
.status.bad { background: linear-gradient(135deg, #d9433a, #a91d1d); }
.status.muted { background: linear-gradient(135deg, #7b8794, #5b6673); }
/* 右下角淡色符号水印（✓ / ! / ✕）：给"结论"一个视觉落点，透明度低不抢文字 */
.status > * { position: relative; z-index: 1; }
.status::after {
  content: ""; position: absolute; right: -18px; bottom: -22px; width: 132px; height: 132px; opacity: .16;
  background-repeat: no-repeat; background-position: center; background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M12 34l14 14 26-30' fill='none' stroke='white' stroke-width='9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.status.warn::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M32 11v27' fill='none' stroke='white' stroke-width='9' stroke-linecap='round'/%3E%3Ccircle cx='32' cy='52' r='5.5' fill='white'/%3E%3C/svg%3E");
}
.status.bad::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M16 16l32 32M48 16L16 48' fill='none' stroke='white' stroke-width='9' stroke-linecap='round'/%3E%3C/svg%3E");
}
.status.muted::after { background-image: none; }

/* ---------- 答题 ---------- */
.q-item { border-bottom: 1px dashed var(--hair); padding: 14px 0; }
.q-item:last-child { border-bottom: none; }
.q-stem { font-weight: 600; margin-bottom: 10px; }
.q-tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--blue); background: var(--blue-soft); border-radius: var(--radius-pill); padding: 2px 9px; margin-right: 6px; vertical-align: 2px; }
.q-option {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 12px; margin-bottom: 8px; cursor: pointer; background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.q-option:hover { border-color: var(--hover-border); background: var(--row-hover); }
.q-option .mark { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); flex: 0 0 22px; text-align: center; line-height: 20px; font-size: 12px; color: var(--muted); background: var(--surface); }
.q-option.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: var(--ring); }
.q-option.active .mark { background: var(--blue); border-color: var(--blue); color: #fff; }
.q-option.judge .mark { border-radius: 6px; }
.q-option.correct { border-color: var(--green); background: var(--green-soft); }
.q-option.wrong { border-color: var(--red); background: var(--red-soft); }
.explain { font-size: 13px; color: var(--muted); background: var(--surface-2); border-left: 4px solid var(--blue); padding: 8px 10px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-top: 8px; }
/* 倒计时做成小药丸：原来是裸橙字，和正文混在一起不显眼 */
.timer { display: inline-block; font-weight: 700; color: var(--amber); background: var(--amber-soft); border: 1px solid var(--amber-border); border-radius: var(--radius-pill); padding: 3px 12px; }
.progress { height: 8px; background: var(--line-soft); border-radius: var(--radius-pill); overflow: hidden; margin: 6px 0 14px; }
.progress > i { display: block; height: 100%; width: 0; transition: width var(--t-med) var(--ease);
  background: linear-gradient(90deg, var(--blue-lite), var(--blue)); box-shadow: 0 0 8px rgba(21, 96, 168, .45); }
.points { padding-left: 20px; margin: 8px 0 0; }
.points li { margin-bottom: 8px; }

/* ---------- 现场核验：秒级实时时钟 + 短时效二维码（截图无效） ---------- */
/* 通行证改为"只出现场实时二维码"：网页不再放可截图的静态二维码（见 badge.html），
   现场码带 5 分钟时效，截图后很快失效；时钟取自服务端时间，防止改手机时间。 */
.live-clock {
  font-family: ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums;
  font-size: 32px; font-weight: 800; letter-spacing: 1px; text-align: center; color: var(--blue);
}
.live-clock .date { display: block; font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.qr-wrap { position: relative; width: 220px; max-width: 100%; margin: 12px auto 6px; }
.qr-wrap img { display: block; width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.qr-wrap .qr-mask { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.qr-wrap .qr-mask span { font-size: 17px; font-weight: 800; letter-spacing: 2px; white-space: nowrap;
  color: rgba(198, 40, 40, .42); transform: rotate(-24deg); }
.qr-tip { text-align: center; font-size: 13px; font-weight: 600; color: var(--red); }

/* ---------- 现场核验：整合式通行证卡（一张卡里既有证面信息又有实时二维码） ---------- */
/* 设计稿（客户 2026-09 提供）：蓝色页眉 + 左上角一小段绿色 + 证面信息行 + 大二维码
   + 当前时间 + 动态核验码倒计时与进度条 + 入厂安全要求 + 页脚实时状态声明。
   只服务 /v 现场核验页（index.html 里 renderLivePass 渲染出来的结构）。 */
/* 类型配色变量（--pass-lite / --pass-color / --pass-deep / --pass-soft）由卡片页眉的 inline style 注入，
   值来自服务端 `/api/meta`（色源 = `badge_render.THEMES`，与 PNG 原图**同一套色**，
   见 app.js::passPaletteOf）；meta 取不到时用右边的蓝兜底 —— 前端**不写死类型色值**。
   绿/红不参与类型配色：绿=有效、红=失效（进度条 / 倒计时 / "已失效"）。 */
.pass-card { position: relative; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 10px 30px -18px rgba(13, 62, 116, .45); color: var(--text); }
/* 没有顶部栏的页面（通行证页 /badge，2026-09 客户要求去掉与卡内页眉重复的蓝条）：给内容留出上边距 */
.wrap.tight-top { padding-top: 12px; }
/* 首页在「选择页」以外的那两态（现场核验表单 / 核验通过后的二维码卡）不再显示顶部蓝条：
   客户 2026-09-15 定稿 —— 这一页只需要选择页那条蓝条（含右上角「门卫核验」入口）。
   body.no-appbar 只由 app/web/index.html::setTopbar() 切换，别在别处加这个 class。 */
body.no-appbar .appbar { display: none; }
.pass-head { position: relative; padding: 10px 14px 10px 22px; color: #fff; background: linear-gradient(135deg, var(--pass-lite, var(--blue-lite)) 0%, var(--pass-color, var(--blue)) 48%, var(--pass-deep, var(--blue-ink)) 100%); }
.pass-edge { position: absolute; left: 0; top: 0; width: 8px; height: 66px; background: var(--green); border-radius: 0 0 8px 0; }
.pass-head-top { display: flex; align-items: center; gap: 10px; }
.pass-company { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.pass-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--green); font-weight: 800; font-size: 14px; padding: 5px 12px; border-radius: var(--radius-pill); }
.pass-pill i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; }
.pass-pill.warn { color: var(--amber); }
.pass-pill.bad { color: var(--red); }
.pass-title { margin-top: 8px; font-size: 22px; font-weight: 800; letter-spacing: 2px; }
.pass-subtitle { font-size: 11px; letter-spacing: 3px; opacity: .85; margin-top: 1px; }
.pass-body { padding: 8px 14px 2px; }
.pass-row-1 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pass-type { white-space: nowrap; background: var(--pass-soft, var(--blue-soft)); color: var(--pass-color, var(--blue)); font-weight: 700; font-size: 12px; padding: 2px 10px; border-radius: var(--radius-pill); }
.pass-type-en { white-space: nowrap; color: var(--pass-color, var(--blue)); font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.pass-no { margin-left: auto; white-space: nowrap; font-size: 12px; color: var(--muted); }
.pass-no b { color: var(--text); }
.pass-name { font-size: 24px; font-weight: 800; letter-spacing: 2px; margin-top: 3px; }
.pass-note { color: var(--muted); font-size: 13px; margin-top: 1px; }
/* 证面信息区：**两列网格**（客户 2026-09-14：手机上原来只能看到二维码的一半，得把上半部压扁）——
   一行只放得下「标签 + 值」，所以手机上先让位图标（≥560px 宽屏再把图标放回来）。
   2026-09-23：新增「所属单位」整行（见下面 `.pi.wide`）会多占一行 ≈22px，为了仍然
   **整卡装进一个手机屏**（客户端 390×844 护栏见 `tools/ui_check.py`），这里把几处空白收紧：
   body 上内边距 12→8、信息区上边距 8→6 / 上内边距 5→3、每格上下内边距 3→2、二维码块上下 8/4→4/2。 */
.pass-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 10px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 3px; }
.pi { display: flex; align-items: baseline; gap: 5px; padding: 2px 0; font-size: 13px; }
.pi-ico { display: none; }
@media (min-width: 560px) { .pi-ico { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: var(--pass-color, var(--blue)); } }
.pi-k { color: var(--muted); flex: 0 0 auto; }
.pi-v { font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-v.ok { color: var(--green); font-weight: 700; }
/* 值可能很长的字段（所属单位）：**独占一整行**，整条卡宽都给它，不再被省略号截掉
   （客户 2026-09-23 反馈"这个所属单位被折叠了，显示不全"；服务端 PNG 同一口径见
   app/services/badge_render.py::plan_info_cells）。行序与 PNG 一致：
   手机号码｜车牌号码 / 所属单位（整行）/ 培训完成｜有效期至。 */
.pi.wide { grid-column: 1 / -1; }
.pass-qr { position: relative; width: 196px; max-width: 100%; margin: 4px auto 2px; padding: 10px; }
.pass-qr::before { content: ""; position: absolute; inset: 0; border-radius: 14px; pointer-events: none;
  background:
    linear-gradient(var(--pass-color, var(--blue)), var(--pass-color, var(--blue))) left top / 26px 3px no-repeat,
    linear-gradient(var(--pass-color, var(--blue)), var(--pass-color, var(--blue))) left top / 3px 26px no-repeat,
    linear-gradient(var(--pass-color, var(--blue)), var(--pass-color, var(--blue))) right top / 26px 3px no-repeat,
    linear-gradient(var(--pass-color, var(--blue)), var(--pass-color, var(--blue))) right top / 3px 26px no-repeat,
    linear-gradient(var(--pass-color, var(--blue)), var(--pass-color, var(--blue))) left bottom / 26px 3px no-repeat,
    linear-gradient(var(--pass-color, var(--blue)), var(--pass-color, var(--blue))) left bottom / 3px 26px no-repeat,
    linear-gradient(var(--pass-color, var(--blue)), var(--pass-color, var(--blue))) right bottom / 26px 3px no-repeat,
    linear-gradient(var(--pass-color, var(--blue)), var(--pass-color, var(--blue))) right bottom / 3px 26px no-repeat;
}
.pass-qr .qr-wrap { width: 100%; margin: 0; }
.pass-clock { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 10px; margin: 8px auto 0; width: 196px; max-width: 100%; }
.pass-clock-k { color: var(--muted); font-size: 13px; }
.pass-clock .live-clock { font-size: 22px; }
.pass-clock .live-clock .date { display: none; }
.pass-live { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; font-weight: 700; font-size: 14px; }
.pass-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.pass-count { color: var(--green); font-weight: 800; font-size: 18px; margin-left: 8px; }
.pass-count.bad { color: var(--red); }
/* 拿不到动态码时的占位（证失效 / 取码失败）：绝不伪造一张静态码 */
.pass-nostep { margin: 14px auto 0; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: 14px; text-align: center; }
.pass-bar { height: 7px; background: #e6ebf0; border-radius: var(--radius-pill); overflow: hidden; margin: 8px 0 0; }
.pass-bar > i { display: block; height: 100%; width: 0; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--green), #22a06b); transition: width .9s linear; }
.pass-ok { text-align: center; color: var(--green); background: var(--green-soft); border-radius: var(--radius-pill); font-weight: 700; font-size: 13px; padding: 4px 12px; width: fit-content; margin: 6px auto 0; }
.pass-ok.bad { color: var(--red); background: var(--red-soft); }
/* 「返回首页」：通行证页已去掉顶部蓝条（客户 2026-09-14：与卡内页眉重复），
   这个按钮就排在卡内「✓ 安全培训已完成」上方（见 app.js::passCardHtml 的 backLink）。 */
.pass-back { margin-top: 8px; }
/* 入厂安全要求：**默认收起**（客户 2026-09-14：整卡要在一个手机屏里显示完）。
   展开/收起文案由 ::after 出（JS 不写文案）；summary 撑到 40px 以满足触控目标自检。 */
.pass-rules { background: var(--blue-soft); border-radius: var(--radius); margin-top: 8px; padding: 0 12px; }
.pass-rules > summary { display: flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 800; font-size: 15px; color: var(--blue-ink); cursor: pointer; list-style: none; }
.pass-rules > summary::-webkit-details-marker { display: none; }
.pass-rules .rules-caret { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; }
.pass-rules .rules-caret::after { content: "展开"; }
.pass-rules[open] .rules-caret::after { content: "收起"; }
.pass-rules[open] > summary { border-bottom: 1px solid var(--border); }
.pass-rules ul { margin: 6px 0 8px; padding-left: 18px; }
.pass-rules li { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.pass-rules li:last-child { margin-bottom: 0; }
.pass-foot { display: flex; align-items: center; justify-content: center; gap: 8px; border-top: 1px solid var(--border); padding: 6px 14px; font-size: 12px; color: var(--muted); background: #fafbfd; }
.pass-actions { display: flex; gap: 10px; margin-top: 10px; }
.pass-actions .btn { flex: 1; }

/* ---------- 自绘「选择文件」控件 ----------
   原生 `<input type="file">` 的按钮（"选择文件 / 未选择文件"）是浏览器内部渲染的，页面 CSS 进不去
   （同类坑：原生 select 下拉、input[type=date] 日历，见 AI-START.md 的铁律）→ 自己做一个：
   真 input 藏起来，用 `<label class="btn" for="…">` 当按钮、旁边回显文件名。 */
.file-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-pick input[type="file"] { display: none; }
.file-pick .file-name { color: var(--muted); font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.file-pick .btn { flex: 0 0 auto; }

/* 培训视频：适用访客类型的多选（参访 / 施工承包商 / 送货司机）——
   3 个复选框一行，窄屏自动换行；`.checkbox` 自带的前置留白在这里不需要，改成居中。 */
.v-roles { display: flex; gap: 10px; flex-wrap: wrap; }
.v-roles .checkbox { flex: 0 0 auto; align-items: center; white-space: nowrap; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); }
.v-roles .checkbox input { margin: 0; }

/* ---------- 表格（后台各台账共用外观） ----------
   色值一律走 token（暗色模式靠覆盖 token 适配，见文件末尾的 dark 段）；
   ⚠️ sticky 表头的坑：`border-collapse: collapse` 下 th 的 border-bottom 会**跟着内容一起滚走**
   （长台账滚动时看起来"表格裂了一条缝"）→ 那根线改用 `box-shadow: inset 0 -1px 0` 画。 */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { border-bottom: 1px solid var(--hair); padding: 9px 10px; text-align: left; white-space: nowrap; }
table.data th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--muted); font-weight: 600; box-shadow: inset 0 -1px 0 var(--border-strong); }

/* 可拖拽列宽（2026-09-23 客户要求：像 Excel 那样拖，拖窄了文字自动换行）——
   只有带 `data-cols` 的表格会被接线（app.js::App.resizableTables 自动挂），其它表格零影响。
   ⚠️ 表头是 sticky（本身已是定位元素），把手用 absolute 挂在 th 里就行；
   **千万别把 th 的 position 改成 relative**，那会把吸顶表头弄丢。 */
table.data.resizable th, table.data.resizable td { white-space: normal; overflow-wrap: anywhere; }
table.data.resizable th { padding-right: 16px; }
/* ⚠️ 把手必须完全落在列内（right: 0）：往外挂 1px 都会让表格 scrollWidth 变大，
   自检「访客台账不超出面板宽度」会红（876 → 879）。 */
.col-grip { position: absolute; top: 0; right: 0; width: 7px; cursor: col-resize; z-index: 3; touch-action: none; }
.col-grip::after { content: ""; position: absolute; top: 6px; bottom: 6px; left: 3px; width: 1px; background: var(--border-strong); }
.col-grip:hover::after { background: var(--blue); }
body.col-dragging { cursor: col-resize; user-select: none; }
@media (max-width: 899px) { .col-grip { display: none; } }
table.data tbody tr:nth-child(even) td { background: var(--surface-3); }
table.data tr:hover td { background: var(--row-hover); }
table.data tbody tr:last-child td { border-bottom: none; }
/* 数字列（成绩 8/10、剩余天数、今日入场次数）：等宽数字 → 数值变化时列宽不左右跳 */
table.data td.num, table.data td.mono { font-variant-numeric: tabular-nums; }
/* 长文本列（单位名、题干、内部原因）：打省略号，完整值放 title（原来 nowrap 会把整张表顶宽） */
table.data td.clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
/* 多行内容列（例如「培训状态」三个类型各一行）：允许折行，别让 nowrap 把表格顶出去 */
table.data td.wrap { white-space: normal; max-width: 210px; }
/* 分页条：共 N 条 + 上一页 / 下一页（由 AdminCore.pager / bindPager 生成，后台各列表页共用） */
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 13px; color: var(--muted); }
.pager .pager-info { margin-right: auto; }
.pager .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- 后台 ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs .tab { padding: 8px 14px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border); cursor: pointer; font-size: 14px;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.tabs .tab:hover { border-color: var(--blue); color: var(--blue); }
.tabs .tab.active { background: linear-gradient(135deg, var(--blue-lite), var(--blue)); border-color: transparent; color: #fff; box-shadow: 0 4px 12px -6px rgba(21, 96, 168, .70); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
/* KPI 卡：顶部 3px 彩条（蓝 / 绿 / 琥珀轮换）+ 数字等宽对齐（数值变化时不左右跳） */
.stat { background: var(--surface); border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow-sm); border-top: 3px solid var(--blue); }
.stat:nth-child(3n+2) { border-top-color: var(--green); }
.stat:nth-child(3n) { border-top-color: var(--amber); }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 24px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
/* 状态药丸：带同色圆点（与通行证证面药丸同构），一眼能分辨状态 */
.pill { display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; }
.pill::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.muted { background: var(--gray-soft); color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; padding: 9px 12px; font-size: 14px; min-height: 44px; }

/* ---------- 后台宽屏（≥1100px）：顶部药丸导航 → 左侧固定导航 ----------
   用 float 而不是给 #shell 设 display:grid：admin.js 靠行内 style.display 控制 #shell 显隐，
   行内样式优先级高于样式表，改 display 会把"登录后显示后台"的逻辑弄坏。
   #tabs / #panel 是 #shell 的两个直接子元素，float 方案不动 HTML 结构、不动 JS。 */
/* 后台 v5（2026-10-28 第二版）：顶栏并入左侧栏，整页一屏。
   #shell 的显隐仍由 admin.js 行内控制（登录后设为 flex），这里只负责内部布局。 */
body.admin-page { background: var(--a-page-bg); }
.login-brand { margin: 0 0 4px; font-size: 12px; color: var(--muted); letter-spacing: .3px; }
.admin-wrap { max-width: 1320px; padding-bottom: 0; }
.admin-layout {
  display: flex; gap: 16px; align-items: stretch;
  height: calc(100vh - 28px); padding-top: 14px; box-sizing: border-box;
  overflow: hidden;   /* 整页固定一屏：内容再多也只在这里面滚，不把页面拉长 */
}
.side {
  flex: 0 0 224px; display: flex; flex-direction: column; padding: 14px;
  border-radius: var(--radius-lg); color: #fff; overflow: auto;
  background: linear-gradient(180deg, var(--a-side-1) 0%, var(--a-side-2) 45%, var(--a-side-3) 78%, var(--a-side-4) 100%);
  box-shadow: 0 16px 32px -22px rgba(29, 78, 216, .8);
}
.side-brand .brand { font-size: 12px; opacity: .9; }
.side-brand h1 { margin: 2px 0 12px; font-size: 19px; color: #fff; letter-spacing: .5px; }
.side .tabs { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 4px; margin: 0; }
.side .tabs .tab {
  text-align: left; background: transparent; border-color: transparent;
  color: rgba(255, 255, 255, .9); padding: 9px 12px; border-radius: 10px;
}
.side .tabs .tab:hover { background: rgba(255, 255, 255, .16); border-color: transparent; color: #fff; }
.side .tabs .tab.active {
  background: #fff; color: var(--a-side-1); font-weight: 700;
  box-shadow: 0 8px 18px -10px rgba(15, 23, 42, .55);
}
.side-tools { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.side-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.side-chips .chip { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .26); color: #fff; }
.admin-main { flex: 1 1 auto; min-width: 0; min-height: 0; }
.admin-main #panel { height: 100%; min-height: 0; }
.ov-root { height: 100%; display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.ov-root > .ov-grid { flex: 1 1 auto; min-height: 0; }
.ov-card-table { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.ov-card-table .table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
.ov-side { min-height: 0; overflow: auto; }

/* ---------- 后台概览 v5（2026-10-21）：问候带 / KPI / 图表 / 今日入园 ----------
   注意：本段刻意不放 900 像素断点的媒体查询 —— 静态钉按"文件里第一处该断点"切片取规则。 */
.ov-hero {
  position: relative; overflow: hidden; display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: space-between; padding: 16px 22px; margin-bottom: 12px;
  border-radius: var(--radius-lg); color: #fff;
  background: linear-gradient(120deg, var(--a-side-1), var(--a-side-2) 55%, var(--a-side-3));
  box-shadow: 0 18px 36px -26px rgba(29, 78, 216, .85);
}
.ov-hero::after {
  content: ""; position: absolute; right: -70px; top: -90px; width: 260px; height: 260px;
  border-radius: 50%; background: radial-gradient(circle, rgba(56, 189, 248, .55), transparent 65%);
  pointer-events: none;
}
.ov-date { margin: 0 0 6px; font-size: 12px; opacity: .85; letter-spacing: .3px; }
.ov-greet { margin: 0; font-size: 22px; font-weight: 700; }
.ov-greet b { font-size: 27px; }
.ov-sub { margin: 8px 0 0; font-size: 13px; opacity: .92; }
.ov-hero-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.ov-hero-nums { display: flex; gap: 26px; }
.ov-num { display: flex; flex-direction: column; align-items: flex-end; }
.ov-num span { font-size: 12px; opacity: .85; }
.ov-num b { font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
/* 天气：左侧栏底部（2026-10-28 顶栏并入侧栏） */
.appbar-weather { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.appbar-weather .w-now { font-size: 13px; }
.appbar-weather .w-now b { font-weight: 700; }
.appbar-weather .w-sub { font-size: 11px; opacity: .85; }
.appbar-weather .w-src {
  font-size: 11px; color: rgba(255, 255, 255, .86); text-decoration: none;
  border-bottom: 1px dotted rgba(255, 255, 255, .6);
}
.appbar-weather .w-src:hover { color: #fff; }
@media (max-width: 900px) { .appbar-weather { display: none; } }

.ov-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.ov-kpi {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.ov-kpi-ico { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ov-kpi-ico svg { width: 22px; height: 22px; }
.ov-kpi-blue .ov-kpi-ico { background: rgba(37, 99, 235, .14); color: var(--a-type-visit); }
.ov-kpi-green .ov-kpi-ico { background: var(--green-soft); color: var(--green); }
.ov-kpi-amber .ov-kpi-ico { background: var(--amber-soft); color: var(--amber); }
.ov-kpi-red .ov-kpi-ico { background: var(--red-soft); color: var(--red); }
.ov-kpi-txt { display: flex; flex-direction: column; min-width: 0; }
.ov-kpi-k { font-size: 12px; color: var(--muted); }
.ov-kpi-v { font-size: 25px; font-weight: 800; font-variant-numeric: tabular-nums; }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 12px; align-items: stretch; }
.ov-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 16px; }
/* 右栏与左栏同高：最后一张卡贴底（客户截图里"右侧底部比左侧短一截"） */
.ov-side { display: flex; flex-direction: column; gap: 12px; height: 100%; justify-content: space-between; }
.ov-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ov-card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.ov-export { flex: 0 0 auto; padding: 6px 12px; min-height: 40px; }
.ov-muted { color: var(--muted); }

/* 筛选栏：两行 —— 第一行「时段」整行，第二行 门岗 / 类型 / 关键词。
   这样时间框不会挤到门岗下拉上（2026-10-28 客户截图指出重叠）。 */
.ov-filters {
  display: grid; grid-template-columns: auto auto minmax(120px, 1fr);
  gap: 8px; align-items: center; margin-bottom: 10px;
}
.ov-range { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--muted); }
.ov-range span, .ov-range i { white-space: nowrap; }
.ov-range i { font-style: normal; }
.ov-filters input[type="time"] { width: auto; flex: 1 1 90px; min-width: 78px; min-height: 44px; padding: 6px 8px; }
.ov-filters select { width: auto; min-width: 104px; min-height: 44px; padding: 6px 10px; }
#ovGate { grid-column: 1; }
#ovType { grid-column: 2; }
#ovKw { grid-column: 3; width: 100%; min-height: 44px; }
.ov-empty { margin: 22px 0; text-align: center; color: var(--muted); font-size: 13px; }
/* 手机端宽表格会横滑（表格铁律：不藏列）；给一句提示，否则用户不知道右边还有内容 */
.ov-swipe { display: none; margin: 6px 0 0; text-align: center; font-size: 11px; color: var(--muted); }

/* 近 7 天柱状图（纯 CSS，高度用内联 style 给出） */
.ov-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; height: 112px; margin-top: 4px; }
.ov-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.ov-bar i { display: block; width: 100%; max-width: 34px; min-height: 2px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--a-side-3), var(--a-side-4)); }
.ov-bar-v, .ov-bar-k { font-size: 11px; color: var(--muted); }

/* 今日类型环形图（SVG stroke-dasharray） */
.ov-donut-wrap { display: flex; align-items: center; gap: 14px; }
.ov-donut { width: 110px; height: 110px; flex: 0 0 auto; }
.ov-donut-n { font-size: 22px; font-weight: 800; fill: var(--text); }
.ov-donut-k { font-size: 10px; fill: var(--muted); }
.ov-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.ov-legend li { display: flex; align-items: center; gap: 8px; }
.ov-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* 更多数据 + 快捷操作（原「整体情况」「快捷操作」两卡的压缩版，功能一个不少） */
/* 内容区按钮统一：胶囊 + 同高（与侧栏药丸一致），快捷操作 2×2 等宽 */
.ov-root .btn { border-radius: var(--radius-pill); min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.ov-more { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.ov-more-nums { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 13px; }
.ov-more-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
.ov-more-links .btn { width: 100%; }

@media (max-width: 1099px) {
  .admin-layout { flex-direction: column; height: auto; gap: 12px; }
  .side { flex: 0 0 auto; width: auto; }
  .side .tabs { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .side .tabs .tab { flex: 0 0 auto; white-space: nowrap; }
  .side-tools { margin-top: 8px; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .appbar-weather { display: none; }
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
  .ov-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-root { height: auto; }
  .ov-card-table, .ov-card-table .table-wrap { height: auto; }
}
/* 电脑端：右栏里「更多数据 + 快捷操作」竖着排（窄栏） */
@media (min-width: 1100px) {
  .ov-side .ov-more { margin-top: 0; flex-direction: column; align-items: flex-start; }
  .ov-side .ov-more-links { width: 100%; }
}
@media (max-width: 720px) {
  .ov-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ov-kpi { padding: 12px 14px; gap: 10px; }
  .ov-kpi-v { font-size: 22px; }
  .ov-hero { padding: 16px 18px; }
  .ov-hero-nums { gap: 16px; }
  .ov-num b { font-size: 24px; }
  .ov-donut-wrap { justify-content: center; }
  /* 筛选：手机上「时段」占整行，门岗/类型并排，关键词整行（原来四个控件会挤出卡片） */
  .ov-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ov-range { grid-column: 1 / -1; display: flex; width: 100%; }
  .ov-range input[type="time"] { width: auto; flex: 1 1 96px; }
  .ov-filters select { min-width: 0; width: 100%; }
  #ovGate { grid-column: 1; }
  #ovType { grid-column: 2; }
  #ovKw { grid-column: 1 / -1; }
  .ov-swipe { display: block; }
}

/* ---------- 无障碍：系统开启"减少动态效果"时关掉动画与过渡 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- 后台弹层（答题记录等） ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 26, 32, .45); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 80; }
.modal-box { width: 100%; max-width: 760px; max-height: 86vh; overflow: auto; margin: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ---------- 提示与工具类 ---------- */
.toast { position: fixed; left: 50%; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: rgba(25,30,36,.94); color: #fff; padding: 11px 20px; border-radius: 26px; font-size: 14px; opacity: 0; transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease); pointer-events: none; z-index: 99; max-width: 88vw; text-align: center; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.empty { text-align: center; color: var(--muted); padding: 26px 0; font-size: 14px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.small { font-size: 12px; color: var(--muted); }
.mt12 { margin-top: 12px; }
.mb12 { margin-bottom: 12px; }

/* ---------- 打印（通行证、张贴码） ---------- */
@media print {
  /* 打印永远按亮色：暗色模式下 --text/--card 等是深色主题值，直接打印会"白纸白字"。
     选择器要写成 (0,2,0) 级别才压得住文件末尾那两个暗色块（`:root:not([data-theme="light"])` /
     `:root[data-theme="dark"]`），光写 `:root` 是压不住的。 */
  :root, :root[data-theme], :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #f2f5f8; --card: #ffffff; --surface: #ffffff; --surface-2: #f7f9fb; --surface-3: #fafbfd;
    --row-hover: #f4f9ff; --text: #1f2429; --muted: #6e747a; --border: #e2e7ec; --hair: #e9edf1;
    --border-strong: #d3dae1; --field: #fbfcfd; --field-soft: #f7f9fc; --line-soft: #e6ebf0;
    --hover-border: #b9d4ee; --blue: #1560a8; --blue-dark: #0f4a80; --blue-lite: #1e74c4;
    --blue-ink: #0d3e74; --blue-soft: #eaf3fc; --green: #16805a; --green-soft: #e8f6ef;
    --amber: #c86a0c; --amber-soft: #fdf1e0; --amber-border: #f2ddbb; --red: #c62828; --red-soft: #fdecec;
    --gray-soft: #eef1f4;
  }
  body { background: #fff; }
  .noprint { display: none !important; }
  .appbar { display: none; }
  .wrap { max-width: none; padding: 0; margin: 0; }
  .card { box-shadow: none; border: none; break-inside: avoid; }
  /* 后台 v5：打印时藏掉侧栏与快捷按钮；问候带强制白底（深蓝渐变打出来是一团墨） */
  #shell .tabs, .ov-more-links { display: none !important; }
  #shell #panel { margin-left: 0 !important; }
  .ov-card, .ov-hero { break-inside: avoid; box-shadow: none; }
  .ov-hero { background: #fff !important; color: #0f172a !important; border: 1px solid #d8dee6; }
  .ov-hero::after { display: none; }
}

/* ---------- 车牌选择键盘（App.plateInput，见 app/static/js/plate.js） ----------
   两步式：①只显示省份简称 ②选完省份后「字母 + 数字」同屏（不用切换 123/ABC）
   默认收起：平时只有车牌格子那一行，点格子才展开键盘（plate.js 切 data-open）
   桌面与手机用同一套样式，只是列数不同（面板 + 大按键，避免看起来"和页面不搭"）。 */
.plate-picker { margin-top: 8px; }
/* 禁用态（App.plateInput().setEnabled(false)）：整个选择器变淡且**不响应任何点击**。
   注意：只把隐藏的 input 设 disabled 是没用的——点击是绑在 picker 容器上的，
   禁用时必须让容器自己不吃事件（黑名单页"人员"模式下车牌块整块隐藏，也走这里兜底）。 */
.plate-picker.plate-disabled { opacity: .5; pointer-events: none; }
.plate-picker[data-open="0"] .plate-panel { display: none; }
.plate-picker[data-open="0"] .plate-cells { margin-bottom: 0; }
/* 车牌格子**任何时候都在同一行**：原来 flex-wrap: wrap + 固定 42px，
   8 格需要 378px 宽，而后台黑名单表单是 3 列网格（每列仅 ~285px）→
   「省」会被挤到第二行，看起来像没输完就换行。
   改成不换行 + 可收缩（flex: 0 1 42px）：有空间保持 42px，不够时所有格子一起变窄。 */
.plate-cells { display: flex; flex-wrap: nowrap; gap: 6px; margin-bottom: 10px; }
.plate-cell {
  width: 42px; flex: 0 1 42px; min-width: 24px;
  height: 50px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  font-size: 21px; font-weight: 700; color: var(--text); overflow: hidden;
}
.plate-cell.filled { border-color: var(--blue); color: var(--blue); }
.plate-cell.active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(21, 96, 168, .18); }
.plate-panel { background: var(--field-soft); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.plate-stage { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; margin-bottom: 6px; }
.plate-stage > span { flex: 1 1 auto; min-width: 0; }
/* 「收起」：两步都看得到（选省份时也想反悔收起来），只收键盘、已选的车牌保留 */
.plate-collapse {
  flex: 0 0 auto; padding: 4px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--muted); font-size: 12px; font-family: inherit; cursor: pointer;
}
.plate-collapse:hover { border-color: var(--blue); color: var(--blue); }
.plate-row { display: grid; gap: 6px; margin-bottom: 6px; }
.plate-row:last-child { margin-bottom: 0; }
.plate-row.prov { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.plate-row.digits { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.plate-row.chars { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.plate-row.tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plate-key {
  min-height: 50px; padding: 0 2px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font-size: 18px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: .12s;
}
.plate-key:hover { border-color: var(--blue); color: var(--blue); }
.plate-key:active { background: var(--bg); }
.plate-row.tools .plate-key { font-size: 15px; font-weight: 500; }
/* ---------- 自研日期选择（App.dateInput，见 app/static/js/datepicker.js） ----------
   替代 <input type="date"> 的原生弹层：原生日历在浏览器 Shadow DOM 里、CSS 改不到内部，
   跟后台卡片的风格永远对不上（客户 2026-09 反馈"这个日期的 UI 跟周边不匹配"）。
   平时只显示一行当前值，点一下才展开面板；周一开头（与排班习惯一致）。 */
.dp-picker { margin-top: 8px; }
.dp-picker[data-open="0"] .dp-panel { display: none; }
.dp-field {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 44px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-family: inherit; font-size: 15px; color: var(--muted); cursor: pointer; text-align: left;
}
.dp-field.set { color: var(--text); }
.dp-field:hover { border-color: var(--blue); }
.dp-icon { flex: 0 0 auto; display: inline-flex; align-items: center; color: var(--muted); }
.dp-panel {
  margin-top: 8px; padding: 10px; max-width: 340px;
  background: var(--field-soft); border: 1px solid var(--border); border-radius: 12px;
}
.dp-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.dp-nav {
  flex: 0 0 auto; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--muted); font-family: inherit; font-size: 15px; line-height: 1; cursor: pointer;
}
.dp-nav:hover { border-color: var(--blue); color: var(--blue); }
.dp-title {
  flex: 1 1 auto; min-height: 32px; border: 0; border-radius: 8px; background: transparent;
  font-family: inherit; font-size: 14px; font-weight: 700; color: var(--text); cursor: pointer;
}
.dp-title:hover { background: var(--blue-soft); }
.dp-caret { font-size: 9px; color: var(--muted); margin-left: 4px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dp-wd { text-align: center; font-size: 12px; color: var(--muted); padding: 2px 0; }
.dp-day, .dp-month {
  min-height: 36px; border: 1px solid transparent; border-radius: 8px; background: var(--surface);
  font-family: inherit; font-size: 14px; color: var(--text); cursor: pointer;
}
.dp-day:hover, .dp-month:hover { border-color: var(--blue); color: var(--blue); }
.dp-day.other { color: var(--muted); background: transparent; }
.dp-day.today { border-color: var(--blue); }
.dp-day.sel, .dp-month.sel { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.dp-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.dp-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.dp-chip {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface);
  font-family: inherit; font-size: 12px; color: var(--muted); cursor: pointer;
}
.dp-chip:hover { border-color: var(--blue); color: var(--blue); }
.dp-clear { margin-left: auto; }
@media (max-width: 420px) {
  .plate-row.prov { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
  .plate-cell { width: 36px; flex: 0 1 36px; height: 46px; font-size: 19px; }
  .plate-key { min-height: 46px; font-size: 17px; }
}

/* 安全校验（验证码）：题目要显眼，不能和普通提示文字一个样 */
.field-title { display: block; font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.captcha-question {
  background: var(--blue-soft); border-left: 4px solid var(--blue); border-radius: 6px;
  padding: 10px 12px; font-size: 17px; font-weight: 700; color: var(--blue-dark);
  margin-bottom: 10px;
}
.captcha-options .btn { font-weight: 700; }

/* ══════════ UI 美化第一批（2026-09）══════════
   原则：只动"观感"，不动版式结构与类名（版式一改，截图/文档/自检都要跟着改）。
   三项内容：① 图标统一为内联 SVG（去 emoji）② 卡片/类型卡的节奏与按压反馈 ③ toast 带语气。 */

/* ---------- ① 访客类型卡：图标改内联 SVG（原来 emoji 是彩色位图风，与页面扁平线性图标不搭） ---------- */
.type-item .icon { display: block; color: var(--muted); line-height: 0; margin-bottom: 6px; }
.type-item .icon svg { width: 26px; height: 26px; }
.type-item.active .icon { color: var(--blue); }
.type-item { transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
  box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.type-item:active { transform: translateY(1px); }
.type-item:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--blue); }

/* ---------- ① 卡片入场：轻量上浮（`prefers-reduced-motion` 时被上面的全局媒体查询关掉） ---------- */
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } }
.card { animation: cardIn .28s var(--ease) both; }

/* ---------- ③ toast：按语气配图标与底色（成功绿 / 失败红 / 提醒琥珀） ---------- */
.toast-ico { display: inline-flex; vertical-align: -3px; margin-right: 7px; }
.toast-ok { background: rgba(17, 105, 76, .95); }
.toast-err { background: rgba(172, 44, 38, .95); }
.toast-warn { background: rgba(146, 98, 10, .95); }

/* ══════════ UI 美化第二批（2026-09）：后台台账表格 ══════════
   ① 表头吸顶 + 斑马行 / 悬浮行 / 末行收边（见上方「表格」段，色值全部走 token）
   ② 宽屏放松行距（电脑上不再挤成一团）
   ③ 表格内按钮只在宽屏压紧
   ④ 分页条统一外观（原来访客 / 培训 / 通行证三张表固定只取前 50 条、没有翻页入口，
      超过 50 条的历史数据在界面上"消失"——接口其实早就支持 page/size）。 */

@media (min-width: 1100px) {
  table.data { font-size: 14px; }
  /* 行高放开，但**横向**内边距要收一点：后台是"左侧导航 + 右侧面板"，面板宽度有限（≈876px），
     横向 padding 给大了整张表就会超出面板、把「操作」列切掉（实测过 47px）。 */
  table.data th, table.data td { padding: 11px 9px; }
}

/* 表格里的按钮**只在宽屏**压到 34px；手机 / 平板必须保持 44px ——
   `tools/mobile_check` 逐页断言「触控目标 ≥40px」，而且对表格内元素**不做豁免**，
   把这条挪出媒体查询，手机端自检立刻红（tests/test_frontend_assets.py 有静态钉）。 */
@media (min-width: 900px) {
  table.data td .btn { min-height: 34px; padding: 5px 11px; font-size: 13px; }
}

/* ---------- 顶栏主题开关（门卫核验台 / 后台；访客端不加控件，只跟随系统） ----------
   ⚠️ 它是真 <button>，而 `tools/mobile_check` 逐页断言「触控目标 ≥40px」（顶栏元素**不豁免**），
   所以最小高度按 40px 给（比旁边的 .chip 略高一点点，换手机上点得准 + 自检绿）。 */
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 12px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.24); color: #fff;
  font-family: inherit; font-size: 13px; cursor: pointer;
}
.theme-btn:hover { background: rgba(255,255,255,.34); }
.theme-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.theme-btn svg { width: 16px; height: 16px; }
.theme-btn .theme-label { display: none; }              /* 窄屏只留图标，别把顶栏挤换行 */
@media (min-width: 560px) { .theme-btn .theme-label { display: inline; } }

/* ══════════ 暗色模式（UI 第三批，2026-09）══════════
   策略：**只覆盖 token、不重写任何组件样式** —— 所以以后新增组件只要用 token 就自动适配暗色。
   两个入口 + 两处例外：
     ① 跟随系统：@media (prefers-color-scheme: dark)，且用户没手动选过亮色（:not([data-theme="light"])）；
     ② 手动：<html data-theme="dark">（门卫核验台 / 后台顶栏的开关写它，见 app.js::App.mountThemeButton）；
     例外 A 通行证证面 .pass-card / 张贴卡 .sheet 永远亮色（见本节末尾）；
     例外 B @media print 永远亮色（见上面「打印」段）。
   ⚠️ 下面两个块的变量**必须逐字一致**：
   tests/test_frontend_assets.py::test_dark_mode_tokens_are_consistent 会把两块抓出来比对 ——
   只改一处会造成"系统暗色"与"手动暗色"两种观感（这类漂移最难被发现）。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1620;
    --card: #182129;
    --surface: #182129;
    --surface-2: #1f2a34;
    --surface-3: #1b242d;
    --row-hover: #22313f;
    --text: #e8edf2;
    --muted: #9aa7b4;
    --border: #2a3641;
    --hair: #253039;
    --border-strong: #37454f;
    --field: #131c25;
    --field-soft: #1a232c;
    --line-soft: #2a3641;
    --hover-border: #3c5a75;
    --blue: #4a9ee0;
    --blue-dark: #8cc2f0;
    --blue-lite: #2f7cc0;
    --blue-ink: #123a5e;
    --blue-soft: #16283a;
    --green: #45c790;
    --green-soft: #12291f;
    --amber: #e0a24a;
    --amber-soft: #2b2113;
    --amber-border: #5a4426;
    --red: #f0736c;
    --red-soft: #2c1a19;
    --gray-soft: #202a33;
    --shadow: 0 2px 10px rgba(0, 0, 0, .55);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, .55);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .6);
    --ring: 0 0 0 3px rgba(74, 158, 224, .30);
    /* 后台 v5（与手动暗色块逐字一致） */
    --a-side-1: #172554;
    --a-side-2: #1e3a8a;
    --a-side-3: #1d4ed8;
    --a-side-4: #2563eb;
    --a-accent: #38bdf8;
    --a-type-visit: #60a5fa;
    --a-type-contractor: #fb923c;
    --a-type-driver: #a78bfa;
    --a-page-bg: #0b1220;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1620;
  --card: #182129;
  --surface: #182129;
  --surface-2: #1f2a34;
  --surface-3: #1b242d;
  --row-hover: #22313f;
  --text: #e8edf2;
  --muted: #9aa7b4;
  --border: #2a3641;
  --hair: #253039;
  --border-strong: #37454f;
  --field: #131c25;
  --field-soft: #1a232c;
  --line-soft: #2a3641;
  --hover-border: #3c5a75;
  --blue: #4a9ee0;
  --blue-dark: #8cc2f0;
  --blue-lite: #2f7cc0;
  --blue-ink: #123a5e;
  --blue-soft: #16283a;
  --green: #45c790;
  --green-soft: #12291f;
  --amber: #e0a24a;
  --amber-soft: #2b2113;
  --amber-border: #5a4426;
  --red: #f0736c;
  --red-soft: #2c1a19;
  --gray-soft: #202a33;
  --shadow: 0 2px 10px rgba(0, 0, 0, .55);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .55);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px rgba(74, 158, 224, .30);
  /* 后台 v5（与系统暗色块逐字一致） */
  --a-side-1: #172554;
  --a-side-2: #1e3a8a;
  --a-side-3: #1d4ed8;
  --a-side-4: #2563eb;
  --a-accent: #38bdf8;
  --a-type-visit: #60a5fa;
  --a-type-contractor: #fb923c;
  --a-type-driver: #a78bfa;
  --a-page-bg: #0b1220;
}

/* ---------- 例外 A：通行证证面 / 张贴卡「永远亮色」 ----------
   证面是"证件"：门卫看、访客举着出示、打印稿也是白底黑字；暗色让它变黑反而更看不清。
   做法是在这两个容器上**局部还原**用到的 token（比给每条规则写 !important 或复制一套类名干净，
   而且里面所有 var(--text)/var(--muted)/--blue-soft 都自动变回亮色）。 */
.pass-card, .sheet {
  color-scheme: light;
  /* 必须显式带上 color：证面里有些元素（如 .pass-name 姓名、.pi-v 值）自己没有颜色、
     默认从 body 继承 —— 暗色下 body 是浅色文字，落在白底证面上就"白底浅字"看不见了。 */
  color: var(--text);
  --bg: #f2f5f8;
  --card: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #fafbfd;
  --text: #1f2429;
  --muted: #6e747a;
  --border: #e2e7ec;
  --hair: #e9edf1;
  --border-strong: #d3dae1;
  --field: #fbfcfd;
  --field-soft: #f7f9fc;
  --line-soft: #e6ebf0;
  --hover-border: #b9d4ee;
  --blue: #1560a8;
  --blue-dark: #0f4a80;
  --blue-lite: #1e74c4;
  --blue-ink: #0d3e74;
  --blue-soft: #eaf3fc;
  --green: #16805a;
  --green-soft: #e8f6ef;
  --amber: #c86a0c;
  --amber-soft: #fdf1e0;
  --amber-border: #f2ddbb;
  --red: #c62828;
  --red-soft: #fdecec;
  --gray-soft: #eef1f4;
}


