/* ============================================================================
   数脉统一后台 · 设计系统（双主题）
   参考 new-api 控制台的信息密度与克制用色：浅底白卡、圆角一档到底、
   主色只落在交互元素上；正文 13.5px，表格 12.5px，说明文字 12px。
   约定：页面只用这里的类名与变量，不写死颜色。
   ========================================================================== */

:root {
  --bg: #f5f6f9;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #fbfcfe;
  --panel-3: #f1f3f7;
  --border: #e8ebf1;
  --border-strong: #d8dde7;

  --text: #101828;
  --text-2: #475467;
  --muted: #8a93a6;

  --brand: #3b82f6;
  --brand-600: #2563eb;
  --brand-ink: #2563eb;
  --brand-soft: rgba(59, 130, 246, .09);
  --brand-ring: rgba(59, 130, 246, .16);

  --ok: #079455;
  --ok-bg: #ecfdf3;
  --warn: #d97706;
  --warn-bg: #fffaeb;
  --danger: #d92d20;
  --danger-bg: #fef3f2;
  --info: #2e6bdb;
  --info-bg: #eff6ff;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --radius-xs: 4px;   /* 微型元素（图表柱、进度条）专用，避免大令牌在窄条上被钳制 */
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 16px 40px rgba(16, 24, 40, .14);
  --side-w: 204px;
  --head-h: 58px;
  /* 表单类内容的最大行宽（卡片本身不限宽，页面随屏铺开） */
  --form-max: 1080px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  /* 语义令牌（2026-10-21 美化增量）：新组件一律用令牌，既有数值不动 */
  --elev-1: 0 1px 2px rgba(16, 24, 40, .05);
  --elev-2: 0 6px 18px rgba(16, 24, 40, .09);
  --elev-3: 0 16px 40px rgba(16, 24, 40, .14);
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --z-modal: 100; --z-dropdown: 150; --z-toast: 200; --z-routebar: 300;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
/* 预留滚动条槽位：弹窗锁滚动（overflow:hidden）时页面不会因为滚动条消失而横向跳动 */
html { scrollbar-gutter: stable; }

/* 滚动条：细、无箭头、跟随主题（Windows 默认滚动条在浅色页面上很突兀） */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-sm);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }
::selection { background: var(--brand-soft); color: var(--text); }
/* 键盘焦点可见、鼠标点击不出现描边 */
:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 1px; }

/* 路由切换进度条：页面内容加载期间顶部一条细进度，避免"点了没反应"的错觉 */
#route-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  z-index: 300;
  opacity: 0;
  background: linear-gradient(90deg, #60a5fa 0%, #2563eb 100%);
  transition: width .35s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
  pointer-events: none;
}
#route-bar.on { width: 68%; opacity: 1; }
#route-bar.done { width: 100%; opacity: 0; transition: width .2s ease, opacity .25s ease .12s; }

body {
  background: var(--bg);
  color: var(--text);
  font: 400 13.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.65; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }

/* ---------------------------------------------------------------- 深色主题覆盖（默认浅色） */

