/* =========================================================================
   高博人事处协同办公系统 · 设计系统
   所有颜色、字号、间距、圆角都是变量；页面只用这里的类，不写裸色值。
   ========================================================================= */

:root {
  --primary: #3355e0;
  --primary-600: #2844c4;
  --primary-700: #2138a3;
  --primary-50: #eef2ff;
  --primary-100: #dfe6ff;
  --primary-200: #c3d0ff;
  --accent: #7c5cff;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f4f9;
  --border: #e3e8ef;
  --border-strong: #cfd7e3;

  --text: #182235;
  --text-2: #5b6578;
  --text-3: #8a93a6;
  --text-inverse: #ffffff;

  --success: #14a06b;
  --success-50: #e7f7ef;
  --warning: #d97f00;
  --warning-50: #fff3df;
  --danger: #d9363e;
  --danger-50: #fdecec;
  --info: #2f7bea;
  --info-50: #e8f1fe;
  --violet: #7c5cff;
  --violet-50: #f1edff;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, .10), 0 2px 6px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .22);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 30px;

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary-100); }
[hidden] { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; }

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

.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: transform .25s var(--ease);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; }
.brand img { width: 36px; height: 36px; }
.brand b { display: block; font-size: 16px; letter-spacing: .5px; }
.brand small { display: block; color: var(--text-3); font-size: var(--fs-xs); margin-top: -2px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.nav-group { margin-top: 14px; }
.nav-group-title {
  padding: 0 10px 6px; font-size: 11px; color: var(--text-3); letter-spacing: 1px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  color: var(--text-2); cursor: pointer; user-select: none; position: relative; font-size: var(--fs);
}
.nav-item svg { width: 18px; height: 18px; flex: none; color: var(--text-3); }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.nav-item.active svg { color: var(--primary); }
.nav-item .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .2s; }
.nav-item.open .chev { transform: rotate(90deg); }
.nav-sub { display: none; padding: 2px 0 4px 18px; margin-left: 8px; border-left: 1px dashed var(--border); }
.nav-sub.open { display: block; }
.nav-sub .nav-item { font-size: var(--fs-sm); padding: 6px 10px; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 6px; border-radius: var(--radius-pill);
  background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600;
}
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(244, 246, 250, .86); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.global-search { position: relative; flex: 1; max-width: 520px; }
.global-search input {
  width: 100%; height: 38px; padding: 0 14px 0 38px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface); outline: none; transition: .15s;
}
.global-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.global-search > svg { position: absolute; left: 13px; top: 11px; width: 16px; height: 16px; color: var(--text-3); }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; max-height: 420px; overflow: auto;
}
.search-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
.search-item:hover, .search-item.active { background: var(--primary-50); }
.search-item .meta { color: var(--text-3); font-size: var(--fs-xs); }
.search-hint { padding: 8px 10px; color: var(--text-3); font-size: var(--fs-xs); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--text-2);
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary-200); }
.icon-btn.menu-toggle { display: none; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; font-weight: 600; text-align: center;
  border: 2px solid var(--bg);
}
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: var(--radius-pill);
  cursor: pointer; border: 1px solid transparent; position: relative;
}
.user-chip:hover { background: var(--surface); border-color: var(--border); }
.user-chip b { font-size: var(--fs-sm); display: block; line-height: 1.2; }
.user-chip small { font-size: 11px; color: var(--text-3); display: block; line-height: 1.2; }
.user-menu {
  position: absolute; right: 0; top: 48px; width: 240px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 8px; z-index: 40;
}
.user-menu .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu a, .user-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none;
  border-radius: var(--radius); color: var(--text); cursor: pointer; text-align: left; font-size: var(--fs-sm);
}
.user-menu a:hover, .user-menu button:hover { background: var(--surface-3); }
.user-menu svg { width: 16px; height: 16px; color: var(--text-3); }

