/* ==========================================================
   样式
   网格 8px；字号 13 / 14 / 15 / 16 / 18 / 22；字重 400 / 500 / 600
   颜色全部走变量，浅色 / 深色两套主题
   ========================================================== */
:root, [data-theme="light"] {
  color-scheme: light;
  --c-header: #0f1f36;
  --c-header-2: #17304f;
  --c-primary: #1661c7;
  --c-primary-h: #0f4fa8;
  --c-primary-a: #0c4290;
  --c-primary-bg: #eaf2fd;
  --c-primary-bd: #b9d3f5;
  --c-ring: rgba(22, 97, 199, .16);

  --c-text: #161d26;
  --c-text-2: #3d4756;
  --c-text-3: #66717f;
  --c-text-4: #a3abb6;

  --c-border: #d5dae1;
  --c-border-h: #aeb7c3;
  --c-border-2: #e6e9ee;
  --c-fill: #f5f7fa;
  --c-fill-2: #eef1f5;
  --c-hover: #f6f8fb;
  --c-bg: #eff2f6;
  --c-card: #ffffff;
  --c-ctl: #ffffff;
  --c-seg-on: #ffffff;

  --c-success: #157a43;
  --c-success-bg: #e7f5ed;
  --c-success-bd: #b3dcc4;
  --c-warn: #a35a06;
  --c-warn-bg: #fdf2e3;
  --c-warn-bd: #f0d1a6;
  --c-danger: #c22b2b;
  --c-danger-bg: #fdeded;
  --c-danger-bd: #f3c4c4;
  --c-female: #b03a72;
  --c-female-bg: #fbeef4;
  --c-female-bd: #efc6d9;

  --c-av-m: #1661c7;
  --c-av-f: #b03a72;
  --c-av-off: #8a94a3;
  --c-scroll: #c9d0d9;
  --c-empty-line: #cfd5dd;
  --c-empty-fill: #f5f7fa;

  --shadow-1: 0 1px 2px rgba(16, 31, 54, .05), 0 1px 4px rgba(16, 31, 54, .04);
  --shadow-2: 0 6px 24px rgba(16, 31, 54, .14);

  --radius: 4px;
  --radius-lg: 6px;
  --font: "Segoe UI", "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --hd-h: 56px;
  --max-w: 1920px;
  --ctl-h: 36px;
  --side-w: 380px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --c-header: #0b121c;
  --c-header-2: #101a28;
  --c-primary: #4a90e8;
  --c-primary-h: #6aa5ef;
  --c-primary-a: #3b7fd6;
  --c-primary-bg: rgba(74, 144, 232, .14);
  --c-primary-bd: rgba(74, 144, 232, .38);
  --c-ring: rgba(74, 144, 232, .28);

  --c-text: #e4e9f0;
  --c-text-2: #bcc5d1;
  --c-text-3: #8e99a8;
  --c-text-4: #5d6878;

  --c-border: #313c4b;
  --c-border-h: #475466;
  --c-border-2: #253040;
  --c-fill: #1a2331;
  --c-fill-2: #202a39;
  --c-hover: #1c2634;
  --c-bg: #0f1620;
  --c-card: #151d29;
  --c-ctl: #111924;
  --c-seg-on: #2a3647;

  --c-success: #4cc27f;
  --c-success-bg: rgba(76, 194, 127, .12);
  --c-success-bd: rgba(76, 194, 127, .34);
  --c-warn: #e5a54e;
  --c-warn-bg: rgba(229, 165, 78, .12);
  --c-warn-bd: rgba(229, 165, 78, .34);
  --c-danger: #f07575;
  --c-danger-bg: rgba(240, 117, 117, .12);
  --c-danger-bd: rgba(240, 117, 117, .34);
  --c-female: #e57fb0;
  --c-female-bg: rgba(229, 127, 176, .12);
  --c-female-bd: rgba(229, 127, 176, .34);

  --c-av-m: #2f6fc4;
  --c-av-f: #a8466f;
  --c-av-off: #4e5968;
  --c-scroll: #3a4656;
  --c-empty-line: #3a4656;
  --c-empty-fill: #1a2331;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, .5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px; line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.muted { color: var(--c-text-3); }
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl-h); min-width: 80px; padding: 0 18px;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-ctl); color: var(--c-text);
  font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: color .15s, background-color .15s, border-color .15s, box-shadow .15s;
}
.btn:hover:not(:disabled) { color: var(--c-primary); border-color: var(--c-primary); }
.btn:active:not(:disabled) { background: var(--c-fill); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-h); border-color: var(--c-primary-h); color: #fff; }
.btn-primary:active:not(:disabled) { background: var(--c-primary-a); }
.btn-sm { height: 32px; min-width: 0; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; height: 44px; font-size: 16px; }
.btn svg { flex: none; }

