/* ═══════════════════════════════════════════════════════════
   苏河汇 · 公共组件层（模板基准：审计页 employee-review）
   约定：跨页复用的组件进本文件；单页私有类写在 static/css/pages/*.css
   ═══════════════════════════════════════════════════════════ */

/* ── 顶栏 ── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 32px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.topbar h1 { font-size: 17px; font-weight: 700; }
.topbar h1 span { font-weight: 300; color: var(--fg2); }
.topbar select, .topbar button { padding: 6px 12px; border: none; border-radius: var(--radius-s); font-size: 13px; background: var(--bg); color: var(--fg); font-family: inherit; cursor: pointer; transition: background var(--t-fast); }
.topbar select:hover, .topbar button:hover { background: var(--fill); }
.topbar button { background: var(--fg); color: var(--fg-invert); font-weight: 600; }
.topbar button:hover { background: var(--fg-hover); }
.topbar .nav-link { font-size: 12px; color: var(--blue); text-decoration: none; }
.topbar .nav-link:hover { text-decoration: underline; }
.topbar-nav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.topbar-nav .nav-link.active { color: var(--fg); font-weight: 600; }

/* ── 区块标题（去竖条、下横线）── */
.section-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; padding-bottom: 8px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.section-title .summary { font-weight: 400; font-size: 12px; color: var(--fg3); margin-left: 8px; }

/* ── 徽章 ──（inline-flex：icon 与文字垂直居中，gap 控制间距） */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.badge.done { background: var(--success-bg); color: var(--success-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.fail { background: var(--danger-bg); color: var(--danger-text); }
.badge.active { background: var(--fill); color: var(--fg); }
.badge.pending { background: var(--fill-soft); color: var(--fg3); }
.badge.skip { background: var(--fill-soft); color: var(--fg3); }
.badge.info { background: var(--info-bg); color: var(--info-text); }
.badge-link { cursor: pointer; text-decoration: none; }
.badge-link:hover { filter: brightness(0.94); }
.badge.solid { color: var(--fg-invert); border-radius: var(--radius-s); padding: 1px 7px; }  /* 实底变体（密集对比表用） */

/* ── 按钮 ── */
.btn { padding: 8px 18px; border-radius: var(--radius-s); font-size: 13px; font-weight: 600; cursor: pointer; border: none; font-family: inherit; transition: all var(--t-fast); }
.btn:hover { filter: brightness(0.96); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-dark { background: var(--fg); color: var(--fg-invert); }
.btn-dark:hover { background: var(--fg-hover); }
.btn-accent { background: var(--amber); color: var(--fg-invert); }
.btn-accent:hover { background: var(--warn-text); }
.btn-ghost { background: var(--bg); border: none; color: var(--fg2); }
.btn-ghost:hover { background: var(--fill); }

/* ── 键盘焦点态（Tab 走查可见；鼠标点击不显示 outline）── */
:focus-visible { outline: 2px solid var(--info-text) !important; outline-offset: 2px; }  /* !important 压过表单控件既有 outline:none（搜索框/模态/登录/判定框） */
.btn:focus-visible, .btn-page:focus-visible, .close-btn:focus-visible, .chip:focus-visible { outline-offset: 1px; }
.searchable-select input:focus-visible, .topbar select:focus-visible, .modal input:focus-visible, .modal select:focus-visible { outline-offset: 0; }

/* ── 禁用态统一（降透明 + 禁指针 + 去 hover 滤镜）── */
.btn:disabled, .btn-page:disabled, .btn-pipeline:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

/* ── 区域加载遮罩（common.js setLoading 切换 .is-loading）── */
.is-loading { position: relative; }
.is-loading::after { content: ''; position: absolute; inset: 0; background: var(--overlay-loading); z-index: 5; }
.is-loading::before { content: ''; position: absolute; left: 50%; top: 120px; width: 22px; height: 22px; margin-left: -11px; border: 2.5px solid var(--line); border-top-color: var(--info-text); border-radius: 50%; animation: spin 0.8s linear infinite; z-index: 6; }

/* ── 空状态 ── */
.no-data { text-align: center; padding: 60px; color: var(--fg3); }
.no-data p { font-size: 14px; }
.no-data .hint { font-size: 12px; margin-top: 4px; }
.empty { text-align: center; padding: 64px 0; color: var(--fg3); }
.empty .icon { font-size: 40px; margin-bottom: 10px; }
.empty .text { font-size: 16px; }

/* ── 表格（无外框，仅表头下横线 + 行间横线，无竖线）── */
.detail-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-m); margin-bottom: 24px; }
.detail-table th { text-align: left; font-size: 11px; color: var(--fg3); text-transform: uppercase; letter-spacing: 0.1em; padding: 10px 14px; background: var(--bg-subtle); border-bottom: 1px solid var(--line); font-weight: 500; }
.detail-table td { padding: 14px 14px; font-size: 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
.detail-table tr:last-child td { border-bottom: none; }
.detail-table tbody tr { cursor: pointer; }
.detail-table tbody tr:hover td { background: var(--fill-hover); }
.detail-table tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--fg2); }  /* 行 hover 左缘强调条 */
/* 密排变体（明细账/认证表等行密场景）+ 金额列（右对齐等宽） */
.detail-table.compact th { padding: 8px 10px; letter-spacing: 0.08em; }
.detail-table.compact td { padding: 8px 10px; font-size: 12px; }
.detail-table td.num { text-align: right; font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.detail-table th.num { text-align: right; }
.detail-table.num-head th { text-align: right; }
.detail-table th.l, .detail-table td.l { text-align: left; }

/* ── 抽屉 ── */
.drawer-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: var(--z-drawer); display: none; }
.drawer-overlay.show { display: block; }
.drawer { position: fixed; top: 0; right: 0; width: 520px; height: 100%; max-width: 92vw; background: var(--surface); border-left: 1px solid var(--line); z-index: var(--z-drawer); overflow-y: auto; padding: 0; box-shadow: -2px 0 12px rgba(0,0,0,0.06); transform: translateX(100%); transition: transform var(--t-slow); }
.drawer.show { transform: translateX(0); }
.drawer-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; z-index: 1; }
.drawer-head h3 { font-size: 16px; font-weight: 700; }
.drawer-body { padding: 24px; }
.close-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--bg); font-size: 16px; cursor: pointer; color: var(--fg3); display: flex; align-items: center; justify-content: center; transition: background var(--t-fast); }
.close-btn:hover { background: var(--fill); }