.content { padding: 8px 28px 40px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 12px 0 20px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head h1 { font-size: var(--fs-xl); letter-spacing: .2px; }
.page-head .desc { color: var(--text-2); margin-top: 4px; font-size: var(--fs-sm); }
.crumbs { font-size: var(--fs-xs); color: var(--text-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--primary); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------ 卡片 ------------------------------ */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: var(--fs-md); }
.card-head .sub { color: var(--text-3); font-size: var(--fs-xs); }
.card-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px 20px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 24px; }

.stat {
  position: relative; overflow: hidden; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.stat .label { color: var(--text-2); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: var(--fs-2xl); font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.stat .value small { font-size: var(--fs); font-weight: 500; color: var(--text-3); margin-left: 4px; }
.stat .foot { color: var(--text-3); font-size: var(--fs-xs); margin-top: 2px; }
.stat .badge-icon {
  position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; background: var(--primary-50); color: var(--primary);
}
.stat .badge-icon svg { width: 20px; height: 20px; }
.stat.tone-success .badge-icon { background: var(--success-50); color: var(--success); }
.stat.tone-warning .badge-icon { background: var(--warning-50); color: var(--warning); }
.stat.tone-violet .badge-icon { background: var(--violet-50); color: var(--violet); }
.stat.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #4b6cf0 55%, var(--accent) 100%); color: #fff; border: 0;
}
.stat.hero .label, .stat.hero .foot, .stat.hero .value small { color: rgba(255, 255, 255, .82); }
.stat.hero .badge-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.stat.clickable { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.stat.clickable:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; font-size: var(--fs); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s,
  box-shadow .15s, color .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--primary-200); color: var(--primary-700); background: var(--primary-50); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-100); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(51, 85, 224, .25); }
.btn.primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f2c4c6; }
.btn.danger:hover { background: var(--danger-50); color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn.xs { height: 26px; padding: 0 8px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font-size: inherit; }
.link-btn:hover { color: var(--primary-600); text-decoration: underline; }
.link-btn.muted { color: var(--text-3); }
.link-btn.danger { color: var(--danger); }

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

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; font-size: var(--fs);
}
.textarea { height: auto; min-height: 84px; padding: 8px 12px; resize: vertical; line-height: 1.6; }
.select { padding-right: 32px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a93a6' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.input[readonly], .input:disabled, .select:disabled, .textarea[readonly] { background: var(--surface-2); color: var(--text-2); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-50); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.field > label .req { color: var(--danger); }
.field .help { font-size: var(--fs-xs); color: var(--text-3); }
.field .error { font-size: var(--fs-xs); color: var(--danger); }
.field .badge-review { font-size: 11px; color: var(--warning); background: var(--warning-50); padding: 0 6px; border-radius: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-section { margin-bottom: 22px; }
.form-section h4 { font-size: var(--fs-sm); color: var(--text); margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }
.form-section h4::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--primary); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: var(--fs-sm); }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: var(--radius); padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-size: var(--fs-sm);
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); font-weight: 600; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-sm); }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 10px; background: var(--border-strong); position: relative;
  cursor: pointer; transition: .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-xs); transition: .2s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { left: 16px; }

/* ------------------------------ 筛选条 ------------------------------ */

.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.filterbar .input, .filterbar .select { width: auto; min-width: 140px; height: 34px; font-size: var(--fs-sm); }
.filterbar .search-input { min-width: 240px; flex: 1; max-width: 360px; }
.chip-filter {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-pill);
  border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; font-size: var(--fs-sm);
}
.chip-filter.on { border-style: solid; border-color: var(--primary-200); background: var(--primary-50); color: var(--primary-700); }
.chip-filter svg { width: 14px; height: 14px; }
.popover {
  position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 10px; min-width: 220px; max-height: 360px; overflow: auto;
}
.popover .check { display: flex; padding: 4px 6px; border-radius: 6px; }
.popover .check:hover { background: var(--surface-3); }

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