html[data-theme="dark"] {
  --bg: #0f1115;
  --bg-2: #12151b;
  --panel: #161a21;
  --panel-2: #1a1f27;
  --panel-3: #20262f;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .13);

  --text: #e8ebf1;
  --text-2: #a7b0c0;
  --muted: #6c7688;

  --brand: #4b8df8;
  --brand-600: #3b7ff0;
  --brand-ink: #7cb0fb;
  --brand-soft: rgba(75, 141, 248, .13);
  --brand-ring: rgba(75, 141, 248, .2);

  --ok: #3ddc97;
  --ok-bg: rgba(61, 220, 151, .1);
  --warn: #f5b544;
  --warn-bg: rgba(245, 181, 68, .1);
  --danger: #f97066;
  --danger-bg: rgba(249, 112, 102, .1);
  --info: #6ba6ff;
  --info-bg: rgba(107, 166, 255, .1);

  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, .5);

  /* 深色下投影几乎不可见：层级改用「亮边 + 微光」表达 */
  --elev-1: 0 0 0 1px rgba(255, 255, 255, .04), 0 1px 2px rgba(0, 0, 0, .5);
  --elev-2: 0 0 0 1px rgba(255, 255, 255, .05), 0 8px 22px rgba(0, 0, 0, .55);
  --elev-3: 0 0 0 1px rgba(255, 255, 255, .06), 0 18px 44px rgba(0, 0, 0, .6);
}
html[data-theme="dark"] .badge.gray { color: #9aa3b5; background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] thead th { background: rgba(255, 255, 255, .02); }
html[data-theme="dark"] .nav a:hover { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .icon-chip { background: rgba(255, 255, 255, .05); }
html[data-theme="dark"] .auth-page {
  background:
    radial-gradient(760px 420px at 14% -8%, rgba(59, 130, 246, .12) 0%, rgba(59, 130, 246, 0) 62%),
    radial-gradient(680px 400px at 92% 108%, rgba(37, 99, 235, .10) 0%, rgba(37, 99, 235, 0) 64%),
    var(--bg);
}

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

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  height: 56px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.brand-logo {
  width: 28px; height: 28px;
  flex: 0 0 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .28);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 13.5px; font-weight: 600; letter-spacing: .1px; color: var(--text); }
.brand-text small { font-size: 10.5px; color: var(--muted); line-height: 1.35; white-space: nowrap; }

.nav { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav::before {
  content: "控制台";
  padding: 10px 10px 6px;
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--muted);
  opacity: .8;
}
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1;
  transition: background .14s ease, color .14s ease;
}
.nav a:hover { background: rgba(16, 24, 40, .05); color: var(--text); }
.nav a.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 18%, transparent);
}
.nav a .ico {
  width: 17px; height: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 17px;
  opacity: .82;
}
.nav a .ico svg { width: 17px; height: 17px; display: block; }
.nav a.active .ico { opacity: 1; }
.nav a .nbadge {
  margin-left: auto;
  min-width: 18px; height: 17px;
  padding: 0 5px;
  border-radius: var(--radius-sm);
  background: var(--brand-600);
  color: #fff;
  font-size: 10px;
  line-height: 17px;
  text-align: center;
  font-weight: 600;
}
.nav a .nbadge:empty { display: none; }