/* ── 判定/归因 ── */
.verdict { display: inline-block; margin-left: 4px; font-weight: 600; font-size:11px; }
.verdict-system { color: var(--success-text); }
.verdict-external { color: var(--danger-text); }
.verdict-uncertain { color: var(--fg2); }
.agent-diagnosis { font-size:11px; color: var(--success-text); margin-top: 4px; padding: 5px 10px; background: var(--success-bg); border-radius: var(--radius-s); }
.confidence-high { color: var(--success-text); font-weight: 700; }
.confidence-medium { color: var(--warn-text); font-weight: 600; }
.confidence-low { color: var(--fg3); }

/* ── 加载 ── */
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 图标体系（实心圆点 + 实心对勾，stroke=currentColor 由 class 控色）── */
.icon { display: inline-flex; align-items: center; justify-content: center; vertical-align: -0.12em; flex: none; }
.icon svg { display: block; }
.ic-check { color: var(--success-text); }
.ic-error { color: var(--danger-text); }
.ic-warn { color: var(--warn-text); }
.ic-muted { color: var(--fg3); }
.ic-14 { width: 14px; height: 14px; }
.ic-16 { width: 16px; height: 16px; }
.ic-18 { width: 18px; height: 18px; }
.ic-20 { width: 20px; height: 20px; }

/* ── 卡片基类 ──
   新卡片直接用 .card；既有卡片类经下方选择器组声明归并（padding/布局差异在各页 css）。
   无边框组 = 柔光卡（soft-card 系，审计页基准风格）：stat-card 统计卡看板/待复核两页
   共用，走无边框；login-card 用 radius-l 特例不在此列。 */
