/* ==========================================================================
   公差顺序管理 —— 样式表
   --------------------------------------------------------------------------
   设计基調：清爽、现代、有秩序感的「事务台账」。
   - 靛蓝(indigo)主色 + 紫罗兰渐变点缀，语义色克制使用
   - 卡片用柔和的层叠阴影而非生硬的边框撑起层次
   - 数字统一等宽数字（tabular-nums），次数/时间对齐不乱跳
   - 圆角体系统一：10 / 14 / 18 / 22
   ========================================================================== */

/* ---------------------------------------------------------------- 设计令牌 */

:root {
  /* 表面与背景 */
  --bg: #f3f5fa;
  --bg-grad: radial-gradient(900px 500px at 85% -10%, #e4e9fb 0%, transparent 55%),
             radial-gradient(700px 500px at -10% 0%, #ece9fb 0%, transparent 50%);
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef1f8;
  --border: #e7eaf3;
  --border-strong: #d3d9e8;

  /* 文字 */
  --text: #131a2c;
  --text-2: #3c465e;
  --muted: #6b7590;
  --faint: #9aa3ba;

  /* 主色：沉稳的蓝（不用紫） */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;
  --accent-2: #0ea5e9;
  /* 主视觉渐变用的深蓝 */
  --accent-deep: #1e3a8a;

  /* 语义色 */
  --success: #059669;
  --success-soft: #e7f8f1;
  --success-border: #bfe9db;
  --warn: #b45309;
  --warn-soft: #fdf6e9;
  --warn-border: #f3e0bb;
  --danger: #dc2626;
  --danger-soft: #fdeeee;
  --danger-border: #f6cccc;

  /* 阴影：柔和、有层次，避免生硬的大黑块 */
  --shadow-sm: 0 1px 2px rgba(19, 26, 44, .06);
  --shadow: 0 1px 3px rgba(19, 26, 44, .07), 0 1px 2px rgba(19, 26, 44, .04);
  --shadow-lg: 0 12px 32px -10px rgba(19, 26, 44, .16), 0 4px 12px -4px rgba(19, 26, 44, .07);
  --shadow-pop: 0 24px 48px -12px rgba(19, 26, 44, .28);

  /* 圆角 */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --header-h: 66px;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #0b101e;
  --bg-grad: radial-gradient(900px 500px at 85% -10%, #17223d 0%, transparent 55%),
             radial-gradient(700px 500px at -10% 0%, #1d1738 0%, transparent 50%);
  --surface: #141b2d;
  --surface-2: #1a2236;
  --surface-3: #202a44;
  --border: #26314b;
  --border-strong: #36425f;

  --text: #e9edf8;
  --text-2: #c3cbe0;
  --muted: #8e99b6;
  --faint: #667190;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: #16233c;
  --accent-border: #1e3a8a;
  --accent-2: #22d3ee;
  --accent-deep: #172554;

  --success: #34d399;
  --success-soft: #10281f;
  --success-border: #1e4a3a;
  --warn: #f5b04c;
  --warn-soft: #2a2214;
  --warn-border: #4a3c1e;
  --danger: #f87171;
  --danger-soft: #2b1a1e;
  --danger-border: #54262e;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 32px -10px rgba(0, 0, 0, .6), 0 4px 12px -4px rgba(0, 0, 0, .5);
  --shadow-pop: 0 24px 48px -12px rgba(0, 0, 0, .7);

  color-scheme: dark;
}

/* ---------------------------------------------------------------- 基础 */

* { box-sizing: border-box; }

html, body { height: 100%; }

/* 安卓 Chrome 的「字体放大」会在某些页面上自动放大正文，显式关闭 */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: -.015em; }
h1 { font-size: 26px; font-weight: 750; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; color: var(--muted); }
small { font-size: 12.5px; }
a { color: var(--accent); }
[hidden] { display: none !important; }
code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: .92em;
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 6px;
}

/* ---------------------------------------------------------------- 布局 */

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---- 顶栏 ---- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--border);
  /* 背景与毛玻璃放在伪元素上，而不是 .topbar 自身。
     原因：backdrop-filter / filter / transform / will-change 都会为
     position: fixed 的后代创建「包含块」，一旦加在 .topbar 上，
     移动端那个固定在底部的标签栏就会以 .topbar 为基准定位，
     跑到页面顶部去盖住标题栏。这个坑已经踩过一次，别再合并回去。 */
}
.topbar::before {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.7) blur(16px);
}
.topbar-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 20px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 38%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, .22);
}
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: 16px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { display: block; font-size: 12px; color: var(--faint); margin-top: 1px; }