.sidebar-foot {
  padding: 12px 12px 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
}
.user-card { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.user-card .avatar {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-card .user-meta { flex: 1; min-width: 0; }
.user-card #who {
  color: var(--text);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card .user-role { font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.user-card a {
  color: var(--muted);
  font-size: 13px;
  padding: 5px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.user-card a:hover { color: var(--danger); background: var(--danger-bg); }
.sidebar-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-actions .version { font-size: 10.5px; color: var(--muted); font-family: ui-monospace, monospace; }

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

.page-head {
  min-height: var(--head-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-head h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: .1px; line-height: 1.4; }
.page-head .sub { color: var(--muted); font-size: 12px; margin-top: 1px; line-height: 1.4; }
#page-actions { display: flex; gap: 8px; align-items: center; }

/* 内容区全宽流式：数据表/网格需要横向空间；表单行宽由栅格自身约束 */
#view { padding: 18px 24px 44px; width: 100%; }

/* 路由切换时的内容淡入（只作用于页面根容器，页签局部重绘不会触发） */
#view > div { animation: view-in .2s ease both; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* 尊重系统「减弱动态效果」：路由淡入/骨架呼吸/弹窗弹出/toast 滑入全部关停，
   前庭敏感用户不再被持续动画干扰；布局与颜色不受影响。 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  #route-bar { transition: none; }
}

/* ---------------------------------------------------------------- 卡片 / 栅格 */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card + .card { margin-top: 14px; }
.grid > .card + .card { margin-top: 0; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-title { font-size: 13.5px; font-weight: 600; color: var(--text); letter-spacing: .1px; }
.section-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-auto { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (max-width: 1180px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

/* 指标卡：无左侧竖条；hover 轻微上浮 + 边框提亮，信息层级是「标签 → 数字 → 说明」 */
.stat {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 13px;
  overflow: hidden;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-hover, var(--shadow)); }
.stat .label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.stat .kpi {
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -.6px;
  line-height: 1.2;
  margin-top: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat .sub { color: var(--muted); font-size: 11.5px; margin-top: 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; }
.stat .stat-foot { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.stat .stat-foot::before { content: ""; flex: 1; height: 1px; background: var(--border); }
.stat.ok::before, .stat.warn::before, .stat.danger::before { content: none; }

/* 指标卡左侧图标 chip（可选） */
.icon-chip {
  width: 26px; height: 26px;
  flex: 0 0 26px;
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-chip svg { width: 15px; height: 15px; }
.icon-chip.brand { background: var(--brand-soft); color: var(--brand-ink); }
.icon-chip.ok { background: var(--ok-bg); color: var(--ok); }
.icon-chip.warn { background: var(--warn-bg); color: var(--warn); }
.icon-chip.danger { background: var(--danger-bg); color: var(--danger); }

/* 指标卡顶部行：标签 + 图标 chip 同行 */
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-top .label { margin: 0; }

.kpi { font-size: 20px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel-2);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 11.5px;
  letter-spacing: .02em;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--panel-2); }
tbody td:first-child { color: var(--text); }
.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.empty, .empty-state { padding: 34px 14px; text-align: center; color: var(--muted); font-size: 12.5px; }
/* 空态图标：一个淡色"收纳盒"，比纯文字更明确"这里本来该有内容" */
.empty::before {
  content: "";
  display: block;
  width: 34px;
  height: 34px;
  margin: 0 auto 8px;
  opacity: .55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 12px;
  color: var(--muted);
  font-size: 11.5px;
  flex-wrap: wrap;
}
.pager select, .pager input { width: auto; height: 26px; font-size: 11.5px; padding: 0 8px; }
.pager input.pager-jump { width: 64px; text-align: center; }
.pager button { height: 26px; font-size: 11.5px; padding: 0 9px; }

/* 加载骨架（请求期间的占位，避免表格区空白跳动） */
.skel-table { display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; }
.skel-row { display: grid; grid-auto-flow: column; gap: 14px; }
.skel-bar {
  display: block;
  height: 11px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--panel-3) 25%, var(--border) 37%, var(--panel-3) 63%);
  background-size: 400% 100%;
  animation: skel 1.3s ease infinite;
}
@keyframes skel {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------------------------------------------------------------- 徽标 / 按钮 / 表单 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;   /* 徽标胶囊化：与小圆点呼应，比直角块更柔和 */
  font-size: 11.5px;
  line-height: 19px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.no-dot::before { display: none; }
.badge.gray { color: var(--text-2); background: var(--panel-3); border-color: var(--border); }
.badge.green { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.badge.red { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.badge.orange { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.badge.blue { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.badge.brand { color: var(--brand-ink); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 20%, transparent); }

button {
  font-family: inherit;
  font-size: 12.5px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover { background: var(--panel-3); color: var(--text); border-color: var(--border-strong); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 500; }
button.primary:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, .26);
}
button.ghost { background: transparent; border-color: transparent; color: var(--brand-ink); padding: 0 8px; }
button.ghost:hover { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 28%, transparent); background: transparent; }
button.danger:hover { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
button.sm { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: var(--radius-sm); }

input, select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  height: 34px;
  padding: 0 10px;
  outline: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 64px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
select { padding-right: 26px; }
/* 勾选框/单选框不吃输入框的宽高规则（否则会被拉成竖条） */
input[type="checkbox"], input[type="radio"] {
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--brand-600);
  vertical-align: -1px;
}
label { display: block; font-size: 12px; color: var(--text-2); margin: 12px 0 5px; font-weight: 500; }
/* 必填星号 */
.req { color: var(--danger); margin-left: 2px; }
/* 表单行内校验：字段本身红框 + 下方错误文案（比只弹 toast 更容易定位） */
input.invalid, select.invalid, textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}
.field-error { color: var(--danger); font-size: 11.5px; margin-top: 4px; line-height: 1.5; }
/* 长串允许任意断行（Key 明文 / UUID） */
.break { word-break: break-all; }
/* 表格里的通用省略号 */
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 工具栏里可伸展的搜索框 */
.toolbar .grow { flex: 1 1 220px; max-width: 320px; }
/* 单行截断（表格里的长结果/错误摘要） */
.clip-1 { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 构成条：一行里用色块比例表达"可用/风控/失效"（总览平台概况） */
.stack-bar {
  display: inline-flex;
  width: 132px;
  height: 6px;
  border-radius: 999px;   /* 与高度相等即胶囊，语义显式 */
  overflow: hidden;
  background: var(--panel-3);
  vertical-align: middle;
}
.stack-bar i { display: block; height: 100%; min-width: 2px; }
/* 卡片内的紧凑空态（不占整块留白） */
.empty.compact { padding: 18px 12px; }

.form { display: block; max-width: var(--form-max); }
.form .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 136px; }
.toolbar .spacer { flex: 1; }

.row-actions { display: flex; gap: 2px; align-items: center; }

.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--panel-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.segmented button {
  border: none;
  background: transparent;
  height: 28px;
  padding: 0 11px;
  font-size: 12px;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  box-shadow: none;
}
.segmented button:hover { background: transparent; color: var(--text); }
.segmented button.active { background: var(--panel); color: var(--brand-ink); font-weight: 600; box-shadow: var(--shadow); }

/* 设置页字段栅格：随卡片宽度自动分列；数值短字段用 .compact 收窄 */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 14px; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-grid input.compact, input.compact, select.compact { max-width: 140px; }

.kv { display: grid; grid-template-columns: 118px 1fr; gap: 8px 12px; font-size: 12.5px; margin: 0; }
/* 全宽卡片里的 kv 走两列，避免右侧大片空白 */
.kv.two-col { grid-template-columns: 118px 1fr 118px 1fr; gap: 8px 16px; }
@media (max-width: 900px) { .kv.two-col { grid-template-columns: 118px 1fr; } }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text-2); word-break: break-all; }

/* ---------------------------------------------------------------- 弹窗 */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(9, 12, 18, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade .12s ease;
  backdrop-filter: blur(2px);
}
.modal {
  position: relative;   /* 承载右上角 × 关闭按钮 */
  width: 480px;
  max-width: 100%;
  max-height: 86vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 20px 22px 16px;
  animation: pop .16s ease;
}
/* 标题头线：负边距拉通整宽，弹窗结构一眼可辨 */
.modal h3 {
  margin: -20px -22px 12px;
  padding: 15px 42px 11px 22px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
/* 右上角 × 关闭：与 Esc/点遮罩同语义，给鼠标用户一个明确出口 */
.modal-x {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  border-radius: var(--radius-sm);
  z-index: 1;
}
.modal-x:hover { background: var(--panel-3); color: var(--text); }
.modal-body { color: var(--text-2); font-size: 12.5px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 轻提示 */

.toast-wrap { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: var(--z-toast); }
/* 轻提示：类型图标 + 底部消退进度条（--toast-ttl 与 JS 定时同长） */
.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 190px;
  max-width: 360px;
  padding: 10px 14px 13px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ok);
  box-shadow: var(--elev-3);
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  animation: toast-in .18s ease;
}
.toast .t-ico { flex: 0 0 15px; width: 15px; height: 15px; margin-top: 1px; color: var(--ok); }
.toast .t-ico svg { width: 15px; height: 15px; display: block; }
.toast .t-msg { flex: 1; min-width: 0; line-height: 1.5; }
.toast.err { border-left-color: var(--danger); }
.toast.err .t-ico { color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.warn .t-ico { color: var(--warn); }
.toast.info { border-left-color: var(--info); }
.toast.info .t-ico { color: var(--info); }
.toast .toast-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--ok);
  opacity: .5;
  transform-origin: left center;
  animation: toast-life var(--toast-ttl, 3200ms) linear forwards;
}
.toast.err .toast-bar { background: var(--danger); }
.toast.warn .toast-bar { background: var(--warn); }
.toast.info .toast-bar { background: var(--info); }
@keyframes toast-life { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

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

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background:
    radial-gradient(760px 420px at 14% -8%, rgba(59, 130, 246, .08) 0%, rgba(59, 130, 246, 0) 62%),
    radial-gradient(680px 400px at 92% 108%, rgba(37, 99, 235, .08) 0%, rgba(37, 99, 235, 0) 64%),
    var(--bg);
}
.auth-card {
  width: 360px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(16, 24, 40, .08);
  padding: 26px 26px 20px;
}

/* 登录页分栏（借鉴 auth_pro LoginLeftView）：宽屏左品牌右表单，窄屏回退单卡 */
.auth-aside { display: none; }
@media (min-width: 861px) {
  .auth-split {
    display: flex;
    width: 900px;
    max-width: 100%;
    min-height: 520px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(16, 24, 40, .08);
    overflow: hidden;
  }
  .auth-split .auth-card {
    width: 420px;
    flex: 0 0 420px;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .auth-aside {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 34px 34px 24px;
    color: #fff;
    background:
      radial-gradient(420px 260px at 88% -10%, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, 0) 60%),
      linear-gradient(150deg, #3b82f6 0%, #2563eb 52%, #1d4ed8 100%);
  }
  .aside-brand { display: flex; align-items: center; gap: 9px; }
  .aside-logo {
    width: 30px; height: 30px; border-radius: 8px;
    background: rgba(255, 255, 255, .18);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
  }
  .aside-name { font-size: 13.5px; font-weight: 600; letter-spacing: .3px; }
  .aside-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
  .aside-body h1 { margin: 0 0 10px; font-size: 25px; line-height: 1.35; font-weight: 700; letter-spacing: .5px; }
  .aside-lead { margin: 0 0 20px; font-size: 12.5px; color: rgba(255, 255, 255, .82); }
  .aside-points { margin: 0; padding: 0; list-style: none; }
  .aside-points li {
    position: relative;
    padding-left: 16px;
    margin-bottom: 9px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, .92);
  }
  .aside-points li::before {
    content: "";
    position: absolute;
    left: 0; top: 7px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
  }
  .aside-foot { font-size: 11px; color: rgba(255, 255, 255, .6); }
}
html[data-theme="dark"] .auth-aside {
  background:
    radial-gradient(420px 260px at 88% -10%, rgba(96, 165, 250, .22) 0%, rgba(96, 165, 250, 0) 60%),
    linear-gradient(150deg, #1e3a8a 0%, #172554 60%, #0f172a 100%);
}
.auth-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.auth-logo {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
}
.auth-brand .name { font-size: 13.5px; font-weight: 600; }
.auth-brand .desc { font-size: 11px; color: var(--muted); }
.auth-card h2 { margin: 4px 0 4px; font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.auth-card .lead { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.auth-card .field { margin-bottom: 12px; }
.auth-card label { margin-top: 0; }
.auth-card .meta {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 0 16px; font-size: 11.5px; color: var(--muted);
}
.auth-card .meta label { margin: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.auth-card .meta input[type="checkbox"] { width: auto; accent-color: var(--brand-600); }
.auth-card button.primary { width: 100%; height: 36px; font-size: 13px; }
/* 登录验证码行：输入框与图片并排，图片固定 118×36 可点击刷新 */
.captcha-row { display: flex; gap: 8px; align-items: stretch; }
.captcha-row input { flex: 1; min-width: 0; }
#captcha-img {
  flex: 0 0 118px;
  height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;   /* SVG 字符为彩色描边，白底保证深浅主题都可读 */
  cursor: pointer;
  overflow: hidden;
  transition: border-color .14s ease;
}
#captcha-img:hover { border-color: var(--brand); }
#captcha-img svg { width: 118px; height: 36px; display: block; }
.auth-msg { min-height: 16px; margin: 8px 0 0; font-size: 11.5px; color: var(--danger); }
.auth-foot {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center; font-size: 11px; color: var(--muted); line-height: 1.7;
}

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

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .brand { height: 48px; border-bottom: none; }
  .nav { flex-direction: row; gap: 6px; padding: 0 12px 10px; overflow-x: auto; }
  .nav::before { display: none; }
  .nav a { height: 32px; padding: 0 10px; white-space: nowrap; }
  .sidebar-foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px 10px; border-top: none;
  }
  .sidebar-foot .user-card { margin-bottom: 0; }
  #view { padding: 14px; }
  .page-head { padding: 0 14px; }
  .form .row { grid-template-columns: 1fr; }
}

/* 兼容旧类名 */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ---------------------------------------------------------------- 主题切换 */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-2); }

/* ---------------------------------------------------------------- 平台卡（CK 页） */

.pcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: 0;
}
.pcard { transition: border-color .16s ease, box-shadow .16s ease; }
.pcard:hover { border-color: var(--border-strong); }
.pcard.off { opacity: .55; }
.pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard-name { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.pcard-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.pcard-dot.bili { background: #60a5fa; }
.pcard-dot.jd { background: #f97066; }
.pcard-dot.baijia { background: #f5b544; }
.pcard-main { display: flex; align-items: baseline; gap: 6px; }
.pcard-main .num { font-size: 26px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.5px; }
.pcard-main .unit { font-size: 11.5px; color: var(--muted); }
.pcard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pcard-cell { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 9px; min-width: 0; }
.pcard-cell .k { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.pcard-cell .v { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.pcard-cell.bad .v { color: var(--danger); }
.pcard-cell.warn .v { color: var(--warn); }
.pcard-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 2px; }
.pcard-foot .meta { font-size: 10.5px; color: var(--muted); }

/* 批量操作条：第二行，只在有选中时显示内容 */
.bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  font-size: 12px;
  color: var(--text-2);
}
.bulkbar .spacer { flex: 1; }

/* ---------------------------------------------------------------- 待办列表 */

.todo-list { display: flex; flex-direction: column; }
.todo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.todo-row:last-child { border-bottom: none; }
.todo-text { flex: 1; min-width: 0; color: var(--text-2); }

/* ---------------------------------------------------------------- 用户分析（总览指标 / 趋势 / 维度） */

/* 指标卡涨跌幅：涨红跌绿（中国习惯，增长为好事）；持平/无基期用 muted */
.delta { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--danger); }
.delta.down { color: var(--ok); }
.delta.flat { color: var(--muted); font-weight: 400; }
.delta.warn { color: var(--warn); }

/* 长文本块（参数 / 结果 / Cookie），等宽、最大高度内滚动 */
.pre-block {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
}
.pre-block.tall { max-height: 320px; }

/* 表单底部操作区：右对齐，与卡片留白一致 */
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.stat .sub .delta { margin-right: 8px; }
.stat .sub .delta:last-child { margin-right: 0; }

/* 趋势图卡：宽度随容器出图、高度固定（JS 按 clientWidth 生成 viewBox，1:1 不变形） */
.trend-wrap { padding: 6px 2px 0; }
.trend-wrap svg { display: block; width: 100%; height: 240px; }
.trend-legend { display: flex; align-items: center; gap: 16px; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.trend-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.trend-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.trend-axis { font-size: 10px; fill: var(--muted); }
.trend-grid-line { stroke: var(--border); stroke-width: 1; }
.trend-empty { padding: 34px 0; text-align: center; color: var(--muted); font-size: 12px; }

/* 维度分布横条（渠道/地域） */
.dim-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
@media (max-width: 900px) { .dim-grid { grid-template-columns: 1fr; } }
.dim-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.dim-row {
  display: grid;
  grid-template-columns: 92px 1fr 86px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 12px;
}
.dim-row .name { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dim-row .bar { height: 8px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.dim-row .bar > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); min-width: 2px; }
.dim-row .num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dim-row.clickable { cursor: pointer; border-radius: var(--radius-sm); }
.dim-row.clickable:hover { background: var(--panel-2); }
.dim-row.clickable:hover .name { color: var(--brand-ink); }
/* 宽屏下横条不随容器无限拉伸：整行限宽 + 可切换 4 列窄版（.wide） */
.dim-row { max-width: 620px; }
.dim-row.wide { grid-template-columns: 96px 1fr 110px; }
.dim-row.wide .num { color: var(--text-2); }
@media (max-width: 900px) { .dim-row { max-width: none; } }

/* ---------------------------------------------------------------- 自适应指标行 / 执行者卡片 / 设置分栏 */

/* 执行者（Worker）卡片（任务中心总览） */
.wcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.wcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  min-width: 0;
  transition: border-color .14s ease;
}
.wcard:hover { border-color: var(--border-strong); }
.wcard.clickable { cursor: pointer; }
.wcard.clickable:hover { border-color: var(--brand); }
.wcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wcard-name {
  font-size: 12px; color: var(--text); min-width: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 设置页：宽屏左右分栏，窄屏回落单列；栏内卡片间距由 flex gap 统一管 */
.settings-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.settings-cols .col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.settings-cols .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .settings-cols { grid-template-columns: 1fr; } }

/* ============================================================================
   UI 美化增量（2026-10-21）：按钮加载态 / 吸顶表头 / 数字等宽 / 空态三级 /
   总览骨架 / 登录抖动 / 任务心跳 / 打印样式。只新增类名，不改既有数值。
   ========================================================================== */

/* ---- 按钮加载态：纯 CSS 转圈，JS 侧切 .loading 类即可（btnLoading/modal/attempt 已接入） ---- */
button.loading { opacity: .85; cursor: progress; pointer-events: none; }
button.loading::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  opacity: .85;
  animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---- 长列表吸顶表头：opt-in（.table-wrap.sticky），纵向滚动时表头常驻 ---- */
.table-wrap.sticky { max-height: calc(100vh - 238px); overflow: auto; }
.table-wrap.sticky thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);           /* 不透明，盖住下方滚动的行 */
  box-shadow: 0 1px 0 var(--border);
}
html[data-theme="dark"] .table-wrap.sticky thead th { background: var(--panel-2); }

/* ---- 数字列等宽 + 右对齐：列定义加 num: true（table() 挂 .num），或渲染后手动加 ---- */
th.num, td.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---- 空态三级：图标（.empty::before 已有）→ 标题 → 副文案/引导按钮 ---- */
.empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  max-width: 460px;
  margin: 0 auto;
}
.empty-box .empty-title,
.empty-box > div > div:first-child { font-weight: 600; font-size: 13px; color: var(--text-2); }
.empty-box .hint { margin: 0; text-align: center; }
.empty-box button, .empty-box .empty-action { margin-top: 8px; }

/* ---- 总览骨架卡：数据返回前的结构占位，避免首屏"白一秒" ---- */
.skel-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1180px) { .skel-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.skel-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 13px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.skel-chart {
  height: 240px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--panel-3) 25%, var(--border) 37%, var(--panel-3) 63%);
  background-size: 400% 100%;
  animation: skel 1.3s ease infinite;
}

