/* ============================================================================
 * zr-ui.css · 后台界面组件（依赖 theme.css 的令牌，不含任何业务样式）
 * ----------------------------------------------------------------------------
 * 目录
 *   01 基础重置        02 登录页
 *   03 外壳（侧栏 / 顶栏 / 顶栏页签 / 主区）
 *   04 页头与统计卡    05 页签（分段式 / 下划线式）
 *   06 筛选条与工具条  07 表格
 *   08 分页 / 空态 / 批量条
 *   09 详情（分区 / 字段栅格 / 时间线）
 *   10 表单（左标签 / 两列栅格）
 *   11 弹窗 / 抽屉 / 轻提示
 *   12 工具类
 * ========================================================================== */

/* ============================ 01 基础重置 ============================ */
* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3dae4; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b9c3d0; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 02 登录页 ============================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  /* 底色：深蓝渐变 + 细网格（不用图片） */
  background:
    radial-gradient(900px 520px at 78% 12%, rgba(56, 132, 255, .22), transparent 62%),
    linear-gradient(160deg, #0a1729 0%, #10233c 52%, #0b1b31 100%);
  position: relative;
}
.login-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(120% 90% at 50% 45%, #000 40%, transparent 100%);
  pointer-events: none;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  background: var(--panel);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(2, 8, 22, .65);
}

/* 左：品牌面板 */
.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 30px 32px 26px;
  background: linear-gradient(165deg, #16304f 0%, #0f2542 100%);
  color: #fff;
  overflow: hidden;
}
.login-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}
.login-brand > * { position: relative; z-index: 1; }

.login-brand-logo { display: flex; align-items: center; gap: 10px; }
.login-brand-logo .mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: .5px;
}
.login-brand-logo .name { font-size: 16px; font-weight: 600; letter-spacing: .5px; }
.login-brand-logo .name small {
  display: block;
  font-size: 9.5px; font-weight: 400; letter-spacing: 2.4px;
  color: rgba(255, 255, 255, .55); line-height: 1.4;
}

.login-brand-mid { margin-top: auto; }
.login-brand-mid h2 {
  margin: 0 0 8px;
  font-size: 26px; font-weight: 700; line-height: 1.35; letter-spacing: .5px;
}
.login-brand-mid p {
  margin: 0;
  font-size: 11px; letter-spacing: 3px; color: rgba(255, 255, 255, .55);
}

.login-brand-foot { margin-top: auto; padding-top: 34px; font-size: 12px; color: rgba(255, 255, 255, .45); }

/* 右：表单 */
.login-panel { padding: 44px 46px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-panel h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.login-welcome { margin: 0 0 26px; color: var(--muted); font-size: 13px; }

.login-field { margin-bottom: 16px; }
.login-field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-2); }
.login-field input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid #dbe2ec; border-radius: 10px;
  background: #f4f7fc; outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.login-field input::placeholder { color: var(--muted-weak); }
.login-field input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.login-submit {
  width: 100%; height: 46px; margin-top: 10px;
  border: none; border-radius: 10px;
  background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 600; letter-spacing: 4px;
  cursor: pointer; transition: background .15s, transform .05s;
}
.login-submit:hover { background: var(--primary-dark); }
.login-submit:active { transform: translateY(1px); }

.login-error { min-height: 20px; margin: 4px 0 2px; font-size: 12.5px; color: var(--bad); }

/* ============================ 03 外壳 ============================ */
.app-view { display: flex; height: 100vh; overflow: hidden; }
.app-body { display: flex; height: 100vh; min-height: 0; }

/* ---------- 左侧栏 ---------- */
.sidebar {
  width: var(--w-side);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--side-bg);
  color: var(--side-text);
  overflow: hidden;
  transition: width .22s ease;
}