/* 标签：分段控件（segmented control），比一排散落的文字链接更有产品感 */
.tabs {
  display: flex; gap: 3px; margin-left: auto;
  background: var(--surface-3);
  padding: 4px; border-radius: 999px;
}
.tabs button {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 15px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 650; white-space: nowrap;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.tabs button:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 65%, transparent); }
.tabs button[aria-selected='true'] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}
.tabs .badge {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; vertical-align: 1px;
}

/* 图标统一尺寸。用 SVG 而不是文本字形，跨平台粗细一致。 */
.ico { width: 16px; height: 16px; display: block; flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }

.userbox { display: flex; align-items: center; gap: 8px; flex: none; position: relative; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--border-strong);
  display: grid; place-items: center; font-weight: 750; font-size: 14px; color: var(--text-2);
}

/* 账号入口：整块可点 */
.user-trigger {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 5px; border-radius: 999px;
  background: transparent; border: 1px solid transparent;
  color: inherit; font-weight: inherit;
  transition: background .15s, border-color .15s;
}
.user-trigger:hover { background: var(--surface-3); border-color: var(--border); }
.user-trigger[aria-expanded='true'] { background: var(--surface-3); border-color: var(--border-strong); }
.user-trigger .chev { width: 12px; height: 12px; flex: none; color: var(--faint); transition: transform .18s ease; }
.user-trigger[aria-expanded='true'] .chev { color: var(--text-2); transform: rotate(180deg); }

.dropdown {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  min-width: 258px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dropdown-head {
  padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.dropdown-head strong { display: block; font-size: 14px; font-weight: 700; }
.dropdown-head span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.dropdown > button {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font-weight: 600; font-size: 13.5px;
  transition: background .13s;
}
.dropdown > button:hover { background: var(--surface-3); }
.dropdown > button.danger { color: var(--danger); }
.dropdown > button.danger:hover { background: var(--danger-soft); }
.dropdown .menu-hint { display: block; font-size: 12px; font-weight: 500; color: var(--faint); margin-top: 2px; }

/* 注意必须写 main.wrap，不能只写 main。
   <main class="wrap"> 同时命中 .wrap（0,1,0）和 main（0,0,1），
   类选择器特异性更高，只写 main 的话这条 padding 会被 .wrap 完全盖掉、
   永远不生效 —— 之前就是这样悄悄失效的。 */
main.wrap { padding: 26px 0 48px; }

/* ---- 卡片 ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.card-head .sub { margin-top: 4px; font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; align-items: start; }

/* ---------------------------------------------------------------- 表单 */

label.field { display: grid; gap: 7px; margin-bottom: 15px; font-size: 13px; font-weight: 650; color: var(--text-2); letter-spacing: .01em; }
label.field > .hint { font-weight: 500; color: var(--faint); font-size: 12px; }

input, select, textarea {
  width: 100%; font: inherit; font-size: 15px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 18%, transparent);
  background: var(--surface);
}
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[type='datetime-local'], input[type='date'] { min-height: 42px; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 34px;
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* 登录页的勾选项 */
.check-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; margin-bottom: 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px;
  transition: border-color .15s, background .15s;
}
.check-row:hover { border-color: var(--border-strong); }
.check-row input[type='checkbox'] { width: auto; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.check-row .hint { display: block; font-weight: 500; color: var(--faint); font-size: 12px; margin-top: 2px; }

/* 登录页的「保持登录 + 时长」拼成一块，视觉上是一体的 */
.login-remember { margin-bottom: 16px; }
.login-remember .check-row { margin-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.login-remember.no-days .check-row { border-radius: var(--radius-sm); }
.remember-days {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 13px; margin: 0; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.remember-days > span { font-weight: 650; color: var(--text-2); }
.remember-days select { width: auto; min-width: 148px; padding: 7px 30px 7px 11px; font-size: 13.5px; }

/* ---------------------------------------------------------------- 按钮 */

button {
  border: 0; cursor: pointer; font: inherit; font-weight: 650;
  border-radius: var(--radius-sm); padding: 10px 16px;
  transition: background .15s, color .15s, transform .1s, box-shadow .15s, border-color .15s;
}
button:active:not(:disabled) { transform: translateY(1px) scale(.99); }
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #3b82f6, var(--accent));
  color: #fff;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 45%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--accent) 55%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, .18);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--faint); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger {
  background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger); color: #fff; border-color: var(--danger);
  box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--danger) 45%, transparent);
}
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }

