/* 管控者HRM · 设计系统
   基调：编辑感 / 大量留白 / 细线分隔 / 等宽标签 / 大字号数字 */

:root {
  --bg: #f7f6f4;
  --panel: #ffffff;
  --panel-2: #fbfaf8;
  --panel-3: #f1efec;
  --ink: #17171c;
  --ink-2: #34343d;
  --muted: #6f6f7a;
  --faint: #9c9ca7;
  --line: #e4e2dd;
  --line-2: #d3d0ca;
  --accent: #1b4d3e;
  --accent-2: #123a2e;
  --accent-soft: #eef2f0;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #a15c07;
  --warn-soft: #fdf3e3;
  --ok: #15794b;
  --ok-soft: #e8f4ee;
  --info: #1f4b99;
  --info-soft: #eaf0fb;
  --radius: 3px;
  --radius-sm: 2px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 10px 28px -18px rgba(20, 20, 30, .18);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --side: 244px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: #d7e6df; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfcfd8; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b6b6c2; background-clip: content-box; border: 3px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 骨架 ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }

.side {
  background: #17171c;
  color: #c9c9d2;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.07); }
.mk { display: block; flex: 0 0 auto; }
.brand .mk { margin-bottom: 12px; }
.auth-left .mk { margin-bottom: 14px; }
.auth-form .mk { margin-bottom: 16px; }
.brand-name { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: .2px; }
.brand-sub { font-family: var(--mono); font-size: 10px; color: #6e6e7c; letter-spacing: .12em; text-transform: uppercase; margin-top: 3px; }

.nav { flex: 1; overflow-y: auto; padding: 8px 10px 14px; }
.nav::-webkit-scrollbar-thumb { background: #4a4a58; background-clip: content-box; border: 3px solid transparent; }
.nav-group { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: #5b5b68; padding: 11px 10px 5px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  color: #b9b9c4; font-size: 13.5px; cursor: pointer;
  border: 0; background: none; width: 100%; text-align: left;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.09); color: #fff; }
.nav-item.active .nav-idx { color: #fff; }
.nav-idx { font-family: var(--mono); font-size: 10px; color: #55555f; width: 16px; letter-spacing: .04em; }
.nav-item .dot { width: 4px; height: 4px; border-radius: 50%; background: #3f7f68; margin-left: auto; }

.side-foot { border-top: 1px solid rgba(255,255,255,.07); padding: 12px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 7px; cursor: pointer; }
.user-card:hover { background: rgba(255,255,255,.05); }
.user-card .avatar { background: #2c2c36; color: #fff; }
.user-meta { min-width: 0; }
.user-name { font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-family: var(--mono); font-size: 10px; color: #6e6e7c; letter-spacing: .06em; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(244,244,246,.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 14px 32px;
  display: flex; align-items: center; gap: 16px;
}
.topbar-title { min-width: 0; }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.topbar .crumb { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-bottom: 2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.view { padding: 26px 32px 56px; max-width: 1560px; width: 100%; }

/* ---------- 通用文字 ---------- */
.mono { font-family: var(--mono); }
.label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ---------- 卡片 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 20px; }
.card-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-hd h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-hd .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 6px 0; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }

/* ---------- 指标卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px; position: relative; overflow: hidden;
}
.stat .label { display: block; margin-bottom: 10px; }
.stat .value { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.stat .foot { margin-top: 8px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .85; }
.stat.accent .bar { background: var(--accent); }
.stat.warn .bar { background: var(--warn); }
.stat.danger .bar { background: var(--danger); }
.stat.info .bar { background: var(--info); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2);
  font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s, transform .06s;
}
.btn:hover { background: var(--panel-3); border-color: var(--line-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-danger { color: var(--danger); border-color: #ecc9c5; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-3); color: var(--ink); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; }
.btn-icon { width: 34px; padding: 0; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field > label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  height: 36px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; font-size: 13.5px; outline: none; width: 100%;
  transition: border-color .14s, box-shadow .14s;
}
.textarea { height: auto; padding: 9px 11px; min-height: 84px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(27,77,62,.1); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5L6 7.5L9 4.5' stroke='%23787885' stroke-width='1.3' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-error { color: var(--danger); font-size: 12px; }

.search { position: relative; }
.search input { height: 34px; padding-left: 32px; width: 240px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; font-size: 13px; outline: none; }
.search input:focus { border-color: var(--accent); }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--faint); }

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters .select, .filters .input { width: auto; min-width: 120px; height: 34px; font-size: 13px; }

/* ---------- 表格 ---------- */
.tbl-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); font-weight: 500; text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap;
  position: sticky; top: 0;
}
.tbl tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .right, .tbl th.right { text-align: right; }
.tbl .center, .tbl th.center { text-align: center; }
.tbl.compact tbody td { padding: 8px 12px; }

/* ---------- 头像 / 徽标 ---------- */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; letter-spacing: .02em;
  background: #4a5568;
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.xl { width: 60px; height: 60px; font-size: 20px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -8px; border: 2px solid #fff; }
.avatar-group .avatar:first-child { margin-left: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--panel-3); color: var(--muted);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.plain { background: transparent; border: 1px solid var(--line-2); color: var(--muted); }

.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--panel-3); color: var(--muted); font-size: 11.5px; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 9px 14px; border: 0; background: none; cursor: pointer; font-size: 13.5px;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.tab .count { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-left: 5px; }

/* ---------- 弹窗 / 抽屉 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20,20,26,.42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 20px 20px; z-index: 100; overflow-y: auto;
  animation: fadeIn .16s ease;
}
.overlay.ov-right { align-items: stretch; justify-content: flex-end; padding: 0; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
@keyframes slideLeft { from { transform: translateX(24px) } to { transform: none } }

.modal {
  background: var(--panel); border-radius: 10px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow); animation: slideUp .18s ease;
}
.modal.wide { max-width: 820px; }
.modal-hd { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; }
.modal-hd h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.modal-hd .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--panel-2); border-radius: 0 0 10px 10px; }
.close-x { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--faint); font-size: 20px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.close-x:hover { background: var(--panel-3); color: var(--ink); }

.drawer {
  background: var(--panel); height: 100vh; width: min(680px, 100%); margin-left: auto;
  box-shadow: -8px 0 40px rgba(20,20,30,.12); display: flex; flex-direction: column;
  animation: slideLeft .2s ease;
}
.drawer-hd { padding: 18px 24px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 32px; }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--panel-2); }

/* ---------- 提示 ---------- */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1c1c22; color: #fff; padding: 9px 16px; border-radius: 7px; font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,.22); animation: slideUp .18s ease; max-width: 90vw;
}
.toast.ok { background: #17573c; }
.toast.err { background: #8f1f16; }

.empty { padding: 48px 20px; text-align: center; color: var(--faint); }
.empty .big { font-size: 26px; margin-bottom: 6px; opacity: .35; }

/* ---------- 看板 ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 200px; }
.kcol-hd { padding: 11px 13px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.kcol-hd .name { font-size: 12.5px; font-weight: 600; }
.kcol-body { padding: 9px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px 11px; cursor: pointer; transition: border-color .14s, box-shadow .14s; }
.kcard:hover { border-color: var(--line-2); box-shadow: 0 2px 8px rgba(20,20,30,.07); }
.kcard .n { font-size: 13px; font-weight: 600; }
.kcard .m { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.kcard .f { display: flex; align-items: center; gap: 6px; margin-top: 8px; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.tl-item { position: relative; padding: 0 0 16px 0; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: #fff; border: 1.5px solid var(--line-2); }
.tl-item.hl::before { border-color: var(--accent); background: var(--accent); }
.tl-date { font-family: var(--mono); font-size: 10.5px; color: var(--faint); letter-spacing: .06em; }
.tl-text { font-size: 13px; margin-top: 1px; }

/* ---------- 图表 ---------- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }

/* ---------- 进度条 ---------- */
.progress { height: 5px; background: var(--panel-3); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.progress.warn > i { background: var(--warn); }
.progress.danger > i { background: var(--danger); }

/* ---------- 详情键值 ---------- */
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; word-break: break-all; }

/* ---------- 登录页 ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 480px; }
.auth-left { background: #17171c; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-left h2 { font-size: 34px; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 16px; font-weight: 600; }
.auth-left p { color: #9a9aa8; font-size: 14px; max-width: 420px; margin: 0; }
.auth-mid { max-width: 540px; }
.auth-mid-hd {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; color: #6e6e7c;
  padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, .13);
}
.auth-mid-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  column-gap: 26px; margin-top: 4px;
}
.auth-mid-grid span {
  font-size: 12px; color: #8e8e9c; padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
@media (max-height: 860px) { .auth-mid { display: none; } }
.auth-metrics { display: flex; gap: 36px; }
.auth-metrics .m .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.auth-metrics .m .k { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #6e6e7c; margin-top: 4px; }
.auth-right { background: var(--panel); display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-form { width: 100%; max-width: 330px; }
.auth-form h3 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.auth-form .hint { color: var(--muted); font-size: 13px; margin: 0 0 26px; }
.auth-demo { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 16px; }
.demo-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-radius: 5px; cursor: pointer; font-size: 12.5px; }
.demo-row:hover { background: var(--panel-2); }
.demo-row code { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* ---------- 其他 ---------- */
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.hr-thin { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.scroll-x { overflow-x: auto; }
.mt0 { margin-top: 0 } .mt8 { margin-top: 8px } .mt16 { margin-top: 16px } .mt24 { margin-top: 24px }
.mb0 { margin-bottom: 0 } .mb8 { margin-bottom: 8px } .mb16 { margin-bottom: 16px }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }

.menu { position: absolute; right: 0; top: 38px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 5px; min-width: 168px; z-index: 60; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: none; border-radius: 5px; font-size: 13px; cursor: pointer; text-align: left; color: var(--ink-2); }
.menu button:hover { background: var(--panel-3); }
.menu button.danger { color: var(--danger); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 0; }

.mobile-only { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 264px;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .mobile-only { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .view { padding: 18px 16px 60px; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat .value { font-size: 24px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search input { width: 100%; }
  .topbar-actions .btn span { display: none; }
  .drawer { width: 100%; }
  .kv { grid-template-columns: 84px 1fr; }
}

@media print {
  .side, .topbar-actions, .no-print { display: none !important; }
  .app { grid-template-columns: 1fr; }
}

/* ---------------- 全局搜索 ---------------- */
.gs-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 11px;
  margin-left: auto;
  margin-right: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-3);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, color .15s;
  max-width: 300px;
}
.gs-trigger:hover { border-color: #d2d2dc; color: var(--ink-2); box-shadow: 0 1px 2px rgba(20,20,30,.04); }
.gs-trigger ~ .topbar-actions { margin-left: 0; }
.gs-trigger-ico { font-size: 14px; line-height: 1; color: var(--ink-3); }
.gs-trigger-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-3);
  background: var(--bg);
  white-space: nowrap;
}

.gs-wrap { display: flex; flex-direction: column; gap: 10px; min-height: 260px; }
.gs-input { width: 100%; height: 40px; font-size: 14px; }
.gs-body { flex: 1; max-height: 380px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.gs-empty { padding: 46px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.gs-group { margin-bottom: 6px; }
.gs-group-hd {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 8px 5px;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.gs-count {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  background: var(--bg); border-radius: 20px; padding: 1px 6px;
}
.gs-item {
  display: flex; align-items: baseline; gap: 8px;
  width: 100%; text-align: left;
  padding: 8px 9px; border: 0; border-radius: 7px;
  background: transparent; cursor: pointer;
  font: inherit; color: inherit;
}
.gs-item.on { background: var(--bg); }
.gs-title { font-size: 13.5px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.gs-sub { font-size: 12px; color: var(--ink-3); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-tag {
  font-size: 10.5px; padding: 1px 6px; border-radius: 4px;
  background: #f1f1f5; color: var(--ink-2); white-space: nowrap;
}

@media (max-width: 980px) {
  .gs-trigger { max-width: 180px; margin-right: 8px; }
  .gs-trigger-txt { display: none; }
  .gs-kbd { display: none; }
}

/* ---------------- 我的空间 / 合同管理 ---------------- */
.c-ok { color: var(--ok); }
.c-warn { color: var(--warn); }
.c-bad { color: var(--danger); }

.btn-xs { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: var(--radius-sm); }
.input-sm { height: 30px; font-size: 12.5px; padding: 0 9px; }
.gap8 { gap: 8px; }
.cell-main { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.cell-sub { font-size: 11px; color: var(--faint); letter-spacing: .02em; }

.chip {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 11.5px;
  color: var(--ink-2);
  background: #fff;
}

/* 个人信息 */
.me-head { display: flex; align-items: flex-start; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.me-head-main { min-width: 0; flex: 1; }
.me-name { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.me-sub { margin-top: 5px; font-size: 13px; color: var(--ink-2); }
.me-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.me-grid { margin-top: 18px; }
.me-grid .kv { grid-template-columns: 72px 1fr 72px 1fr; }
@media (max-width: 760px) { .me-grid .kv { grid-template-columns: 72px 1fr; } }

/* 假期额度 */
.bal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.bal-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.bal-hd { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.bal-type { font-size: 13px; font-weight: 500; }
.bal-num { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.bal-num b { font-size: 15px; color: var(--ink); font-weight: 600; }
.bal-foot { margin-top: 8px; font-size: 11px; color: var(--faint); }

/* 迷你统计 */
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.mini { padding: 10px 12px; border-radius: 8px; background: var(--bg); }
.mini .label { display: block; margin-bottom: 4px; }
.mini b { font-size: 18px; font-weight: 600; font-family: var(--mono); }
.mini i { font-style: normal; font-size: 11px; color: var(--faint); margin-left: 3px; }

/* 考勤色块 */
.att-strip { display: flex; flex-wrap: wrap; gap: 4px; }
.att-cell {
  width: 26px; height: 26px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-family: var(--mono); cursor: default;
}
.att-cell.ok { background: var(--ok-soft); color: var(--ok); }
.att-cell.warn { background: var(--warn-soft); color: var(--warn); }
.att-cell.bad { background: var(--danger-soft); color: var(--danger); }

/* 双列区块 */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; gap: 16px; } }
.sub-hd { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.plain-list li:last-child { border-bottom: 0; }

/* 工资条 */
.slip-sec { margin-bottom: 16px; }
.slip-hd { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.slip-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.slip-row.total { border-bottom: 0; border-top: 1px solid var(--line-2); font-weight: 600; margin-top: 2px; padding-top: 8px; }
.slip-net {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 16px; border-radius: 9px; background: var(--bg);
}
.slip-net span { font-size: 12.5px; color: var(--ink-2); }
.slip-net b { font-size: 22px; font-weight: 600; font-family: var(--mono); letter-spacing: -.02em; }

@media (max-width: 640px) {
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .me-head { flex-direction: column; gap: 12px; }
}

/* 登录页联系方式：已登录的人找不到人问时，这里能直接拨号 */
.auth-contact {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex; align-items: baseline; justify-content: center;
  gap: 7px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; letter-spacing: .03em;
  color: var(--faint);
}
.auth-contact b { font-weight: 500; color: var(--ink-2); }
.auth-contact .sep { color: var(--line-2); }
.auth-contact a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.auth-contact a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* 登录页返回产品页 */
.auth-back {
  display: block;
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  text-decoration: none;
  transition: color .15s;
}
.auth-back:hover { color: var(--ink-2); }

/* ==================== 审批中心 ==================== */
.ap-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.ap-row:last-child { border-bottom: 0; }
.ap-row-l { display: flex; gap: 12px; min-width: 0; flex: 1 1 auto; }
.ap-icon {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.ap-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ap-level {
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em;
  color: var(--accent); background: var(--accent-soft);
  padding: 2px 6px; border-radius: var(--radius-sm);
}
.ap-detail { margin-top: 4px; }
.ap-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 7px; }
.ap-row-r { display: flex; gap: 6px; flex: 0 0 auto; align-items: center; }

/* 审批链小圆点 */
.ap-chain { display: inline-flex; align-items: center; gap: 4px; }
.ap-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; line-height: 1; padding: 3px 6px 3px 4px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--muted); background: var(--panel);
}
.ap-chip i {
  font-style: normal; font-family: var(--mono); font-size: 9px;
  width: 13px; height: 13px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--panel-3); color: var(--faint);
}
.ap-chip.ok { border-color: #bfe0cf; background: var(--ok-soft); color: #146b43; }
.ap-chip.ok i { background: #cfe9dc; color: #146b43; }
.ap-chip.no { border-color: #ecc9c5; background: var(--danger-soft); color: var(--danger); }
.ap-chip.no i { background: #f6d6d2; color: var(--danger); }
.ap-chip.now { border-color: var(--accent); background: var(--accent); color: #fff; }
.ap-chip.now i { background: rgba(255, 255, 255, .22); color: #fff; }
.ap-chip.skip, .ap-chip.end { opacity: .5; border-style: dashed; }

/* 审批人缺口 */
.stat-link { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.stat-link:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft, #eef4ff); }
.stat-more { font-style: normal; font-size: 10px; color: var(--accent); margin-left: 4px; }
.gap-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gap-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); }
.gap-check { display: flex; align-items: center; }
.gap-main { flex: 1; min-width: 0; }
.gap-hd { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.gap-user { font-family: var(--mono); flex: 0 0 auto; }
.gap-all { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-right: auto; }

/* 流程抽屉 */
.ap-sum {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft, #fafaf9);
  padding: 12px 14px; margin-bottom: 16px;
}
.ap-sum-row {
  display: grid; grid-template-columns: 64px 1fr 64px 1fr; gap: 6px 10px;
  align-items: baseline; font-size: 13px;
}
.ap-sum-row + .ap-sum-row { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.ap-sum-k { color: var(--faint); font-size: 12px; }
.ap-sum-v { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.ap-sum-v.span2 { grid-column: 2 / -1; }
.ap-sum-v.strong { font-weight: 600; }
.ap-drawer-act { display: flex; gap: 10px; justify-content: flex-end; align-items: center; width: 100%; }
.ap-note {
  font-size: 12px; line-height: 1.55; padding: 8px 11px; margin-bottom: 12px;
  border-radius: var(--radius-sm); background: var(--warn-soft); color: #8a5a12;
  border: 1px solid #f0dcb8;
}
.ap-flow { display: flex; flex-direction: column; }
.ap-flow-item { display: flex; gap: 12px; padding: 0 0 18px; position: relative; }
.ap-flow-item:not(:last-child)::before {
  content: ''; position: absolute; left: 11px; top: 26px; bottom: 0; width: 1px; background: var(--line-2);
}
.ap-flow-dot {
  width: 23px; height: 23px; flex: 0 0 auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--faint);
}
.ap-flow-item.ok .ap-flow-dot { background: var(--ok-soft); border-color: #bfe0cf; color: #146b43; }
.ap-flow-item.no .ap-flow-dot { background: var(--danger-soft); border-color: #ecc9c5; color: var(--danger); }
.ap-flow-item.now .ap-flow-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.ap-flow-item.skip .ap-flow-dot, .ap-flow-item.end .ap-flow-dot { border-style: dashed; opacity: .6; }
.ap-flow-main { min-width: 0; padding-top: 1px; }
.ap-flow-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }

/* 配置页 */
.ap-cfg { display: grid; grid-template-columns: 208px 1fr; gap: 18px; align-items: start; }
.ap-cfg-side {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 12px; position: sticky; top: 12px;
}
.ap-cfg-side-hd {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em;
  color: var(--faint); padding: 2px 4px 10px;
}
.ap-cfg-kind {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 8px; margin-bottom: 2px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; cursor: pointer; text-align: left; font: inherit;
}
.ap-cfg-kind:hover { background: var(--panel-2); }
.ap-cfg-kind.on { background: var(--accent-soft); border-color: #cfe0d8; }
.ap-cfg-kind-i {
  width: 22px; height: 22px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  background: var(--panel-3); color: var(--muted); border-radius: var(--radius-sm); font-size: 11px;
}
.ap-cfg-kind.on .ap-cfg-kind-i { background: var(--accent); color: #fff; }
.ap-cfg-kind-t { display: flex; flex-direction: column; min-width: 0; }
.ap-cfg-kind-t b { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.ap-cfg-kind-t i { font-style: normal; font-size: 10.5px; color: var(--faint); margin-top: 1px; }
.ap-cfg-note {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 11px; line-height: 1.75; color: var(--faint);
}

.ap-cfg-main { min-width: 0; }
.ap-cfg-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-bottom: 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 14px;
}
.ap-cfg-hd-l { display: flex; align-items: center; gap: 12px; }
.ap-cfg-name { width: 220px; font-size: 14px; font-weight: 500; }
.ap-cfg-hd-r { display: flex; gap: 8px; }
.ap-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.ap-switch input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.ap-tip {
  padding: 9px 12px; margin-bottom: 14px; font-size: 12px;
  background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm);
}

.ap-rule { border: 1px solid var(--line-2); border-radius: var(--radius); margin-bottom: 12px; background: var(--panel); }
.ap-rule-default { border-style: dashed; background: var(--panel-2); }
.ap-rule-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.ap-rule-default .ap-rule-hd { background: transparent; }
.ap-rule-no {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--faint); flex: 0 0 auto;
}
.ap-rule-name { width: 180px; height: 28px; font-size: 12.5px; }
.ap-rule-sub { font-size: 11.5px; color: var(--faint); }
.ap-rule-when {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.ap-rule-when-t { font-size: 12px; color: var(--faint); }
.ap-rule-when .input { height: 28px; font-size: 12.5px; width: auto; }
.ap-rule-field { width: 150px; }
.ap-rule-op { width: 78px; }
.ap-rule-val { width: 110px; }
.ap-rule-steps { padding: 10px 12px 12px; }
.ap-step { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.ap-step-no {
  width: 18px; height: 18px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9.5px; border-radius: 50%;
  background: var(--panel-3); color: var(--muted);
}
.ap-step .input { height: 28px; font-size: 12.5px; }
.ap-step-type { width: 106px; }
.ap-step-target { width: 118px; }
.ap-step-name { width: 140px; }
.ap-add-step, .ap-add-rule { font-size: 12px; }
.ap-add-rule { margin-top: 2px; }

@media (max-width: 900px) {
  .ap-cfg { grid-template-columns: 1fr; }
  .ap-cfg-side { position: static; display: flex; gap: 6px; overflow-x: auto; padding: 8px; }
  .ap-cfg-side-hd, .ap-cfg-note { display: none; }
  .ap-cfg-kind { width: auto; flex: 0 0 auto; margin-bottom: 0; }
  .ap-row { flex-direction: column; align-items: stretch; }
  .ap-row-r { justify-content: flex-end; }
  .ap-step { flex-wrap: wrap; }
  .ap-sum-row { grid-template-columns: 60px 1fr; }
  .ap-sum-v.span2 { grid-column: 2 / -1; }
}

/* 窄屏：条件行与节点行改为弹性宽度，避免挤成三四行 */
@media (max-width: 560px) {
  .ap-rule-when { row-gap: 6px; }
  .ap-rule-field { flex: 1 1 92px; width: auto; min-width: 0; }
  .ap-rule-op { flex: 0 0 70px; width: 70px; }
  .ap-rule-val { flex: 1 1 76px; width: auto; min-width: 0; }
  .ap-step { row-gap: 6px; }
  .ap-step-type { flex: 1 1 96px; width: auto; min-width: 0; }
  .ap-step-target { flex: 1 1 92px; width: auto; min-width: 0; }
  .ap-step-name { order: 9; flex: 1 1 100%; width: auto; min-width: 0; }
  .ap-rule-hd { flex-wrap: wrap; row-gap: 6px; }
  .ap-rule-name { flex: 1 1 100px; min-width: 0; }
  /* 窄屏下名称独占一行，恢复边框以便看出可编辑 */
  .ap-step-name, .ap-rule-name { border-color: var(--line-2); background: var(--panel); }
}
.ap-warn {
  font-size: 10.5px; line-height: 1; padding: 3px 6px; border-radius: var(--radius-sm);
  background: var(--warn-soft); color: var(--warn); border: 1px solid #f0dcb8;
}

/* 名称类输入：静态时无边框，聚焦才显形，避免和类型下拉抢注意力 */
.ap-rule-name, .ap-step-name {
  border-color: transparent; background: transparent;
}
.ap-rule-name:hover, .ap-step-name:hover { border-color: var(--line-2); background: var(--panel); }
.ap-rule-name:focus, .ap-step-name:focus { border-color: var(--accent); background: var(--panel); }
.ap-rule-name { font-weight: 500; color: var(--ink); }

/* ================= AI 能力 ================= */
/* 基调沿用编辑风：细线、留白、等宽小字，不用渐变与发光，避免"AI 味" */

@keyframes ai-spin { to { transform: rotate(360deg); } }

.spin {
  display: inline-block; width: 10px; height: 10px; margin-right: 6px;
  border: 1.5px solid var(--line-2); border-top-color: var(--accent);
  border-radius: 50%; animation: ai-spin .7s linear infinite; vertical-align: -1px;
}

/* 上传条 */
.ai-drop {
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  background: var(--panel-2); padding: 12px 14px; margin-bottom: 18px;
}
.ai-drop-hd { display: flex; align-items: flex-start; gap: 10px; }
.ai-mark {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: var(--radius-sm); background: var(--accent); color: #fff;
  font-size: 11px; line-height: 1;
}
.ai-drop-tt { flex: 1; min-width: 0; }
.ai-drop-title { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: .01em; }
.ai-drop-hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ai-drop-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ai-drop-acts label.btn { cursor: pointer; }
.ai-drop-acts .disabled { opacity: .5; pointer-events: none; }

.ai-drop-body { margin-top: 10px; }

.ai-drop-status {
  margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--ink-2);
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--panel);
  border-left: 2px solid var(--line-2);
}
.ai-drop-status.run { color: var(--muted); }
.ai-drop-status.ok { border-left-color: var(--ok); background: var(--ok-soft); color: #14532d; }
.ai-drop-status.warn { border-left-color: var(--warn); background: var(--warn-soft); color: #6b3d05; }
.ai-drop-status.err { border-left-color: var(--danger); background: var(--danger-soft); color: #7a1a13; }
.ai-drop-status.off { border-left-color: var(--faint); color: var(--muted); background: var(--panel-3); }
.ai-drop-status b { font-weight: 600; }
.ai-warn { margin: 6px 0 0; padding-left: 16px; }
.ai-warn li { margin: 2px 0; }

/* AI 回填的字段：短暂描边，方便人眼复核 */
.ai-filled {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(27, 77, 62, .1);
  transition: box-shadow .2s, border-color .2s;
}

/* 报表 AI 解读卡片 */
.ai-insight { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.ai-insight-hd {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 10px; background: var(--panel-2);
}
.ai-insight-hd .ai-mark { margin-top: 1px; }
.ai-insight-headline { font-size: 14.5px; font-weight: 600; line-height: 1.55; color: var(--ink); }
.ai-insight-body { padding: 4px 16px 16px; }
.ai-finding { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ai-finding:last-child { border-bottom: 0; }
.ai-finding-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ai-finding-title { font-size: 13px; font-weight: 600; }
.ai-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--line-2); }
.ai-dot.good { background: var(--ok); }
.ai-dot.warn { background: var(--warn); }
.ai-dot.bad { background: var(--danger); }
.ai-finding-detail { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.ai-actions { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: ai-act; }
.ai-actions li {
  counter-increment: ai-act; position: relative; padding: 8px 0 8px 26px;
  font-size: 12.5px; color: var(--ink-2); line-height: 1.7; border-bottom: 1px dashed var(--line);
}
.ai-actions li:last-child { border-bottom: 0; }
.ai-actions li::before {
  content: counter(ai-act); position: absolute; left: 0; top: 9px;
  width: 16px; height: 16px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 10px; color: var(--accent);
  border: 1px solid var(--line-2); border-radius: 50%;
}
.ai-watch {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border-left: 2px solid var(--accent);
  font-size: 12.5px; color: var(--accent-2); line-height: 1.65;
}
.ai-watch span { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); display: block; margin-bottom: 3px; }
.ai-foot { margin-top: 10px; font-size: 10.5px; font-family: var(--mono); color: var(--faint); letter-spacing: .02em; }

/* 问答 */
.ai-ask-log { display: flex; flex-direction: column; gap: 14px; }
.ai-msg { display: flex; gap: 10px; align-items: flex-start; }
.ai-msg .who {
  flex: none; width: 24px; height: 24px; border-radius: var(--radius-sm); display: grid; place-items: center;
  font-size: 10px; font-family: var(--mono); border: 1px solid var(--line-2); color: var(--muted); background: var(--panel-2);
}
.ai-msg.me .who { background: var(--panel-3); }
.ai-msg.bot .who { background: var(--accent); color: #fff; border-color: var(--accent); }
.ai-bubble {
  flex: 1; min-width: 0; font-size: 13px; line-height: 1.75; color: var(--ink-2);
  padding: 10px 13px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line);
}
.ai-msg.me .ai-bubble { background: var(--panel-3); }
.ai-bubble p { margin: 0 0 8px; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-bubble strong { color: var(--ink); font-weight: 600; }
.ai-bubble ul { margin: 6px 0; padding-left: 18px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-chip {
  font-size: 12px; padding: 5px 10px; border-radius: 100px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2);
  transition: border-color .15s, color .15s, background .15s;
}
.ai-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ai-ask-form { display: flex; gap: 8px; margin-top: 14px; }
.ai-ask-form .textarea { min-height: 42px; max-height: 140px; resize: vertical; }
.ai-bubble code {
  font-family: var(--mono); font-size: 11.5px; padding: 1px 4px;
  background: var(--panel-3); border-radius: var(--radius-sm); color: var(--ink);
}
.ai-bubble ol { margin: 6px 0; padding-left: 18px; }
.ai-bubble li { margin: 3px 0; }
.ai-ask-hint { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.ai-ask-empty { padding: 4px 0 2px; }
.ai-ask-form .textarea { flex: 1; }
.ai-ask-form .btn { align-self: flex-end; height: 42px; }