/* ---- 登录失败抖动：错误反馈不只靠一行红字 ---- */
.auth-card.shake { animation: auth-shake .45s ease; }
@keyframes auth-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

/* ---- 运行中徽标的呼吸点（任务中心）：活着的任务一眼可辨 ---- */
.badge.pulse::before { animation: badge-pulse 1.6s ease infinite; }
@keyframes badge-pulse {
  0%, 100% { opacity: .9; }
  50% { opacity: .3; }
}

/* ---- 认证页细节增强（2026-10-21：登录/注册/找回） ---- */
/* 密码可见性切换 */
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 38px; }
.pass-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; padding: 0; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.pass-toggle:hover { color: var(--text-2); background: var(--hover-bg, rgba(127,127,127,.08)); }
.pass-toggle:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 1px; }
.pass-toggle svg { width: 16px; height: 16px; }

/* 输入错误红边（与 .field-error 文案配套） */
.auth-card input[aria-invalid="true"] { border-color: var(--danger); }
.auth-card input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }

/* 消息区：成功态（默认红字为错误态） */
.auth-msg.ok { color: var(--ok); }

/* 密码规则清单：满足项变绿 */
.pass-rules { list-style: none; margin: 6px 0 0; padding: 0; font-size: 11px; color: var(--muted); line-height: 1.7; }
.pass-rules li { display: flex; align-items: center; gap: 6px; transition: color .15s ease; }
.pass-rules li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; flex: 0 0 auto; }
.pass-rules li.ok { color: var(--ok); }
.pass-rules li.ok::before { opacity: 1; }