.actions { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 9px; margin-top: 4px; }

/* ---------------------------------------------------------------- 徽标与提示 */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--border);
}
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.pill.ok { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }

.note {
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); line-height: 1.65;
}
.note.warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.note.danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.note.accent { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }

/* ---------------------------------------------------------------- 推荐面板（视觉焦点） */

.card.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(140deg, var(--accent-deep) 0%, var(--accent) 58%, #3b82f6 100%);
  color: #fff; border: 0;
  box-shadow: 0 18px 42px -12px color-mix(in srgb, var(--accent) 55%, transparent);
}
/* 装饰圆，增加层次但不喧宾夺主 */
.card.hero::before, .card.hero::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .08); pointer-events: none;
}
.card.hero::before { width: 200px; height: 200px; right: -60px; top: -80px; }
.card.hero::after { width: 120px; height: 120px; right: 70px; bottom: -60px; background: rgba(255, 255, 255, .06); }
.card.hero > * { position: relative; z-index: 1; }

.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero-kicker { font-size: 12.5px; font-weight: 650; letter-spacing: .05em; opacity: .88; }
.hero-reason { font-size: 13px; opacity: .82; margin-top: 3px; line-height: 1.5; }
.hero-name {
  font-size: 40px; font-weight: 800; letter-spacing: -.02em;
  margin: 16px 0 4px; line-height: 1.1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.hero-detail { font-size: 13px; opacity: .85; line-height: 1.6; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.hero-stats > div {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius); padding: 12px 14px;
  backdrop-filter: blur(4px);
}
.hero-stats strong {
  display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.hero-stats span { font-size: 12px; opacity: .82; }

/* 推荐卡片头部的「最少 N 次」徽标，放在渐变上时 */
.pill.on-hero {
  background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .28);
  backdrop-filter: blur(4px);
}

/* ---------------------------------------------------------------- 汇总条 */

.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-strip > div {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px;
}
.stat-strip strong {
  display: block; font-size: 25px; font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.stat-strip span { font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- 人员名单 */

.people-list { display: grid; gap: 8px; }
.person-row {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
  transition: border-color .15s, background .15s;
}
.person-row:hover { border-color: var(--border-strong); }
.person-row.inactive { opacity: .58; }
.person-row .num {
  width: 30px; height: 30px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; font-weight: 750; font-size: 13px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.person-row input { padding: 8px 11px; font-size: 14px; border-color: transparent; background: transparent; }
.person-row input:hover { border-color: var(--border-strong); background: var(--surface); }
.person-row input:focus { background: var(--surface); }
.person-row .move { display: flex; gap: 4px; }
.person-row .move button {
  padding: 6px 10px; line-height: 1; background: var(--surface);
  border: 1px solid var(--border); color: var(--muted); font-weight: 700;
}
.person-row .move button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.person-row .move button:disabled { opacity: .35; }

/* ---------------------------------------------------------------- 统计卡片 */

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 17px;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.stat-card .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-card .head strong { font-size: 15.5px; font-weight: 750; letter-spacing: -.01em; }
.stat-card .nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 13px 0 11px; }
.stat-card .nums > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 11px; }
.stat-card .nums strong {
  display: block; font-size: 23px; font-weight: 800; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.stat-card .nums span { font-size: 11.5px; color: var(--muted); }
.stat-card .meta { font-size: 12.5px; color: var(--muted); line-height: 1.65; }
.stat-card .meta b { color: var(--text-2); font-weight: 650; }
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .45s cubic-bezier(.2, .8, .3, 1);
}
.stat-card.is-min { border-color: var(--accent-border); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.stat-card.is-min .bar > i { background: linear-gradient(90deg, #10b981, var(--success)); }

/* ---------------------------------------------------------------- 表格 */

.table-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
thead th {
  background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 700; text-align: left; letter-spacing: .03em;
  padding: 12px 16px; white-space: nowrap; position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 13px 16px; border-top: 1px solid var(--border); font-size: 14px; vertical-align: top; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
td.reason { min-width: 210px; color: var(--text-2); line-height: 1.55; }
td.when { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
td.provenance { font-size: 12.5px; color: var(--muted); white-space: nowrap; line-height: 1.55; }
td.provenance b { color: var(--text-2); font-weight: 650; }
td.ops { text-align: right; white-space: nowrap; }
td.ops .btn-ghost { padding: 5px 9px; border-radius: 8px; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .big {
  width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 16px;
  background: var(--surface-3); display: grid; place-items: center;
  font-size: 22px; color: var(--faint);
}

/* ---------------------------------------------------------------- 审计 / 最近登记 */

.audit-list { display: grid; }
.audit-item {
  display: grid; grid-template-columns: 148px 1fr;
  gap: 16px; padding: 14px 4px;
  border-top: 1px solid var(--border);
}
.audit-item:first-child { border-top: 0; }
.audit-item .ts { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.55; }
.audit-item .ts > div { color: var(--faint); font-size: 11.5px; }
.audit-item .body { min-width: 0; }
.audit-item .line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.audit-item .actor { font-weight: 700; }
.audit-item .detail {
  margin-top: 6px; font-size: 12.5px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  white-space: pre-wrap; word-break: break-word; line-height: 1.6;
}

/* ---------------------------------------------------------------- 提示 */

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(16px);
  z-index: 100; display: grid; gap: 8px; width: max-content; max-width: min(92vw, 440px);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-item {
  background: var(--text); color: var(--bg);
  border-radius: var(--radius); padding: 11px 17px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-pop); display: flex; align-items: center; gap: 9px;
  animation: toast-in .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.toast-item.ok { background: var(--success); color: #fff; }
.toast-item.err { background: var(--danger); color: #fff; }

/* 模态 */
.modal-mask {
  position: fixed; inset: 0; z-index: 90;
  background: color-mix(in srgb, var(--text) 45%, transparent);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  animation: fade-in .16s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 26px;
  width: 100%; max-width: 440px; box-shadow: var(--shadow-pop);
  max-height: 88vh; overflow: auto;
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.1);
}
.modal h3 { margin-bottom: 4px; font-size: 17px; }
.modal .sub { font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.modal .modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px; }

/* ---------------------------------------------------------------- 骨架屏 */

.skeleton { padding: 40px; text-align: center; color: var(--muted); }
.spinner {
  width: 22px; height: 22px; margin: 0 auto 12px;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 登录页 */

.login-shell {
  /* 100vh 在安卓 Chrome 上包含地址栏占掉的高度，会让登录卡片被推到屏幕外。
     100dvh 取的是动态可视高度，两个都写以便老浏览器回退。 */
  min-height: 100vh;
  min-height: 100dvh;
  display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 404px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; padding: 34px 32px 30px;
  box-shadow: var(--shadow-lg);
  animation: pop .25s cubic-bezier(.2, .9, .3, 1.1);
}
.login-card .logo { display: flex; align-items: center; gap: 13px; margin-bottom: 8px; }
.login-card .brand-mark { width: 46px; height: 46px; border-radius: 15px; font-size: 23px; }
.login-card h1 { font-size: 22px; letter-spacing: -.02em; }
.login-card .tip { margin: 6px 0 22px; font-size: 13.5px; }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .tabs button { padding: 7px 11px; font-size: 13px; }
  .userbox .who { display: none; }
}

@media (max-width: 720px) {
  :root { --header-h: 58px; }
  .wrap { padding: 0 14px; }
  main.wrap { padding: 16px 0 96px; }
  .card { padding: 18px; border-radius: 20px; margin-bottom: 14px; }
  h1 { font-size: 21px; }
  .brand-text span { display: none; }
  .brand-mark { width: 36px; height: 36px; border-radius: 12px; font-size: 18px; }

  /* 顶部导航收成底部标签栏 */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    border-radius: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; z-index: 50;
    box-shadow: 0 -6px 24px -12px rgba(19, 26, 44, .18);
  }
  .tabs button {
    flex: 1; display: grid; justify-items: center; gap: 3px;
    padding: 7px 2px; font-size: 11px; font-weight: 650; border-radius: 12px;
    position: relative; background: transparent; box-shadow: none;
  }
  .tabs button .ico { width: 20px; height: 20px; }
  .tabs button .lbl { font-size: 11px; line-height: 1.2; }
  .tabs button[aria-selected='true'] { background: transparent; box-shadow: none; color: var(--accent); }
  .tabs button[aria-selected='true'] .ico { color: var(--accent); }
  .tabs button[aria-selected='true'] .lbl { font-weight: 750; }
  .tabs button[aria-selected='true']::after {
    content: ''; position: absolute; bottom: 1px; left: 50%; transform: translateX(-50%);
    width: 18px; height: 3px; border-radius: 999px; background: var(--accent);
  }
  .tabs .badge { position: absolute; transform: translate(13px, -3px); margin: 0; }

  .stat-strip { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-strip > div { padding: 10px 11px; }
  .stat-strip strong { font-size: 20px; }
  .stat-grid { grid-template-columns: 1fr; }
  .row-2, .row-3, .actions { grid-template-columns: 1fr; }
  .card.hero { padding: 20px; }
  .hero-name { font-size: 32px; }
  .hero-stats { margin-top: 18px; }
  .hero-stats strong { font-size: 20px; }
  .audit-item { grid-template-columns: 1fr; gap: 5px; }
  table { min-width: 640px; }
  #toast { bottom: 84px; }
  .dropdown { right: 8px; }
}

/* ----------------------------------------------------------------
   矮屏（360×640 这类小屏安卓机，再加上浏览器地址栏会更矮）
   登录卡片加了「保持时长」一行后会被顶出首屏，这里把间距整体收紧，
   保证不用滚动就能看到登录按钮。
   ---------------------------------------------------------------- */
@media (max-height: 720px) {
  .login-shell { padding: 16px; }
  .login-card { padding: 24px 22px 22px; border-radius: 20px; }
  .login-card .logo { gap: 11px; margin-bottom: 4px; }
  .login-card .brand-mark { width: 40px; height: 40px; border-radius: 13px; font-size: 20px; }
  .login-card h1 { font-size: 20px; }
  .login-card .tip { margin: 4px 0 15px; font-size: 13px; }
  .login-card label.field { margin-bottom: 12px; }
  .login-remember { margin-bottom: 13px; }
  .check-row { padding: 9px 12px; }
  .remember-days { padding: 7px 12px; }
}

/* ================================================================
   触控设备（安卓手机 / 平板 / 触屏本）

   这里用 pointer:coarse 而不是屏幕宽度 —— 800px 宽的安卓平板走的是桌面双栏
   布局，但它依然是触摸设备，需要更大的触摸目标与表单字号。
   ================================================================ */
@media (pointer: coarse) {
  /* 低于 16px 的表单字号，在部分移动浏览器上聚焦时会触发页面自动放大 */
  input, select, textarea { font-size: 16px; }
  .person-row input { font-size: 16px; }

  /* 触摸目标：安卓 Material 建议 48dp，这里取 44px 折中 */
  .tabs button { min-height: 44px; }
  .btn-primary, .btn-block { min-height: 44px; }
  .btn-secondary:not(.btn-sm) { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .btn-ghost, .user-trigger, .icon-btn { min-height: 38px; }
  .person-row .move button { min-width: 38px; }

  /* 去掉安卓点按时的半透明高亮，更接近原生应用；
     manipulation 同时省掉 300ms 的双击缩放等待 */
  button, a, .check-row, .dropdown > button, .person-row {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}

/* 打印：只留明细表，供留档 */
@media print {
  .topbar, .tabs, #toast, .no-print, .card:not(.print-target) { display: none !important; }
  body { background: #fff; }
  .card.print-target { box-shadow: none; border: 0; padding: 0; }
  table { min-width: 0; }
  tbody td, thead th { font-size: 11px; padding: 5px 7px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