.card, .certify-section, .toolbar-card, .module-card, .readiness-panel,
.tri-card, .log-panel, .panel, .fg-card, .pipeline-banner {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.soft-card, .stat-card, .fg-mini, .agent-summary { background: var(--surface); border-radius: var(--radius-m); }

/* ── 自定义下拉（multi-drop）—— 供员工筛选多选/单选共用 ── */
.multi-drop { position: relative; font-size: 12px; }
.multi-drop .trigger {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 28px 5px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--fg2);
  cursor: pointer; min-width: 100px; white-space: nowrap;
  position: relative;
}
.multi-drop .trigger::after {
  content: '';
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--line-strong);
}
.multi-drop .trigger.has-sel { color: var(--fg); font-weight: 600; }
.multi-drop .panel {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow-panel);
  padding: 6px; min-width: 180px; z-index: var(--z-dropdown);
  max-height: 240px; overflow-y: auto;
}
.multi-drop.open .panel { display: block; }
.multi-drop .panel label {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius-s); cursor: pointer;
  font-size: 12px; color: var(--fg2);
}
.multi-drop .panel label:hover { background: var(--fill-soft); }
.multi-drop .panel label input[type="checkbox"] {
  width: 14px; height: 14px; accent-color: var(--fg); cursor: pointer;
}
.multi-drop .panel label.checked { color: var(--fg); font-weight: 600; background: var(--bg-subtle); }

/* ── 可搜索下拉选择器（公司搜索，审计页基准）── */
.searchable-select { position: relative; min-width: 220px; }
.searchable-select input[type="text"] { padding: 8px 12px; border: none; border-radius: var(--radius-m); font-size: 13px; background: var(--bg); color: var(--fg); font-family: inherit; width: 100%; outline: none; transition: background var(--t-fast); }
.searchable-select input[type="text"]:hover { background: var(--fill-soft); }
.searchable-select input[type="text"]:focus { background: var(--surface); }
.search-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; max-height: 280px; overflow-y: auto; background: var(--surface); border-radius: var(--radius-m); margin-top: 4px; z-index: var(--z-overlay); box-shadow: var(--shadow-panel); }
.search-dropdown.show { display: block; }
.search-dropdown-item { padding: 8px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-dropdown-item:last-child { border-bottom: none; }
.search-dropdown-item:hover, .search-dropdown-item.active { background: var(--fill-soft); }
.search-dropdown-item .highlight { color: var(--blue); font-weight: 600; }
.search-dropdown-empty { padding: 12px; font-size: 12px; color: var(--fg3); text-align: center; }

/* ── 审计口径切换（boss 看板 + 员工审查页共用：员工侧自审/交叉审计/AI 侧自审）──
   2026-09-02 起两页同款，从页面私有层升入公共组件层（test_style_lint 跨页同名类守护） */
.scope-switch { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; }
.scope-switch .scope-label { font-size: 12px; color: var(--fg3); }
.scope-btn { padding: 5px 16px; border-radius: var(--radius-l); border: 1px solid var(--line);
             background: var(--fill-soft); color: var(--fg2); font-size: 13px; cursor: pointer;
             transition: color var(--t-fast), border-color var(--t-fast); }
.scope-btn:hover:not(:disabled) { color: var(--fg); }
.scope-btn.active { border-color: var(--audit-accent); color: var(--audit-accent); background: var(--surface); font-weight: 600; }
.scope-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── 引导式空状态（带步骤，审计页基准）── */
.empty-state { max-width: 360px; margin: 0 auto; }
.empty-state .empty-icon { width: 48px; height: 48px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--fill-soft); color: var(--fg3); }
.empty-state .empty-title { font-size: 16px; font-weight: 700; color: var(--fg); }
.empty-state .empty-desc { font-size: 12px; color: var(--fg3); margin-top: 6px; }
.empty-steps { margin: 24px auto 0; text-align: left; max-width: 300px; display: flex; flex-direction: column; gap: 12px; }
.empty-steps .step { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--fg2); }
.empty-steps .step b { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--fg); color: var(--fg-invert); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }

/* ── 异常行（审计/看板/做账共用）── */
.anomaly-item { font-size: 11px; padding: 2px 0; color: var(--fg2); }
.anomaly-item .sev-P0 { color: var(--red); font-weight: 700; }
.anomaly-item .sev-P1 { color: var(--amber); font-weight: 600; }
.anomaly-item .sev-P2 { color: var(--blue); font-weight: 600; }
.anomaly-item .sev-P3 { color: var(--fg3); }

/* ── 编号徽章（序列/进度，审计页基准）── */
.rank-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-s); background: var(--fill); color: var(--fg2); font-size: 11px; font-weight: 700; line-height: 1; }
.rank-badge.live { background: var(--blue); color: var(--fg-invert); }
.rank-badge.muted { background: var(--fill-soft); color: var(--fg3); font-weight: 500; }