.side-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  flex: none;
}
.side-logo .logo-mark {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2f5da8, #1b3a66);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
}
.side-logo .logo-text { display: flex; flex-direction: column; line-height: 1.35; white-space: nowrap; }
.side-logo .logo-text b { font-size: 14.5px; font-weight: 600; color: #fff; }
.side-logo .logo-text small { font-size: 9.5px; font-weight: 400; letter-spacing: 1.8px; color: rgba(255, 255, 255, .42); }

.side-toggle {
  margin-left: auto;
  flex: none;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 7px;
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .66);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.side-toggle:hover { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .3); }

.side-search { padding: 2px 14px 10px; flex: none; }
.side-search input {
  width: 100%; height: 34px;
  padding: 0 12px 0 30px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .07);
  color: #fff;
  font-size: 13px;
  outline: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' width='14' height='14'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.55' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='6.5' cy='6.5' r='4.2'/%3E%3Cpath d='M9.8 9.8 L13 13'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  transition: background-color .15s, border-color .15s;
}
.side-search input::placeholder { color: rgba(255, 255, 255, .40); }
.side-search input:focus { border-color: rgba(255, 255, 255, .35); background-color: rgba(255, 255, 255, .12); }
.side-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.side-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 3px; }

.nav-group { display: flex; flex-direction: column; }
.nav-group + .nav-group:not(.open) { border-top: 1px solid rgba(255, 255, 255, .055); }
.nav-group-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 11px;
  border: none; border-radius: 9px;
  background: transparent;
  font-size: 13.5px; font-weight: 600; letter-spacing: .3px;
  color: rgba(255, 255, 255, .78);
  text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-group-head:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-group.open > .nav-group-head { color: #fff; }
.nav-gicon { flex: none; display: flex; align-items: center; color: rgba(255, 255, 255, .55); transition: color .15s; }
.nav-gicon svg { width: 15px; height: 15px; }
.nav-group-head:hover .nav-gicon, .nav-group.open > .nav-group-head .nav-gicon { color: #7ea6e8; }
.nav-group-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-chev { flex: none; color: rgba(255, 255, 255, .38); transition: transform .2s ease; }
.nav-chev svg { width: 12px; height: 12px; display: block; }
.nav-group.open .nav-chev { transform: rotate(90deg); }

.nav-keys {
  display: flex; flex-direction: column; gap: 1px;
  overflow: hidden; max-height: 0; opacity: 0;
  padding-left: 5px; margin: 1px 0 2px;
  transition: max-height .24s ease, opacity .18s ease;
}
.nav-group.open .nav-keys { max-height: 520px; opacity: 1; padding-bottom: 2px; }

.nav-key {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 10px 7px 26px;
  border: none; border-radius: 7px;
  background: transparent;
  font-size: 12.9px; font-weight: 400; line-height: 1.4;
  color: rgba(255, 255, 255, .62);
  text-align: left; cursor: pointer;
  transition: background .13s, color .13s;
}
.nav-key::before {
  content: '';
  position: absolute; left: 15px;
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255, 255, 255, .28);
  transition: background .13s, transform .13s;
}
.nav-key:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-key:hover::before { background: rgba(255, 255, 255, .55); }
.nav-key.active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav-key.active::before { background: #7ea6e8; transform: scale(1.3); }
.nav-key .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  flex: none;
  min-width: 18px; padding: 0 5px;
  border-radius: 9px;
  background: #e5484d; color: #fff;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}

.sidebar-foot {
  flex: none;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--side-line);
  font-size: 11.5px; line-height: 1.7;
  color: rgba(255, 255, 255, .42);
}

/* 收起成图标栏（可选：去掉这个类就是常规宽侧栏） */
.app-view.side-rail .sidebar { width: var(--w-rail); }
.app-view.side-rail .side-logo { padding: 14px 0 8px; flex-direction: column; gap: 8px; justify-content: center; }
.app-view.side-rail .side-logo .logo-text,
.app-view.side-rail .side-search,
.app-view.side-rail .nav-group-title,
.app-view.side-rail .nav-chev,
.app-view.side-rail .nav-keys,
.app-view.side-rail .sidebar-foot { display: none; }
/* 收起后保留「展开」按钮：箭头转 180°，点一下还原 */
.app-view.side-rail .side-toggle { margin-left: 0; transform: rotate(180deg); }
.app-view.side-rail .nav-group-head { justify-content: center; padding: 11px 0; }
.app-view.side-rail .nav-gicon svg { width: 17px; height: 17px; }

/* ---------- 右侧列 ---------- */
.right-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: var(--h-topbar);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 0 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  position: relative;
  z-index: 30;
}