.table-wrap { overflow: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2); font-weight: 600; text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #f8faff; }
.table tbody tr.clickable { cursor: pointer; }
.table .num { text-align: right; }
.table .muted { color: var(--text-3); }
.table .nowrap { white-space: nowrap; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions .link-btn + .link-btn { margin-left: 12px; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell b { font-weight: 600; display: block; line-height: 1.3; }
.person-cell small { color: var(--text-3); font-size: var(--fs-xs); }
.pager { display: flex; align-items: center; gap: 6px; padding: 12px 20px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
.pager .spacer { flex: 1; }
.pager button { min-width: 32px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.pager button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button:disabled { opacity: .4; cursor: default; }

/* ------------------------------ 标签与头像 ------------------------------ */

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.tag.primary { background: var(--primary-50); color: var(--primary-700); }
.tag.success { background: var(--success-50); color: var(--success); }
.tag.warning { background: var(--warning-50); color: var(--warning); }
.tag.danger { background: var(--danger-50); color: var(--danger); }
.tag.info { background: var(--info-50); color: var(--info); }
.tag.violet { background: var(--violet-50); color: var(--violet); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; color: #fff; background: linear-gradient(135deg, #5b7cfa, #7c5cff);
}
.avatar.lg { width: 72px; height: 72px; font-size: 26px; border-radius: 20px; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.c1 { background: linear-gradient(135deg, #3fb68b, #1d9a6c); }
.avatar.c2 { background: linear-gradient(135deg, #f7a948, #e07a1f); }
.avatar.c3 { background: linear-gradient(135deg, #ef6b8a, #d6456a); }
.avatar.c4 { background: linear-gradient(135deg, #43a6f5, #2775e0); }
.avatar.c5 { background: linear-gradient(135deg, #8b78f6, #6a4fe8); }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: .3px; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: var(--fs-xs); }
.strong { font-weight: 600; }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.warning-text { color: var(--warning); }

/* ------------------------------ 列表、时间轴、KV ------------------------------ */

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: #f8faff; }
.list-item .main-text { flex: 1; min-width: 0; }
.list-item .title { font-weight: 500; }
.list-item .meta { color: var(--text-3); font-size: var(--fs-xs); margin-top: 2px; }
.level-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; background: var(--info); }
.level-bar.urgent { background: var(--danger); }
.level-bar.warning { background: var(--warning); }

.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.kv-item { padding: 12px 20px; border-bottom: 1px solid var(--border); min-width: 0; }
.kv-item .k { color: var(--text-3); font-size: var(--fs-xs); display: flex; align-items: center; gap: 6px; }
.kv-item .v { margin-top: 2px; word-break: break-all; min-height: 22px; }
.kv-item .v.is-empty { color: var(--border-strong); }
.kv-item.wide { grid-column: span 3; }
.kv.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv.cols-2 .kv-item.wide { grid-column: span 2; }

.timeline { position: relative; padding: 4px 0 4px 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary);
}
.tl-item.muted::before { border-color: var(--border-strong); }
.tl-item .when { font-size: var(--fs-xs); color: var(--text-3); }
.tl-item .what { font-weight: 500; }
.tl-item .detail { color: var(--text-2); font-size: var(--fs-sm); }
.diff { display: grid; grid-template-columns: 140px minmax(0, 1fr) 20px minmax(0, 1fr); gap: 4px 10px; font-size: var(--fs-sm);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-top: 6px; }
.diff .before { color: var(--danger); text-decoration: line-through; text-decoration-color: rgba(217, 54, 62, .35); word-break: break-all; }
.diff .after { color: var(--success); word-break: break-all; }
.diff .arrow { color: var(--text-3); }

/* ------------------------------ 员工 360° ------------------------------ */

.profile-hero {
  display: flex; gap: 20px; align-items: center; padding: 22px 24px; position: relative; overflow: hidden;
  background: radial-gradient(1200px 300px at 100% -40%, rgba(124, 92, 255, .10), transparent 60%),
    radial-gradient(900px 260px at 0% 0%, rgba(51, 85, 224, .08), transparent 60%), var(--surface);
}
.profile-hero h2 { font-size: 24px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-hero .facts { display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--text-2); font-size: var(--fs-sm); margin-top: 8px; }
.profile-hero .facts span { display: inline-flex; gap: 6px; align-items: center; }
.profile-hero .facts svg { width: 14px; height: 14px; color: var(--text-3); }
.profile-hero .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.profile-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.side-tabs { position: sticky; top: calc(var(--topbar-h) + 12px); padding: 8px; }
.side-tab {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius); cursor: pointer;
  color: var(--text-2); font-size: var(--fs-sm);
}
.side-tab svg { width: 16px; height: 16px; color: var(--text-3); }
.side-tab:hover { background: var(--surface-3); }
.side-tab.active { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.side-tab.active svg { color: var(--primary); }
.side-tab .count { margin-left: auto; font-size: 11px; color: var(--text-3); }
.reveal { display: inline-flex; align-items: center; gap: 6px; }
.reveal button { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; font-size: var(--fs-xs); }

.archive { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 420px; }
.archive-tree { border-right: 1px solid var(--border); padding: 10px; }
.tree-node { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius); cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); }
.tree-node svg { width: 16px; height: 16px; color: #f5b041; flex: none; }
.tree-node:hover { background: var(--surface-3); }
.tree-node.active { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.tree-node .count { margin-left: auto; font-size: 11px; color: var(--text-3); }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.file-icon { width: 38px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex: none; letter-spacing: .3px; }
.file-icon.pdf { background: #e5484d; }
.file-icon.img { background: #12a594; }
.file-icon.doc { background: #3e63dd; }
.file-icon.xls { background: #30a46c; }
.file-icon.ppt { background: #f76b15; }
.file-icon.other { background: #8b8d98; }
.file-row .info { flex: 1; min-width: 0; }
.file-row .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .meta { font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 26px; text-align: center;
  color: var(--text-2); background: var(--surface-2); cursor: pointer; transition: .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); }
.dropzone svg { width: 28px; height: 28px; color: var(--primary); }
.preview-frame { width: 100%; height: 72vh; border: 0; border-radius: var(--radius); background: var(--surface-3); }
.preview-img { max-width: 100%; display: block; margin: 0 auto; border-radius: var(--radius); }

/* ------------------------------ 浮层：抽屉、对话框、提示 ------------------------------ */

.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .38); z-index: 80; opacity: 0; transition: opacity .2s; }
.overlay.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw); background: var(--surface); z-index: 90;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .28s var(--ease);
}
.drawer.wide { width: min(860px, 100vw); }
.drawer.show { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { font-size: var(--fs-md); flex: 1; }
.drawer-head .sub { font-size: var(--fs-xs); color: var(--text-3); font-weight: 400; margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal {
  position: fixed; left: 50%; top: 50%; z-index: 95; width: min(460px, calc(100vw - 32px)); max-height: 86vh; overflow: auto;
  transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: .2s var(--ease); background: var(--surface);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}
.modal.wide { width: min(980px, calc(100vw - 32px)); }
.modal.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal-body { padding: 24px 24px 8px; }
.modal-body h3 { font-size: 17px; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.modal-body p { color: var(--text-2); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px 20px; }
.modal-icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-50); color: var(--primary); flex: none; }
.modal-icon.danger { background: var(--danger-50); color: var(--danger); }
.modal-icon svg { width: 20px; height: 20px; }
.close-x { border: 0; background: none; cursor: pointer; color: var(--text-3); padding: 4px; border-radius: 6px; display: inline-flex; }
.close-x:hover { background: var(--surface-3); color: var(--text); }
.close-x svg { width: 18px; height: 18px; }
.toasts { position: fixed; top: 16px; right: 16px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 260px; max-width: 420px; padding: 12px 16px; border-radius: var(--radius-lg); background: #1f2a44; color: #fff;
  box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm);
  animation: toast-in .25s var(--ease);
}
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.success svg { color: #4ade80; }
.toast.error { background: #3b1219; }
.toast.error svg { color: #ff8d93; }
.toast.warning svg { color: #fbbf24; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------ 状态：空、加载、提示条 ------------------------------ */

.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty svg { width: 44px; height: 44px; color: var(--border-strong); margin-bottom: 8px; }
.empty .t { color: var(--text-2); font-weight: 500; }
.empty .d { font-size: var(--fs-sm); margin-top: 4px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, #e9edf4 37%, var(--surface-3) 63%); background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-block { padding: 24px 20px; display: grid; gap: 12px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite; }
.spinner.dark { border-color: var(--primary-100); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.notice-bar { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-lg);
  background: var(--info-50); color: #1d4f9c; font-size: var(--fs-sm); border: 1px solid #cfe1fc; }
.notice-bar svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice-bar.warning { background: var(--warning-50); color: #8a5200; border-color: #f7dcae; }
.notice-bar.danger { background: var(--danger-50); color: #9b1c22; border-color: #f6c7c9; }
.notice-bar.success { background: var(--success-50); color: #0c6b47; border-color: #bfe8d5; }

/* ------------------------------ 标签页 ------------------------------ */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; overflow-x: auto; }
.tab { padding: 12px 4px; margin-right: 18px; border-bottom: 2px solid transparent; color: var(--text-2); cursor: pointer;
  font-weight: 500; white-space: nowrap; font-size: var(--fs-sm); background: none; border-top: 0; border-left: 0; border-right: 0; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-700); border-bottom-color: var(--primary); }
.tab .count { margin-left: 6px; font-size: 11px; background: var(--surface-3); padding: 1px 6px; border-radius: 9px; color: var(--text-3); }
.tab.active .count { background: var(--primary-50); color: var(--primary-700); }

/* ------------------------------ 图表 ------------------------------ */

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 86px; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.bar-row .name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #6f86f5); transition: width .6s var(--ease); }
.bar-row .val { text-align: right; font-weight: 600; }
.bar-row .val small { color: var(--text-3); font-weight: 400; margin-left: 4px; }
.bar-row.clickable { cursor: pointer; }
.bar-row.clickable:hover .name { color: var(--primary); }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); flex: 1; min-width: 160px; }
.donut-legend .item { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.donut-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend .item b { margin-left: auto; }
.donut-legend .item small { color: var(--text-3); margin-left: 6px; width: 54px; text-align: right; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-step { display: flex; align-items: center; gap: 12px; }
.funnel-step .bar { height: 34px; border-radius: 8px; background: linear-gradient(90deg, var(--primary), var(--accent));
  color: #fff; display: flex; align-items: center; padding: 0 12px; font-weight: 600; min-width: 44px; transition: width .6s var(--ease); }
.funnel-step .lbl { width: 72px; color: var(--text-2); font-size: var(--fs-sm); }

.structure-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.structure-table th, .structure-table td { border: 1px solid var(--border); padding: 10px 12px; text-align: center; }
.structure-table th { background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.structure-table td.dim { font-weight: 600; background: var(--surface-2); width: 110px; }
.structure-table td.cell { cursor: pointer; }
.structure-table td.cell:hover { background: var(--primary-50); }
.structure-table .count { font-size: 18px; font-weight: 700; display: block; }
.structure-table .ratio { color: var(--text-3); font-size: var(--fs-xs); }

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

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: var(--surface); }
.login-art {
  position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column;
  background: linear-gradient(150deg, #1c2f8a 0%, #3355e0 45%, #6a4fe8 100%);
}
.login-art .brand-line { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 18px; }
.login-art .brand-line img { width: 40px; height: 40px; }
.login-art h1 { font-size: clamp(26px, 2.5vw, 38px); line-height: 1.35; margin-top: auto; letter-spacing: 1px; }
.login-art p.lead { margin-top: 14px; color: rgba(255, 255, 255, .82); font-size: 16px; max-width: 520px; }
.login-art .points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 36px 0 auto; max-width: 560px; }
.login-art .point { background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px;
  padding: 14px 16px; backdrop-filter: blur(6px); }
.login-art .point b { display: block; font-size: 15px; }
.login-art .point span { font-size: 13px; color: rgba(255, 255, 255, .78); }
.login-art .art { position: absolute; right: -120px; top: -80px; width: 560px; opacity: .55; pointer-events: none; }
.login-art .foot { font-size: 12px; color: rgba(255, 255, 255, .6); margin-top: 28px; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 20px; padding: 36px 34px; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.login-card h2 { font-size: 24px; }
.login-card .sub { color: var(--text-2); margin: 6px 0 26px; font-size: var(--fs-sm); }
.login-card .field { margin-bottom: 16px; }
.login-card .input { height: 44px; font-size: 15px; }
.code-row { display: flex; gap: 10px; }
.code-row .input { letter-spacing: 6px; font-family: var(--mono); font-size: 18px; text-align: center; }
.code-row .btn { height: 44px; min-width: 116px; }
.login-card .btn.primary.block { height: 46px; font-size: 15px; margin-top: 8px; }
.login-card .legal { margin-top: 22px; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.7; }
.login-msg { min-height: 20px; font-size: var(--fs-sm); margin-top: 10px; }
.login-msg.error { color: var(--danger); }
.login-msg.ok { color: var(--success); }

/* ------------------------------ 错误页 ------------------------------ */

.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.error-card { text-align: center; max-width: 440px; }
.error-card .code { font-size: 96px; font-weight: 800; line-height: 1; letter-spacing: -4px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-card h1 { font-size: 22px; margin-top: 12px; }
.error-card p { color: var(--text-2); margin: 10px 0 22px; }

/* ------------------------------ 打印（履历表、证明） ------------------------------ */

.print-page { max-width: 860px; margin: 24px auto; background: #fff; padding: 48px 56px; box-shadow: var(--shadow-md); border-radius: 12px; }
.print-page h1 { text-align: center; font-size: 26px; letter-spacing: 6px; margin-bottom: 6px; }
.print-page .doc-meta { text-align: center; color: var(--text-3); font-size: 12px; margin-bottom: 24px; }
.print-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 18px; }
.print-table th, .print-table td { border: 1px solid #9aa3b5; padding: 8px 10px; text-align: left; vertical-align: top; }
.print-table th { width: 18%; background: #f4f6fa; font-weight: 600; white-space: nowrap; }
.print-section { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
.cert-body { font-size: 17px; line-height: 2.2; text-indent: 2em; margin: 36px 0; }
.cert-sign { text-align: right; margin-top: 64px; line-height: 2; }
.print-toolbar { max-width: 860px; margin: 16px auto 0; display: flex; gap: 10px; justify-content: flex-end; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .print-toolbar, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  .print-page { box-shadow: none; margin: 0; padding: 0; border-radius: 0; }
}

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

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv-item.wide { grid-column: span 2; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .icon-btn.menu-toggle { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .content { padding: 4px 14px 32px; }
  .profile-layout { grid-template-columns: minmax(0, 1fr); }
  .side-tabs { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .side-tab { white-space: nowrap; }
  .archive { grid-template-columns: minmax(0, 1fr); }
  .archive-tree { border-right: 0; border-bottom: 1px solid var(--border); display: flex; overflow-x: auto; gap: 4px; }
  .tree-node { white-space: nowrap; }
  .login-page { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .profile-hero { flex-direction: column; align-items: flex-start; }
  .profile-hero .actions { margin-left: 0; justify-content: flex-start; }
  .user-chip .who { display: none; }
}
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-4 .stat { padding: 14px; }
  .grid-4 .stat .value { font-size: 24px; }
  .grid-4 .stat .badge-icon { display: none; }
  .grid-4 .stat .foot { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .kv, .kv.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .kv-item.wide { grid-column: auto; }
  .bar-row { grid-template-columns: 80px minmax(0, 1fr) 72px; }
  .diff { grid-template-columns: minmax(0, 1fr); }
  .diff .arrow { display: none; }
  .page-head h1 { font-size: 20px; }
  .filterbar .search-input { min-width: 100%; }
}
.backdrop-mobile { display: none; }
@media (max-width: 960px) { .backdrop-mobile.show { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15, 23, 42, .35); } }
.clamp { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