/* ---------- 输入控件 ---------- */
input[type="text"], input[type="password"], input[type="search"], input[type="date"], select {
  width: 100%; height: var(--ctl-h); padding: 0 12px;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background-color: var(--c-ctl); font-size: 15px; color: var(--c-text);
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover { border-color: var(--c-border-h); }
input:focus, select:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-ring); }
input::-webkit-search-cancel-button { cursor: pointer; }
input[type="date"] { font-family: var(--mono); font-size: 14px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e99a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select option { background: var(--c-card); color: var(--c-text); }

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100%;
  display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1b3a63 0%, transparent 70%), #0f1f36;
}
[data-theme="dark"] .login-body { background: radial-gradient(1200px 600px at 50% -10%, #142a46 0%, transparent 70%), #0b121c; }
/* 背景始终铺满视口：小屏下 html/body 高度为 auto，不设最小高度时 body 只有卡片那么高，
   下方露出空白，卡片也贴在顶部。100dvh 跟随移动端地址栏伸缩 */
.login-body { min-height: 100vh; min-height: 100dvh; background-attachment: fixed; }
html:has(> .login-body) { background: #0f1f36; }
[data-theme="dark"]:has(> .login-body) { background: #0b121c; }
.login-wrap { width: 100%; padding: 24px; display: grid; place-items: center; }
.login-card {
  width: 100%; max-width: 420px;
  padding: 40px 40px 36px;
  background: var(--c-card); border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.login-brand {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 24px; margin-bottom: 28px;
  border-bottom: 1px solid var(--c-border-2);
}
.login-logo { display: block; width: 40px; height: 40px; }
.login-brand h1 { font-size: 22px; font-weight: 600; letter-spacing: .06em; }
.field { display: grid; gap: 8px; margin-bottom: 20px; }
.field > span { font-size: 14px; font-weight: 500; color: var(--c-text-2); }
.field input { height: 44px; font-size: 16px; }
.form-error { min-height: 22px; margin: -6px 0 12px; font-size: 14px; color: var(--c-danger); }

/* ---------- 顶栏（两套主题下都是深色） ---------- */
.app { display: flex; flex-direction: column; height: 100%; }
.hd {
  flex: none; position: relative; z-index: 20;
  height: var(--hd-h);
  background: linear-gradient(90deg, var(--c-header) 0%, var(--c-header-2) 100%);
  color: rgba(255, 255, 255, .88);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 2px 10px rgba(0, 0, 0, .14);
}
[data-theme="dark"] .hd { box-shadow: 0 1px 0 var(--c-border-2); }
.hd-inner {
  display: flex; align-items: center; height: 100%;
  max-width: var(--max-w); margin: 0 auto; padding: 0 24px;
}
.hd-brand {
  flex: none; display: flex; align-items: center; gap: 12px;
  height: 100%; padding-right: 28px; margin-right: 8px;
  color: #fff; text-decoration: none;
  border-right: 1px solid rgba(255, 255, 255, .1);
}
.hd-logo { display: block; width: 30px; height: 30px; }
.hd-title { font-size: 17px; font-weight: 600; letter-spacing: .08em; white-space: nowrap; }
.hd-nav { display: flex; align-self: stretch; }
.nav-item {
  position: relative; display: flex; align-items: center; padding: 0 22px;
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  color: rgba(255, 255, 255, .66); font-size: 15px; font-weight: 500;
  transition: color .15s, background-color .15s;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.nav-item.is-active { color: #fff; background: rgba(255, 255, 255, .07); }
.nav-item.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px; background: #4d95f0;
}
.nav-item:focus-visible, .hd-brand:focus-visible, .hd-btn:focus-visible { outline-color: #7ab3f7; outline-offset: -3px; }
.hd-user { margin-left: auto; display: flex; align-items: center; gap: 14px; min-width: 0; }
.user-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
.user-name { font-size: 15px; font-weight: 500; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.user-no { font-size: 14px; color: rgba(255, 255, 255, .6); }
.hd-div { width: 1px; height: 20px; background: rgba(255, 255, 255, .14); }
.hd-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius);
  border: 0; background: transparent;
  color: rgba(255, 255, 255, .75); font-size: 14px; cursor: pointer;
  transition: color .15s, background-color .15s;
}
.hd-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.hd-icon { width: 32px; padding: 0; justify-content: center; }
.hd-icon .ico-sun { display: none; }
[data-theme="dark"] .hd-icon .ico-sun { display: block; }
[data-theme="dark"] .hd-icon .ico-moon { display: none; }

/* ---------- 主区 ---------- */
.main {
  flex: 1; min-height: 0; width: 100%;
  max-width: var(--max-w); margin: 0 auto; padding: 16px 24px 24px;
}
.page { height: 100%; min-height: 0; }
.page-emp { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); gap: 16px; }
.page-trace { display: flex; flex-direction: column; gap: 16px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--c-card); border: 1px solid var(--c-border-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card-hd {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 52px; padding: 0 20px; border-bottom: 1px solid var(--c-border-2);
}
.card-hd-l { display: flex; align-items: center; gap: 14px; min-width: 0; }
.card-title { font-size: 16px; font-weight: 600; white-space: nowrap; }
.card-sub {
  padding-left: 14px; border-left: 1px solid var(--c-border);
  font-size: 14px; line-height: 16px; color: var(--c-text-2); white-space: nowrap;
}
.card-extra { font-size: 14px; color: var(--c-text-3); white-space: nowrap; }
.card-extra b { font-weight: 600; color: var(--c-text); }

/* ---------- 表单项 ---------- */
.f-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.f-label { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--c-text-2); }
.f-control { display: block; position: relative; }
.f-actions { display: flex; gap: 12px; }
.input-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--c-text-3); pointer-events: none; }
.input-ico-wrap input { padding-left: 36px; }

/* ---------- 列表页：左侧栏 ---------- */
.side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.side-form {
  flex: none; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 20px 20px; border-bottom: 1px solid var(--c-border-2);
}
.f-pair { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 12px; }
.side-form .f-actions .btn { flex: 1; }
.side-hd {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 20px; border-bottom: 1px solid var(--c-border-2);
  background: var(--c-fill);
}
.side-hd .card-title { font-size: 15px; }

/* ---------- 轨迹：查询条 ---------- */
.filter {
  flex: none; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px 20px;
  padding: 16px 20px 18px;
}
.f-w { width: 220px; }
.f-end { margin-left: auto; }
.range {
  display: flex; align-items: center; height: var(--ctl-h);
  border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-ctl);
  transition: border-color .15s, box-shadow .15s;
}
.range:hover { border-color: var(--c-border-h); }
.range:focus-within { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-ring); }
.range input[type="date"], .range input[type="date"]:hover, .range input[type="date"]:focus {
  width: 150px; height: calc(var(--ctl-h) - 2px); border: 0; box-shadow: none; background: transparent;
}
.range-sep { flex: none; padding: 0 4px; font-size: 14px; color: var(--c-text-3); }
.seg {
  display: inline-flex; height: var(--ctl-h); padding: 3px; gap: 2px;
  background: var(--c-fill-2); border-radius: var(--radius);
}
.seg-item {
  padding: 0 14px; border: 0; border-radius: 3px; background: transparent; cursor: pointer;
  color: var(--c-text-2); font-size: 14px; white-space: nowrap;
  transition: color .15s, background-color .15s, box-shadow .15s;
}
.seg-item:hover { color: var(--c-text); }
.seg-item.is-active { background: var(--c-seg-on); color: var(--c-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .14); }

/* ---------- 头像 ---------- */
.av {
  flex: none; display: grid; place-items: center; border-radius: 50%;
  width: 40px; height: 40px; font-size: 14px; font-weight: 600; letter-spacing: .02em;
  color: #fff; background: var(--c-av-m); user-select: none;
}
.av-f { background: var(--c-av-f); }
.av-off { background: var(--c-av-off); }
.av-lg { width: 60px; height: 60px; font-size: 20px; }
.av-md { width: 48px; height: 48px; font-size: 16px; }

/* ---------- 结果列表 ---------- */
.result-list { flex: 1; min-height: 0; overflow-y: auto; }
.result {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px;
  width: 100%; padding: 12px 20px; text-align: left;
  border: 0; border-bottom: 1px solid var(--c-border-2);
  background: transparent; cursor: pointer; transition: background-color .12s;
}
.result::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.result:hover { background: var(--c-hover); }
.result.is-active { background: var(--c-primary-bg); }
.result.is-active::before { background: var(--c-primary); }
.result-main { min-width: 0; }
.result-l1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.result-name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-no { font-size: 14px; color: var(--c-text-2); }
.result-tags { display: flex; gap: 6px; margin-left: auto; }
.result-l2 {
  display: block; margin-top: 2px; font-size: 14px; color: var(--c-text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 标签 ---------- */
.tag {
  flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 3px; font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--c-fill); color: var(--c-text-2); border: 1px solid var(--c-border);
}
.tag-on, .tag-in { background: var(--c-success-bg); color: var(--c-success); border-color: var(--c-success-bd); }
.tag-off { background: var(--c-fill-2); color: var(--c-text-3); border-color: var(--c-border); }
.tag-blue, .tag-m { background: var(--c-primary-bg); color: var(--c-primary); border-color: var(--c-primary-bd); }
.tag-f { background: var(--c-female-bg); color: var(--c-female); border-color: var(--c-female-bd); }
.tag-out { background: var(--c-warn-bg); color: var(--c-warn); border-color: var(--c-warn-bd); }

/* ---------- 空状态 / 加载 / 错误 ---------- */
.empty {
  flex: 1; display: grid; place-items: center; align-content: center; gap: 14px;
  min-height: 200px; padding: 40px 24px; color: var(--c-text-3); font-size: 15px;
}
.empty::before {
  content: ""; width: 54px; height: 38px; border-radius: 4px;
  border: 1.5px solid var(--c-empty-line); border-top-width: 8px;
  background:
    linear-gradient(var(--c-empty-line), var(--c-empty-line)) 8px 9px / 20px 3px no-repeat,
    linear-gradient(var(--c-empty-line), var(--c-empty-line)) 8px 18px / 32px 3px no-repeat,
    var(--c-empty-fill);
}
.loading {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 200px; color: var(--c-text-3); font-size: 15px;
}
.loading::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--c-border); border-top-color: var(--c-primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.err {
  margin: 20px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--c-danger-bg); color: var(--c-danger); font-size: 14px;
  border: 1px solid var(--c-danger-bd);
}

/* ---------- 详情 ---------- */
.detail-card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.dt-hd {
  flex: none; display: flex; align-items: center; gap: 18px;
  padding: 20px 24px; border-bottom: 1px solid var(--c-border-2);
}
.dt-id { min-width: 0; flex: 1; }
.dt-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; font-size: 22px; line-height: 1.3; font-weight: 600; }
.dt-alt { font-size: 15px; font-weight: 400; color: var(--c-text-3); }
.dt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 8px; font-size: 15px; color: var(--c-text-2); }
.dt-meta .mono { color: var(--c-text); }
.sep { width: 1px; height: 14px; background: var(--c-border); }
.dt-actions { flex: none; display: flex; gap: 8px; }