/* ── 进度小条（M/N 分页进度，审计页基准）── */
.progress-note { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: var(--fg2); }
.progress-track { width: 90px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width var(--t-slow); }

/* ── 统计卡（看板/待复核共用；HTML 顺序 label→value→sub）── */
.stats { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card { flex: 1; padding: 18px 24px 20px; }
.stat-card .label { font-size: 11px; color: var(--fg3); letter-spacing: 0.12em; margin-bottom: 10px; }
.stat-card .value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-card .sub { font-size: 12px; color: var(--fg2); margin-top: 6px; }

/* ── Toast 提示（全站统一三态：ok/err/info）── */
.toast { position: fixed; top: 16px; right: 16px; padding: 10px 20px; border-radius: var(--radius-m); font-size: 13px; font-weight: 600; z-index: var(--z-top); display: none; border: 1px solid; max-width: 360px; }
.toast.show { display: block; animation: slideIn var(--t-slow); }
.toast.ok { background: var(--success-bg); color: var(--success-text); border-color: var(--success-line); }
.toast.err { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-line); }
.toast.info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-line); }
@keyframes slideIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Drawer 小节 + 键值行（审计页基准：space-between 两端对齐）── */
.drawer-section { margin-bottom: 20px; }
.drawer-section h4 { font-size: 12px; color: var(--fg3); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 8px; }
.kv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv-row:hover { background: var(--fill-soft); }
.kv-row:last-child { border-bottom: none; }
.kv-label { color: var(--fg3); font-size: 12px; flex-shrink: 0; }

/* ── 分页（全站统一：明细账/做账/待复核）── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 0; }
.pagination .page-info { font-size: 12px; color: var(--fg2); }
.pagination .btn-page { font-family: inherit; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: var(--radius-s); cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--fg2); transition: all var(--t-fast); }
.pagination .btn-page:hover:not(:disabled) { border-color: var(--line-strong); color: var(--fg); }
.pagination .btn-page:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Modal 弹窗（待复核/做账共用）── */
.modal-overlay { position: fixed; inset: 0; background: var(--overlay-strong); display: none; align-items: center; justify-content: center; z-index: var(--z-top); }
.modal-overlay.show { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 28px; width: 420px; max-width: 90vw; }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal label { display: block; font-size: 12px; color: var(--fg2); margin-bottom: 4px; margin-top: 14px; }
.modal select, .modal input[type="number"] { width: 100%; font-family: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; background: var(--surface); color: var(--fg); outline: none; }
.modal select:focus, .modal input[type="number"]:focus { border-color: var(--line-strong); }
.modal .modal-actions { display: flex; gap: 10px; margin-top: 24px; }

/* ── 主题切换按钮（topbar nav / login 角标 / styleguide 通用；toggleTheme 见 common.js）──
   图标显示"将切换到"的目标主题：亮色下 moon、暗色下 sun（SVG 走 icon 宏，currentColor 随 color token） */
.theme-toggle { border: none; background: none; cursor: pointer; line-height: 1; padding: 5px 7px; border-radius: var(--radius-s); color: var(--fg2); transition: background var(--t-fast); display: inline-flex; align-items: center; }
.theme-toggle:hover { background: var(--fill); color: var(--fg); }
.theme-toggle .tt-sun { display: none; }
[data-theme="dark"] .theme-toggle .tt-sun { display: inline-flex; }
[data-theme="dark"] .theme-toggle .tt-moon { display: none; }
.theme-toggle .tt-moon { display: inline-flex; }
.topbar .theme-toggle { background: none; color: var(--fg2); font-weight: 400; padding: 5px 7px; }  /* 覆写 .topbar button 主按钮样式 */
.topbar .theme-toggle:hover { background: var(--fill); color: var(--fg); }
.theme-toggle-fixed { position: fixed; top: 16px; right: 16px; z-index: var(--z-top); }  /* 无 topbar 页面（login/book-compare）右上角标 */

/* 主题切换瞬间的全站柔和过渡（toggleTheme 加类 350ms 后移除，避免常驻拖慢渲染） */
html.theme-anim body, html.theme-anim body * { transition: background-color var(--t-slow), border-color var(--t-slow), color var(--t-slow), box-shadow var(--t-slow) !important; }