.side-open, .side-expand {
  flex: none;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.side-open { display: none; }
.side-expand:hover, .side-open:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }

.top-tabs { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.top-tabs::-webkit-scrollbar { height: 0; }
.top-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border: none; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13.5px; white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.top-tab svg { width: 15px; height: 15px; opacity: .8; }
.top-tab:hover { background: var(--panel-alt); color: var(--text); }
.top-tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.top-tab.active svg { opacity: 1; }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: var(--panel-alt); border-color: var(--border); color: var(--text); }

.topbar-sep { width: 1px; height: 22px; background: var(--border); }

/* 通知：按钮 + 红点 + 下拉面板 */
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: 1px; right: 0;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 8px;
  background: #e5484d; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
}
.notif-badge.zero { display: none; }
.notif-panel {
  position: absolute; top: 40px; right: 0;
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 50;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
}
.notif-read-all { border: none; background: transparent; color: var(--primary); font-size: 12.5px; cursor: pointer; }
.notif-list { max-height: 300px; overflow-y: auto; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid #f2f4f7; font-size: 13px; }
.notif-item .n-time { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted-weak); }
.notif-item:hover { background: var(--panel-alt); }

/* 用户 */
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 10px 3px 4px;
  border: 1px solid var(--border); border-radius: 20px;
  background: var(--panel-alt);
  font-size: 13px; color: var(--text);
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.user-chip:hover { background: #f1f5fb; border-color: var(--border-strong); }
.user-chip .u-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #3b6fd4, #234a8c);
  color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.user-chip .uname { font-weight: 600; }

.user-menu-wrap { position: relative; }
.user-menu {
  position: absolute; top: 38px; right: 0;
  min-width: 150px; padding: 5px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 50;
}
.user-menu-item {
  display: block; width: 100%; padding: 8px 12px;
  border: none; border-radius: 7px;
  background: transparent; text-align: left;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.user-menu-item:hover { background: var(--panel-alt); }
.user-menu-item.danger { color: var(--bad); }
.user-menu-item.danger:hover { background: var(--bad-soft); }

/* ---------- 主区 ---------- */
#main { flex: 1; min-width: 0; overflow-y: auto; padding: var(--pad-main); }

/* ============================ 04 页头与统计卡 ============================ */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.page-sub { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.stat-card:hover { border-color: #cfdaea; box-shadow: 0 6px 18px rgba(16, 24, 40, .08); transform: translateY(-1px); }
.stat-card .s-label { font-size: 12.5px; color: var(--muted); }
.stat-card .s-value {
  margin: 4px 0 2px;
  font-size: 26px; font-weight: 700; line-height: 1.25;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-card .s-value.primary { color: var(--primary); }
.stat-card .s-sub { font-size: 12px; color: var(--muted-weak); }

/* ============================ 05 页签 ============================ */
/* 分段式（列表页状态筛选：全部 20 · 待跟进 7 · 已成交 3） */
.pill-tabs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.pill-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border: none; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 13px; white-space: nowrap; cursor: pointer;
  transition: background .15s, color .15s;
}
.pill-tab:hover { background: var(--panel-alt); }
.pill-tab.active { background: var(--primary); color: #fff; font-weight: 600; }
.pill-tab .cnt {
  min-width: 20px; padding: 0 6px;
  border-radius: 10px;
  background: #eef1f6; color: var(--muted);
  font-size: 11.5px; font-weight: 600; line-height: 18px; text-align: center;
}
.pill-tab.active .cnt { background: rgba(255, 255, 255, .22); color: #fff; }

/* 下划线式（详情页页签） */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 15px;
  border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px; white-space: nowrap; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-badge {
  min-width: 18px; padding: 1px 6px;
  border-radius: 9px;
  background: var(--panel-alt); color: var(--muted);
  font-size: 11.5px; font-weight: 500; line-height: 16px; text-align: center;
}
.tab.active .tab-badge { background: var(--primary-soft); color: var(--primary); }

/* ============================ 06 筛选条与工具条 ============================ */
.filter-bar {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 14px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.f-item { display: flex; flex-direction: column; gap: 4px; }
.f-item > label { font-size: 12px; color: var(--muted); }
.f-item input, .f-item select {
  height: 34px; min-width: 150px; padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.f-item select { min-width: 130px; padding-right: 26px; }
.f-item input:focus, .f-item select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.filter-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  margin-bottom: 12px;
}
.toolbar .spacer { flex: 1; }
.toolbar input[type="search"] {
  height: 34px; width: 240px; padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.toolbar input[type="search"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

/* ============================ 07 表格 ============================ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }

.table-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }

table.grid th {
  height: 42px; padding: 10px 12px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px; font-weight: 600; text-align: left;
  position: sticky; top: 0; z-index: 1;
}
table.grid td {
  height: 46px; padding: 10px 12px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}
table.grid tbody tr:hover { background: #f9fbff; }
table.grid tbody tr:last-child td { border-bottom: none; }

/* 可排序表头：默认淡箭头，悬停变主色 */
th.sortable { cursor: pointer; user-select: none; }
th.sortable .arrow { display: inline-flex; flex-direction: column; margin-left: 5px; vertical-align: -1px; opacity: .38; }
th.sortable .arrow i { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }
th.sortable .arrow i:first-child { border-bottom: 6px solid currentColor; margin-bottom: 2px; }
th.sortable .arrow i:last-child { border-top: 6px solid currentColor; }
th.sortable:hover { color: var(--primary); }
th.sortable:hover .arrow { opacity: .8; }
th.sortable.asc .arrow, th.sortable.desc .arrow { opacity: 1; color: var(--primary); }
th.sortable.asc .arrow i:first-child, th.sortable.desc .arrow i:last-child { opacity: .25; }

/* 勾选列 */
.col-check { width: 40px; text-align: center; padding-left: 10px !important; padding-right: 4px !important; }
.col-check input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }
tr.row-checked td { background: var(--primary-soft); }
tr.row-checked td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* 单元格语义 */
.cell-name { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.link { color: var(--link); cursor: pointer; }
.link:hover { color: var(--primary); text-decoration: underline; }
.ops { display: flex; gap: 8px; }
.muted { color: var(--muted); }

/* ============================ 08 分页 / 空态 / 批量条 ============================ */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel-alt);
  font-size: 13px; color: var(--muted);
}
.pager .pages { display: flex; align-items: center; gap: 6px; }
.pager .pg {
  min-width: 30px; height: 30px; padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  font-size: 13px; cursor: pointer;
  transition: border-color .13s, color .13s, background .13s;
}
.pager .pg:hover:not(:disabled):not(.active) { border-color: var(--primary); color: var(--primary); }
.pager .pg.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; cursor: default; }
.pager .pg:disabled { opacity: .45; cursor: not-allowed; }
.pager select {
  height: 30px; margin: 0 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; outline: none;
}

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .icon { display: block; margin-bottom: 10px; font-size: 34px; opacity: .35; }
.empty .empty-sub { margin-top: 4px; font-size: 12.5px; color: var(--muted-weak); }

/* 批量操作条：贴在列表底部，选中后才出现 */
.batch-bar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(12px);
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: #1f2937; color: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(2, 8, 22, .55);
  font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 40;
}
.batch-bar.on { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.batch-bar b { color: #7ea6e8; font-weight: 600; }
.batch-bar .b-actions { display: flex; gap: 8px; }
.batch-bar .btn { background: rgba(255, 255, 255, .18); border-color: transparent; color: #fff; }
.batch-bar .btn:hover { background: rgba(255, 255, 255, .3); border-color: transparent; color: #fff; }
.batch-bar .btn-close {
  border: none; background: transparent; color: rgba(255, 255, 255, .55);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.batch-bar .btn-close:hover { color: #fff; }

/* ============================ 09 详情 ============================ */
.detail-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.detail-head .d-title { margin: 0; font-size: 17px; font-weight: 600; }
.detail-head .d-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.detail-head .d-actions { margin-left: auto; display: flex; gap: 8px; }

.detail-section { margin-bottom: 20px; }
.detail-section > h4 {
  margin: 0 0 10px;
  padding-left: 9px;
  border-left: 3px solid var(--primary);
  font-size: 13.5px; font-weight: 600; color: var(--primary);
}
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; }
.detail-grid .item { padding-bottom: 8px; border-bottom: 1px dashed #eef1f5; }
.detail-grid .item.full { grid-column: 1 / -1; }
.detail-grid .item .k { font-size: 12px; color: var(--muted); }
.detail-grid .item .v { font-size: 13.5px; color: var(--text); word-break: break-all; }
.detail-grid .item .v.none { color: var(--muted-weak); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  margin-left: 5px; padding: 0 0 16px 20px;
  border-left: 2px solid var(--border);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute; left: -7px; top: 5px;
  width: 12px; height: 12px;
  border: 2px solid var(--border-strong); border-radius: 50%;
  background: #fff;
}
.timeline li.ok::before { border-color: var(--ok); }
.timeline li.bad::before { border-color: var(--bad); }
.timeline li.info::before { border-color: var(--primary); }
.timeline .t-head { font-size: 13px; font-weight: 600; }
.timeline .t-meta { font-size: 12px; color: var(--muted); }
.timeline .t-body { margin-top: 6px; font-size: 12.5px; }

/* ============================ 10 表单 ============================ */
/* 左标签单列（与抽屉表单口径一致）：标签 108px + 控件铺满 */
.form-rows { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 108px minmax(0, 1fr); align-items: start; gap: 12px; }
.form-row > label {
  padding-top: 8px;
  font-size: 13px; color: var(--text-2); text-align: right;
}
.form-row > label .req { margin-left: 3px; color: var(--bad); }
.form-row .ctl input,
.form-row .ctl select,
.form-row .ctl textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-row .ctl input:focus,
.form-row .ctl select:focus,
.form-row .ctl textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.form-row .ctl input:disabled,
.form-row .ctl input[readonly] { background: var(--panel-alt); color: var(--muted); cursor: default; }
.form-row .ctl textarea { min-height: 80px; resize: vertical; }
.form-row .hint { margin-top: 4px; font-size: 12px; color: var(--muted-weak); }
.form-row .err { margin-top: 4px; font-size: 12px; color: var(--bad); }

/* 两列栅格（字段多、表单窄时用） */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.span2 { grid-column: span 2; }
.field > label { font-size: 12.5px; color: var(--muted); }
.field > label .req { margin-left: 3px; color: var(--bad); }
.field input, .field select, .field textarea {
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff; outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring);
}
.field textarea { min-height: 76px; resize: vertical; }

/* 表单分组：标题 + 一条淡线 */
.form-group { margin-bottom: 18px; }
.form-group > h5 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.form-group > h5::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ============================ 11 弹窗 / 抽屉 / 轻提示 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  font-size: 13px; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #116634; border-color: #116634; color: #fff; }
.btn-bad { background: #fff; border-color: var(--bad-border); color: var(--bad); }
.btn-bad:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn-warn { background: #fff; border-color: var(--warn-border); color: var(--warn); }
.btn-warn:hover { background: #fdf6ec; border-color: var(--warn); color: var(--warn); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-alt); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-icon { padding: 7px 9px; }

/* 弹窗 */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px 40px;
  background: rgba(16, 24, 40, .45);
  overflow-y: auto;
}
.dialog {
  width: 100%; max-width: 880px;
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  animation: pop .16s ease-out;
}
.dialog.small { max-width: 460px; }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.dialog-close { border: none; background: transparent; padding: 0 4px; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.dialog-close:hover { color: var(--text); }
.dialog-body { max-height: calc(100vh - 220px); padding: 20px; overflow-y: auto; }
.dialog-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel-alt);
  border-radius: 0 0 12px 12px;
}

/* 抽屉（右侧滑出，表单/详情都用它） */
.drawer-mask { position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .38); opacity: 0; transition: opacity .18s ease; }
.drawer-mask.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; z-index: 91;
  display: flex; flex-direction: column;
  width: var(--drawer-w, 720px); max-width: 96vw; height: 100vh;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform .22s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h3 { flex: 1; margin: 0; font-size: 15.5px; font-weight: 600; }
.drawer-x { border: none; background: transparent; padding: 2px 7px; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; border-radius: 7px; }
.drawer-x:hover { background: var(--panel-alt); color: var(--text); }
.drawer-body { flex: 1; min-height: 0; padding: 20px 22px 24px; overflow-y: auto; }
.drawer-foot {
  flex: none;
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel-alt);
}

/* 轻提示 */
#toast-root { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  max-width: 420px;
  padding: 11px 18px;
  border-radius: 9px;
  background: #1f2937; color: #fff;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .25);
  animation: slidein .18s ease-out;
}
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid transparent; border-radius: 20px;
  font-size: 12px; line-height: 18px;
}
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.tag-bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-border); }
.tag-blue { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }
.tag-gray { background: var(--gray-soft); color: var(--muted); border-color: var(--gray-border); }

/* ============================ 12 工具类 ============================ */
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.fs-12 { font-size: 12px; }
.text-muted { color: var(--muted); }
.text-bad { color: var(--bad); }
.text-ok { color: var(--ok); }
.nowrap { white-space: nowrap; }

/* ============================ 窄屏（≤ 960px） ============================ */
@media (max-width: 960px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 120;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(2, 8, 22, .4);
  }
  .app-view.side-open .sidebar { transform: none; }
  .side-open { display: flex; }
  .side-backdrop {
    position: fixed; inset: 0; z-index: 110;
    background: rgba(15, 23, 42, .42);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .app-view.side-open .side-backdrop { opacity: 1; pointer-events: auto; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .field.span2 { grid-column: span 1; }
  .top-tabs { display: none; }
  #main { padding: 14px 14px 32px; }
  .form-row { grid-template-columns: 92px minmax(0, 1fr); }
}

/* 列表空态（筛选无结果） */
.list-empty { padding: 34px 0; text-align: center; color: var(--muted-weak); font-size: 13px; }

/* 账号设置弹窗 */
.acct-box { font-size: 13.5px; }
.acct-row { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px solid #f2f4f7; }
.acct-row:last-of-type { border-bottom: none; }
.acct-row span { flex: none; width: 84px; color: var(--muted-weak); }
.acct-row b { font-weight: 600; }
.acct-tip { margin-top: 10px; font-size: 12px; color: var(--muted-weak); line-height: 1.6; }

/* 用户管理：可看系统的勾选块 */
.perm-box { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 6px 0 2px; }
.perm-item { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.perm-item input { width: 14px; height: 14px; accent-color: var(--primary); }