.dt-facts {
  flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--c-fill); border-bottom: 1px solid var(--c-border-2);
}
.fact { padding: 12px 24px; min-width: 0; }
.fact + .fact { border-left: 1px solid var(--c-border-2); }
.fact-k { font-size: 13px; color: var(--c-text-3); }
.fact-v { margin-top: 2px; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 分组排布：组织归属占满整行；其余分组两列瀑布流，各列独立向下排，不按行对齐高度 */
.dt-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px 24px; }
.dt-cols { column-count: 2; column-gap: 20px; }
.sec {
  min-width: 0; margin-bottom: 20px;
  border: 1px solid var(--c-border-2); border-radius: var(--radius-lg);
  break-inside: avoid; -webkit-column-break-inside: avoid;
}
.dt-cols > .sec { display: inline-block; width: 100%; vertical-align: top; }
.sec-title {
  display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 16px; font-size: 15px; font-weight: 600;
  background: var(--c-fill); border-bottom: 1px solid var(--c-border-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.sec-title::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--c-primary); }

.org-path {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0;
  padding: 12px 16px; border-bottom: 1px solid var(--c-border-2); font-size: 14px;
}
.org-node { color: var(--c-text-2); }
.org-node:last-child { color: var(--c-primary); font-weight: 600; }
.org-arrow { width: 22px; text-align: center; color: var(--c-text-4); }