/* 用户公约勾选与内嵌展开块 */
.agree-row { display: flex; align-items: flex-start; gap: 7px; font-size: 11.5px; color: var(--text-2); margin: 2px 0 10px; line-height: 1.6; }
.agree-row input[type="checkbox"] { width: auto; margin-top: 2px; accent-color: var(--brand-600); flex: 0 0 auto; }
.agree-row a { cursor: pointer; }
.agree-panel {
  display: none; margin: -2px 0 10px; padding: 8px 10px; max-height: 132px; overflow: auto;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-2);
  font-size: 11px; color: var(--text-2); white-space: pre-wrap; line-height: 1.7;
}
.agree-panel.open { display: block; }

/* 认证页右下主题切换浮钮 */
.theme-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 30;
  width: 34px; height: 34px; border-radius: 50%; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--muted); cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.theme-fab:hover { color: var(--brand-600); border-color: var(--brand-600); }
.theme-fab:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }
.theme-fab svg { width: 16px; height: 16px; }

/* 认证页版权/版本行 */
.auth-copy { margin-top: 12px; text-align: center; font-size: 10.5px; color: var(--muted); }

/* 倒计时中的主按钮（锁定等待）保持禁用观感统一 */
.auth-card button.primary[disabled] { opacity: .62; cursor: not-allowed; }


/* ---- 打印：只留内容，隐藏 chrome 与交互控件；卡片避免跨页截断 ---- */
@media print {
  .sidebar, .page-head, #route-bar, .toast-wrap, .bulkbar, .pager,
  .row-actions, .theme-toggle, .modal-mask { display: none !important; }
  body { background: #fff; }
  .card, .table-wrap, .stat { box-shadow: none; border-color: #d0d5dd; break-inside: avoid; }
  #view { padding: 0; }
  .table-wrap.sticky { max-height: none; overflow: visible; }
}

/* ---- 角色前端降级（UI-2）：viewer 隐藏写入口，ops/viewer 隐藏全权管理员入口 ----
   按钮需打 .needs-write / .needs-admin 标；后端 _role_gate 仍是最终闸门。 */
body[data-role="viewer"] .needs-write { display: none !important; }
body[data-role="viewer"] .needs-admin { display: none !important; }
body[data-role="ops"] .needs-admin { display: none !important; }

/* 设置页未保存指示（UI-4）：有改动时保存按钮描边强调 */
#page-actions button.primary.dirty { box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 55%, transparent); }