/* dense：跨行字段之后的短字段自动回填空位；margin-bottom:-1px 让最后一行底边与卡片边框重合 */
.desc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; margin-bottom: -1px; }
.sec-wide .desc { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.desc-item {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: start; gap: 12px;
  padding: 9px 16px; border-bottom: 1px solid var(--c-border-2); min-width: 0;
}
.desc-item.span-2 { grid-column: span 2; }
.desc-item.span-3, .desc-item.span-full { grid-column: 1 / -1; }
.desc-item dt { font-size: 14px; line-height: 24px; color: var(--c-text-3); }
.desc-item dd { font-size: 15px; line-height: 24px; color: var(--c-text); word-break: break-all; }
.desc-item dd.nil { color: var(--c-text-4); }

/* ---------- 轨迹 ---------- */
.summary { flex: none; display: flex; align-items: stretch; overflow: hidden; }
.sum-who {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; min-width: 360px; border-right: 1px solid var(--c-border-2);
}
.sum-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 18px; font-weight: 600; }
.sum-name .mono { font-size: 15px; font-weight: 400; color: var(--c-text-2); }
.sum-sub { margin-top: 2px; font-size: 14px; color: var(--c-text-3); }
.sum-stats { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sum-stats .fact { display: flex; flex-direction: column; justify-content: center; }

.trace-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.trace-scroll { flex: 1; min-height: 0; overflow: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  height: 44px; padding: 0 20px; text-align: left; white-space: nowrap;
  font-size: 14px; font-weight: 600; color: var(--c-text-2);
  background: var(--c-fill); border-bottom: 1px solid var(--c-border);
}
.tbl td { height: 46px; padding: 0 20px; border-bottom: 1px solid var(--c-border-2); }
.tbl tbody tr:hover td { background: var(--c-hover); }
.tbl tbody tr.day-first td { border-top: 1px solid var(--c-border); }
.tbl .col-no { width: 64px; color: var(--c-text-4); font-size: 14px; }
.tbl .col-time { width: 200px; white-space: nowrap; }
.tbl .col-time .t-date { color: var(--c-text-3); margin-right: 8px; }
.tbl .col-dir { width: 88px; }
.tbl .col-fac { width: 96px; }
.tbl .col-policy { color: var(--c-text-3); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 72px; z-index: 50;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: var(--radius);
  background: var(--c-card); color: var(--c-text); font-size: 15px;
  box-shadow: var(--shadow-2); border: 1px solid var(--c-border-2); border-left: 3px solid var(--c-warn);
  transition: opacity .2s, transform .2s;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-ok { border-left-color: var(--c-success); }

/* ---------- 年龄 / 点击复制 ---------- */
.age { margin-left: 4px; color: var(--c-text-3); }
.copy {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  margin: -2px -6px; padding: 2px 6px; border: 0; border-radius: 3px;
  background: transparent; color: var(--c-primary); font-size: 15px; line-height: 24px;
  cursor: copy; text-align: left; word-break: break-all;
  transition: background-color .15s;
}
.copy::after {
  content: ""; flex: none; width: 14px; height: 14px; opacity: .55;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='5' y='5' width='9' height='9' rx='1.5' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M11 5V3.5A1.5 1.5 0 0 0 9.5 2h-6A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='5' y='5' width='9' height='9' rx='1.5' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M11 5V3.5A1.5 1.5 0 0 0 9.5 2h-6A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat center / contain;
}
.copy:hover { background: var(--c-primary-bg); }
.copy:hover::after { opacity: 1; }
.copy-buf { position: fixed; top: -1000px; left: 0; opacity: 0; }

/* ---------- 轨迹概要：可点击跳转 ---------- */
.sum-text { display: flex; flex-direction: column; min-width: 0; }
.sum-nm { white-space: nowrap; }
.sum-link {
  border: 0; border-right: 1px solid var(--c-border-2); background: transparent;
  color: inherit; text-align: left; cursor: pointer; transition: background-color .15s;
}
.sum-link:hover { background: var(--c-hover); }
.sum-link:hover .sum-nm { color: var(--c-primary); text-decoration: underline; text-underline-offset: 3px; }
.sum-link:focus-visible { outline-offset: -2px; }
@media (max-width: 1100px) { .sum-link { border-right: 0; border-bottom: 1px solid var(--c-border-2); } }

/* ---------- 滚动条 ---------- */
.result-list, .dt-body, .trace-scroll { scrollbar-width: thin; scrollbar-color: var(--c-scroll) transparent; }
.result-list::-webkit-scrollbar, .dt-body::-webkit-scrollbar, .trace-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.result-list::-webkit-scrollbar-thumb, .dt-body::-webkit-scrollbar-thumb, .trace-scroll::-webkit-scrollbar-thumb { background: var(--c-scroll); border-radius: 4px; }

/* ---------- 响应式 ---------- */
@media (min-width: 1680px) {
  :root { --side-w: 400px; }
}
@media (max-width: 1440px) {
  :root { --side-w: 340px; }
  .sec-wide .desc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1280px) {
  .dt-cols { column-count: 1; }
  .sum-who { min-width: 300px; }
}
@media (max-width: 1100px) {
  :root { --side-w: 300px; }
  .dt-facts, .sum-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(3) { border-left: 0; }
  .fact:nth-child(n+3) { border-top: 1px solid var(--c-border-2); }
  .summary { flex-direction: column; }
  .sum-who { border-right: 0; border-bottom: 1px solid var(--c-border-2); }
  .f-end { margin-left: 0; }
}
/* ---- 平板 / 手机：整页自然滚动，取消内部固定高度 ---- */
@media (max-width: 900px) {
  :root { --ctl-h: 40px; }
  html, body { height: auto; }
  /* clip 不会生成滚动容器，不影响顶栏 sticky；兜底防止任何元素把页面撑宽 */
  body { overflow-x: clip; -webkit-tap-highlight-color: transparent; }
  .app { height: auto; min-height: 100vh; min-height: 100dvh; }
  .hd { position: sticky; top: 0; }
  .hd-inner {
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  }
  .hd-brand { padding-right: 16px; margin-right: 4px; }
  .hd-title { display: none; }
  .nav-item { padding: 0 16px; }
  .user-no, .hd-div { display: none; }
  .hd-user { gap: 8px; }

  .main {
    flex: none; max-width: none;
    padding: 12px max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .page { height: auto; }
  .page-emp { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .page-trace { gap: 12px; }
  .side, .detail-card, .trace-card { overflow: visible; }
  .result-list { flex: none; max-height: 45vh; max-height: 45dvh; }
  .dt-body, .trace-scroll { flex: none; overflow: visible; }
  .detail-card { scroll-margin-top: calc(var(--hd-h) + 12px); }

  /* 手机输入框字号 < 16px 时 iOS 会在聚焦时自动放大页面 */
  input[type="text"], input[type="password"], input[type="search"], input[type="date"], select { font-size: 16px; }
  input[type="date"] { min-width: 0; }

  .filter { padding: 16px; gap: 14px; }
  .f-w, .filter > .f-item { width: 100%; }
  .range { width: 100%; }
  .range input[type="date"], .range input[type="date"]:hover, .range input[type="date"]:focus { flex: 1 1 0; width: auto; min-width: 0; }
  .f-end { width: 100%; margin-left: 0; }
  .f-end .btn { flex: 1; }
  .tbl .col-policy { display: none; }
  .toast { top: calc(var(--hd-h) + 12px); }
}
@media (max-width: 600px) {
  :root { --hd-h: 52px; }
  .hd-inner {
    padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  }
  .hd-brand { padding-right: 10px; margin-right: 0; border-right: 0; }
  .hd-logo { width: 28px; height: 28px; }
  .nav-item { padding: 0 12px; font-size: 15px; }
  .user-text, .hd-btn span { display: none; }
  .hd-btn { width: 36px; height: 36px; padding: 0; justify-content: center; }

  .side-form { padding: 14px 14px 16px; gap: 12px; }
  .side-hd { padding: 0 14px; height: 44px; }
  .result { padding: 12px 14px; gap: 10px; }
  .av { width: 36px; height: 36px; font-size: 13px; }
  .result-l1 { gap: 6px; }
  .result-no { font-size: 13px; }

  .seg { display: flex; width: 100%; }
  .seg-item { flex: 1; padding: 0 8px; }

  .dt-hd { flex-wrap: wrap; gap: 14px; padding: 16px; }
  .av-lg { width: 52px; height: 52px; font-size: 18px; }
  .dt-name { font-size: 20px; }
  .dt-actions { width: 100%; }
  .dt-actions .btn { flex: 1; height: 40px; }
  .fact { padding: 10px 16px; }
  .fact-v { font-size: 15px; }
  .dt-body { padding: 12px; }
  .sec { margin-bottom: 12px; }
  .sec-title { padding: 0 14px; }
  .org-path { padding: 10px 14px; }
  .desc, .sec-wide .desc { grid-template-columns: minmax(0, 1fr); }
  .desc-item.span-2 { grid-column: 1 / -1; }
  .desc-item { grid-template-columns: 84px minmax(0, 1fr); gap: 10px; padding: 9px 14px; }

  .card-hd { flex-wrap: wrap; gap: 4px 12px; min-height: 48px; padding: 10px 14px; }
  .card-hd-l { flex-wrap: wrap; gap: 4px 12px; }
  .tbl { font-size: 14px; }
  .tbl th, .tbl td { padding: 0 10px; }
  .tbl td { height: auto; padding-top: 10px; padding-bottom: 10px; word-break: break-all; }
  .tbl .col-no, .tbl .col-fac { display: none; }
  .tbl .col-time { width: 1%; }
  .tbl .col-time .t-date { display: block; margin: 0; font-size: 12px; line-height: 16px; }
  .tbl .col-dir { width: 1%; }
  .sum-who { min-width: 0; padding: 14px 16px; }
  .sum-stats .fact:nth-child(4) .fact-v { font-size: 13px; }

  .toast { max-width: calc(100vw - 24px); white-space: normal; }
  .err { margin: 12px; }

  .login-wrap { padding: 16px; }
  .login-card { padding: 28px 22px 24px; }
  .login-brand { padding-bottom: 20px; margin-bottom: 22px; }
}
@media (max-width: 360px) {
  .nav-item { padding: 0 9px; font-size: 14px; }
  .f-pair { grid-template-columns: minmax(0, 1fr) 100px; }
  .result-tags .tag-m, .result-tags .tag-f { display: none; }
}
/* 触屏设备不依赖 hover，避免点按后残留高亮 */
@media (hover: none) {
  .result:hover { background: transparent; }
  .result.is-active:hover { background: var(--c-primary-bg); }
  .tbl tbody tr:hover td { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation: none !important; }
}
