/* 后台通用样式（无第三方依赖）· 商用化 2.0
 * 全部沿用既有 class 名，仅增强观感与新增组件。 */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--td-font-family);
  font-size: 14px;
  line-height: 1.6;
  color: var(--td-text-color-primary);
  background: var(--td-bg-color-page);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--td-size-sidebar);
  background: var(--td-bg-color-container);
  border-right: 1px solid var(--td-border-level-1-color);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  box-shadow: 2px 0 12px rgba(31, 35, 41, .04);
  z-index: 30;
}
.logo {
  height: var(--td-size-header); flex: 0 0 var(--td-size-header);
  display: flex; align-items: center; gap: 10px; padding: 0 18px;
  font-weight: 700; font-size: 15px; letter-spacing: .3px;
  border-bottom: 1px solid var(--td-border-level-1-color);
}
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--td-brand-gradient);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; box-shadow: 0 4px 10px rgba(43, 92, 255, .35);
}
.menu { padding: 10px 10px 24px; overflow-y: auto; flex: 1; }
.menu-group-title { padding: 14px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .6px; color: var(--td-text-color-placeholder); text-transform: uppercase; }
.menu a {
  display: flex; align-items: center; gap: 10px;
  position: relative; padding: 10px 12px; border-radius: var(--td-radius-small);
  color: var(--td-text-color-secondary); margin-bottom: 2px; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.menu a::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; border-radius: 0 3px 3px 0; background: var(--td-brand-color); transition: height .15s;
}
.menu a:hover { background: var(--td-bg-color-container-hover); color: var(--td-text-color-primary); }
.menu a.active { background: var(--td-brand-color-focus); color: var(--td-brand-color); font-weight: 600; }
.menu a.active::before { height: 18px; }

.main { margin-left: var(--td-size-sidebar); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header {
  height: var(--td-size-header); background: rgba(255, 255, 255, .9); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--td-border-level-1-color);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.header .crumbs { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.header .crumbs::before { content: ''; width: 4px; height: 16px; border-radius: 2px; background: var(--td-brand-gradient); }
.header .user { display: flex; align-items: center; gap: 12px; color: var(--td-text-color-secondary); position: relative; }
.content { padding: 22px 26px 48px; flex: 1; }

/* 用户头像 + 下拉 */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--td-brand-gradient); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none;
}
.user-menu {
  position: absolute; top: 44px; right: 0; min-width: 160px; background: #fff; border-radius: var(--td-radius-default);
  box-shadow: var(--td-shadow-2); border: 1px solid var(--td-border-level-1-color); padding: 6px; display: none; z-index: 50;
}
.user-menu.show { display: block; animation: pop .12s ease-out; }
.user-menu a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--td-radius-small); color: var(--td-text-color-secondary); font-size: 13px; }
.user-menu a:hover { background: var(--td-bg-color-container-hover); color: var(--td-text-color-primary); }

/* ============ 卡片 / 统计 ============ */
.card { background: var(--td-bg-color-container); border: 1px solid var(--td-border-level-1-color); border-radius: var(--td-radius-default); box-shadow: var(--td-shadow-1); padding: 18px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title .sub { font-size: 12px; font-weight: 400; color: var(--td-text-color-placeholder); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 1200px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card {
  position: relative; overflow: hidden;
  background: var(--td-bg-color-container); border: 1px solid var(--td-border-level-1-color);
  border-radius: var(--td-radius-default); box-shadow: var(--td-shadow-1); padding: 18px;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--td-shadow-2); }
.stat-card::after {
  content: ''; position: absolute; right: -24px; top: -24px; width: 88px; height: 88px; border-radius: 50%;
  background: radial-gradient(circle, var(--td-brand-color-focus), transparent 70%); opacity: .6;
}
.stat-card .label { color: var(--td-text-color-secondary); font-size: 13px; margin-bottom: 10px; }
.stat-card .value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat-card .sub { margin-top: 8px; font-size: 12px; color: var(--td-text-color-placeholder); }
.stat-card .sub a { color: var(--td-brand-color); }

/* ============ 表格 ============ */
.table-box { width: 100%; overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--td-border-level-1-color); white-space: nowrap; }
table.grid th { color: var(--td-text-color-secondary); font-weight: 600; background: #fafbfd; position: sticky; top: 0; }
table.grid tbody tr { transition: background .12s; }
table.grid tbody tr:hover { background: var(--td-brand-color-light); }
table.grid td.wrap { white-space: normal; word-break: break-all; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 32px; padding: 0 14px;
  border-radius: var(--td-radius-small); border: 1px solid var(--td-border-level-2-color); background: #fff;
  color: var(--td-text-color-primary); cursor: pointer; font-size: 13px; transition: all .15s; user-select: none;
}
.btn:hover { border-color: var(--td-brand-color); color: var(--td-brand-color); box-shadow: 0 2px 8px rgba(43, 92, 255, .15); }
.btn-primary { background: var(--td-brand-color); border-color: var(--td-brand-color); color: #fff; box-shadow: 0 2px 8px rgba(43, 92, 255, .28); }
.btn-primary:hover { background: var(--td-brand-color-hover); border-color: var(--td-brand-color-hover); color: #fff; }
.btn-danger { color: var(--td-error-color); border-color: var(--td-error-color-light); background: var(--td-error-color-light); }
.btn-danger:hover { background: var(--td-error-color); color: #fff; border-color: var(--td-error-color); box-shadow: 0 2px 8px rgba(245, 72, 59, .28); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--td-brand-color); }
.btn-ghost:hover { background: var(--td-brand-color-focus); }
.btn-sm { height: 28px; padding: 0 11px; font-size: 12px; }
.btn:disabled, .btn.disabled { cursor: not-allowed; opacity: .55; box-shadow: none; }
.btn-block { width: 100%; }
.btn-icon {
  width: 30px; height: 30px; padding: 0; border-radius: var(--td-radius-small);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: var(--td-bg-color-component); color: var(--td-text-color-secondary);
  cursor: pointer; transition: all .15s;
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon:hover { background: var(--td-brand-color-focus); color: var(--td-brand-color); }
.btn-icon-danger { color: var(--td-error-color); background: var(--td-error-color-light); }
.btn-icon-danger:hover { background: var(--td-error-color); color: #fff; }
.row-actions { display: inline-flex; align-items: center; gap: 6px; }
.btn svg { width: 14px; height: 14px; }
.header .crumbs a { color: var(--td-text-color-secondary); }
.header .crumbs a:hover { color: var(--td-brand-color); }
.header .crumbs .crumb-sep { color: var(--td-text-color-placeholder); margin: 0 4px; font-weight: 400; }
.header .crumbs .crumb-cur { color: var(--td-text-color-primary); font-weight: 600; }

/* ============ 表单 ============ */
input.input, select.input, textarea.input {
  height: 34px; padding: 0 11px; border: 1px solid var(--td-border-level-2-color);
  border-radius: var(--td-radius-small); background: #fff; color: var(--td-text-color-primary); font-size: 13px; outline: none; min-width: 160px;
  transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
input.input:hover, select.input:hover, textarea.input:hover { border-color: var(--td-brand-color); }
input.input:focus, select.input:focus, textarea.input:focus { border-color: var(--td-brand-color); box-shadow: 0 0 0 3px var(--td-brand-color-focus); }
textarea.input { height: auto; min-height: 96px; padding: 9px 11px; width: 100%; font-family: var(--td-font-mono); line-height: 1.5; }
label.label { display: block; font-size: 13px; color: var(--td-text-color-secondary); margin-bottom: 5px; font-weight: 500; }
.field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.hint { color: var(--td-text-color-placeholder); font-size: 12px; margin-top: 5px; line-height: 1.5; }
.required::before { content: '*'; color: var(--td-error-color); margin-right: 3px; }

/* ============ 标签 / 状态点 ============ */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 4px; font-size: 12px; line-height: 18px; font-weight: 500; }
.tag-success { background: var(--td-success-color-light); color: var(--td-success-color); }
.tag-warning { background: var(--td-warning-color-light); color: var(--td-warning-color); }
.tag-error { background: var(--td-error-color-light); color: var(--td-error-color); }
.tag-primary { background: var(--td-brand-color-focus); color: var(--td-brand-color); }
.tag-default { background: var(--td-bg-color-component); color: var(--td-text-color-secondary); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 7px; }
.dot-success { background: var(--td-success-color); box-shadow: 0 0 0 3px var(--td-success-color-light); }
.dot-warning { background: var(--td-warning-color); box-shadow: 0 0 0 3px var(--td-warning-color-light); }
.dot-error { background: var(--td-error-color); box-shadow: 0 0 0 3px var(--td-error-color-light); }
.dot-default { background: var(--td-gray-color); box-shadow: 0 0 0 3px var(--td-bg-color-component); }

/* ============ 描述列表（详情面板） ============ */
.dl { display: grid; grid-template-columns: 132px 1fr; gap: 0; border: 1px solid var(--td-border-level-1-color); border-radius: var(--td-radius-default); overflow: hidden; }
.dl > div { padding: 10px 14px; border-bottom: 1px solid var(--td-border-level-1-color); font-size: 13px; }
.dl > div:nth-child(odd) { background: #fafbfd; color: var(--td-text-color-secondary); }
.dl > div:nth-child(even) { color: var(--td-text-color-primary); word-break: break-all; }
.dl > div:nth-last-child(1), .dl > div:nth-last-child(2) { border-bottom: 0; }

/* ============ 空态 / 加载 ============ */
.empty { padding: 44px 20px; text-align: center; color: var(--td-text-color-placeholder); line-height: 1.7; }

/* 统一空态组件：插画(::before) + 主文案 + 副文案 + 可选操作 */
.empty-block {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px; text-align: center;
  color: var(--td-text-color-placeholder);
  background: var(--td-bg-color-secondary, #f7f8fa);
  border: 1px dashed var(--td-border-level-2-color);
  border-radius: var(--td-radius-default, 10px);
  animation: pop2 .2s ease-out;
}
.empty-block .eb-title { font-size: 14px; font-weight: 600; color: var(--td-text-color-secondary); }
.empty-block .eb-desc { margin-top: 6px; max-width: 460px; font-size: 12px; line-height: 1.7; color: var(--td-text-color-placeholder); }
.empty-block .eb-actions { margin-top: 16px; display: inline-flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.empty-block.is-sm { padding: 22px 16px; }
.empty-block.is-sm .eb-title { font-size: 13px; }
.empty-block.is-sm::before { width: 58px; height: 43px; margin-bottom: 10px; }

/* 表格空态：隐藏表头，让空态整块铺满并水平居中（避免只剩一个空表壳）
   注意：这里不能用 border-collapse:separate —— 当 thead 被隐藏时，
   它会令表格退化为“内容宽度”，空态块随之收缩并靠左。显式锁定满宽。 */
table.grid:has(> tbody > tr > td.empty),
table.grid:has(> tbody > tr > td > .empty-block),
table.grid.is-empty { width: 100%; }
table.grid:has(> tbody > tr > td.empty) > thead,
table.grid:has(> tbody > tr > td > .empty-block) > thead { display: none; }
table.grid td.empty { border-bottom: 0; text-align: center; }
/* 兼容不支持 :has() 的浏览器（由 App.markEmptyTables 打标） */
table.grid.is-empty > thead { display: none; }
table.grid.is-empty { background: transparent; }
table.grid.is-empty > tbody > tr.empty-row > td { border: 0; }
table.grid tbody tr.empty-row > td { padding: 0; border-bottom: 0; text-align: center; }
table.grid tbody tr.empty-row:hover,
table.grid tbody tr:has(> td.loading):hover { background: transparent; }
table.grid tbody tr:has(> td.loading) > td { border-bottom: 0; }

.loading { padding: 36px; text-align: center; color: var(--td-text-color-placeholder); }
.loading::before {
  content: ''; display: block; width: 22px; height: 22px; margin: 0 auto 10px; border-radius: 50%;
  border: 2px solid var(--td-border-level-2-color); border-top-color: var(--td-brand-color);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* ============ 分页 ============ */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--td-text-color-secondary); flex-wrap: wrap; }
.pager .size-select { min-width: 90px; height: 30px; }
.pager .btn-sm { min-width: 32px; }
.pager .page-info { color: var(--td-text-color-placeholder); }

/* ============ 弹窗 ============ */
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); z-index: 100; display: none; animation: fade .15s; }
.mask.show { display: block; }
.dialog {
  position: fixed; z-index: 101; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 640px; max-width: calc(100vw - 40px); max-height: 88vh; overflow: auto;
  background: #fff; border-radius: 12px; box-shadow: var(--td-shadow-3); display: none; animation: pop .16s ease-out;
}
.dialog.show { display: block; }
.dialog-head { padding: 18px 22px; border-bottom: 1px solid var(--td-border-level-1-color); font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.dialog-body { padding: 22px; }
.dialog-foot { padding: 14px 22px; border-top: 1px solid var(--td-border-level-1-color); display: flex; justify-content: flex-end; gap: 10px; }
.close-x { cursor: pointer; color: var(--td-text-color-placeholder); font-size: 16px; line-height: 1; padding: 4px; border-radius: 4px; }
.close-x:hover { background: var(--td-bg-color-container-hover); color: var(--td-text-color-primary); }

/* ============ 提示 toast ============ */
.toast-wrap { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: var(--td-radius-default);
  background: #fff; box-shadow: var(--td-shadow-2); font-size: 13px; min-width: 240px; max-width: 420px;
  border-left: 3px solid var(--td-brand-color); animation: toastIn .22s cubic-bezier(.22, 1, .36, 1);
}
.toast.out { animation: toastOut .2s ease forwards; }
.toast .ic { width: 16px; height: 16px; flex: 0 0 16px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-size: 11px; }
.toast-success { border-left-color: var(--td-success-color); }
.toast-success .ic { background: var(--td-success-color); }
.toast-error { border-left-color: var(--td-error-color); }
.toast-error .ic { background: var(--td-error-color); }
.toast-warning { border-left-color: var(--td-warning-color); }
.toast-warning .ic { background: var(--td-warning-color); }
.toast-info { border-left-color: var(--td-brand-color); }
.toast-info .ic { background: var(--td-brand-color); }

/* ============ 登录页（分屏企业风） ============ */
.login-page { min-height: 100vh; display: flex; }
.login-aside {
  flex: 0 0 46%; max-width: 560px; position: relative; overflow: hidden;
  background: var(--td-brand-gradient); color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  padding: 56px 48px;
}
.login-aside::before, .login-aside::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.login-aside::before { width: 320px; height: 320px; right: -120px; top: -120px; }
.login-aside::after { width: 220px; height: 220px; left: -80px; bottom: -80px; background: rgba(255, 255, 255, .08); }
.login-aside .brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; position: relative; z-index: 1; }
.login-aside .brand .logo-mark { width: 40px; height: 40px; font-size: 20px; background: rgba(255, 255, 255, .22); box-shadow: none; }
.login-aside .slogan { position: relative; z-index: 1; }
.login-aside .slogan h1 { font-size: 30px; line-height: 1.35; margin: 0 0 14px; font-weight: 700; }
.login-aside .slogan p { margin: 0; opacity: .85; font-size: 14px; line-height: 1.8; }
.login-aside .foot { position: relative; z-index: 1; font-size: 12px; opacity: .7; }
.login-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 380px; padding: 36px 34px 28px;
  background: #fff; border: 1px solid var(--td-border-level-1-color, #e7e7e7); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(21, 46, 104, .10), 0 2px 8px rgba(21, 46, 104, .06);
}
.login-card .login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-card .login-sub { color: var(--td-text-color-secondary); font-size: 13px; margin-bottom: 26px; }
.login-page input.input { width: 100%; height: 40px; }
.login-card .btn-login { height: 40px; margin-top: 8px; font-size: 15px; }
.login-extra { margin-top: 18px; font-size: 12px; color: var(--td-text-color-placeholder); text-align: center; }
.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 42px; }
.pwd-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; border-radius: 6px;
  color: var(--td-text-color-placeholder); cursor: pointer;
}
.pwd-eye:hover { color: var(--td-brand-color); }
@media (max-width: 480px) {
  .login-card { width: 100%; padding: 28px 22px 22px; }
}

/* ============ 仪表盘增强 ============ */
.area-chart { width: 100%; height: 220px; display: flex; align-items: center; justify-content: center; }
.area-chart text { font-size: 11px; fill: var(--td-text-color-placeholder); }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.quick-actions a {
  display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--td-border-level-1-color);
  border-radius: var(--td-radius-default); transition: all .15s; background: #fff;
}
.quick-actions a:hover { border-color: var(--td-brand-color); box-shadow: var(--td-shadow-1); transform: translateY(-2px); }
.quick-actions .qa-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--td-brand-color-light); color: var(--td-brand-color); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.quick-actions .qa-t { font-weight: 600; font-size: 13.5px; }
.quick-actions .qa-s { font-size: 12px; color: var(--td-text-color-placeholder); }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.status-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--td-border-level-1-color); border-radius: var(--td-radius-default); }
.status-item .si-t { font-size: 13px; color: var(--td-text-color-secondary); }
.status-item .si-v { font-weight: 600; margin-top: 2px; }

/* ============ 杂项 ============ */
.code-block { background: #0f172a; color: #d7e0f0; padding: 14px; border-radius: var(--td-radius-default); font-family: var(--td-font-mono); font-size: 12px; overflow: auto; max-height: 280px; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }
.mono, .nowrap-mono { font-family: var(--td-font-mono); }
.text-secondary { color: var(--td-text-color-secondary); }
.text-danger { color: var(--td-error-color); }
.text-success { color: var(--td-success-color); }
.text-warning { color: var(--td-warning-color); }
.text-primary { color: var(--td-brand-color); }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.nowrap-mono { font-family: var(--td-font-mono); }

/* ============ 动画 ============ */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px); } }
/* ============ 菜单图标 ============ */
.menu .mi { width: 18px; height: 18px; flex: 0 0 18px; opacity: .82; transition: opacity .15s, transform .15s; }
.menu a:hover .mi { opacity: 1; transform: scale(1.06); }
.menu a.active .mi { opacity: 1; }

/* ============ 统计卡图标与分色 ============ */
.stat-card .stat-ic {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; color: #fff; z-index: 1;
}
.stat-card .stat-ic svg { width: 21px; height: 21px; }
.stat-card .value { padding-right: 52px; }
/* 显式配色类：不依赖 nth-child 位置，卡片增删不会错色（统计卡与待办项共用） */
.sc-blue   .stat-ic, .sc-blue   .ti-ic { background-image: linear-gradient(135deg, #2b5cff, #4f86ff); }
.sc-green  .stat-ic, .sc-green  .ti-ic { background-image: linear-gradient(135deg, #00b96b, #36cfc9); }
.sc-purple .stat-ic, .sc-purple .ti-ic { background-image: linear-gradient(135deg, #9254de, #b37feb); }
.sc-orange .stat-ic, .sc-orange .ti-ic { background-image: linear-gradient(135deg, #ff7a45, #ffa940); }
.sc-pink   .stat-ic, .sc-pink   .ti-ic { background-image: linear-gradient(135deg, #f759ab, #ff85c0); }
.sc-red    .stat-ic, .sc-red    .ti-ic { background-image: linear-gradient(135deg, #e5484d, #f87171); }
.sc-blue   .stat-ic { box-shadow: 0 8px 16px rgba(43, 92, 255, .32); }
.sc-green  .stat-ic { box-shadow: 0 8px 16px rgba(0, 185, 107, .30); }
.sc-purple .stat-ic { box-shadow: 0 8px 16px rgba(146, 84, 222, .30); }
.sc-orange .stat-ic { box-shadow: 0 8px 16px rgba(255, 122, 69, .30); }
.sc-pink   .stat-ic { box-shadow: 0 8px 16px rgba(247, 89, 171, .30); }
.sc-red    .stat-ic { box-shadow: 0 8px 16px rgba(229, 72, 77, .30); }

/* ============ 区块标题（首页分组） ============ */
.sec-head { display: flex; align-items: center; gap: 10px; margin: 2px 2px 12px; }
.sec-head .sh-t { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.sec-head .sh-t::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--td-brand-color); }
.sec-head .sh-s { font-size: 12px; color: var(--td-text-color-placeholder); }

/* ============ 待办事项 ============ */
.todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.todo-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer;
  border: 1px solid var(--td-border-level-1-color); border-radius: var(--td-radius-default);
  background: #fff; color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.todo-item:hover { border-color: var(--td-brand-color); box-shadow: var(--td-shadow-1); transform: translateX(2px); color: inherit; }
.todo-item .ti-ic { width: 36px; height: 36px; border-radius: 10px; flex: 0 0 36px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.todo-item .ti-ic svg { width: 19px; height: 19px; }
.todo-item .ti-main { flex: 1; min-width: 0; }
.todo-item .ti-t { display: block; font-size: 13.5px; font-weight: 600; color: var(--td-text-color-primary); }
.todo-item .ti-s { display: block; font-size: 12px; color: var(--td-text-color-placeholder); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-item .ti-count { flex: 0 0 auto; font-size: 22px; font-weight: 700; letter-spacing: -.5px; color: var(--td-brand-color); }
.todo-item .ti-go { width: 16px; height: 16px; flex: 0 0 16px; color: var(--td-text-color-placeholder); transition: transform .15s, color .15s; }
.todo-item:hover .ti-go { transform: translateX(2px); color: var(--td-brand-color); }
/* 已处理完（计数为 0）弱化显示 */
.todo-item.is-zero { opacity: .6; }
.todo-item.is-zero:hover { opacity: 1; }
.todo-item.is-zero .ti-ic { filter: grayscale(1); }
.todo-item.is-zero .ti-count { color: var(--td-text-color-placeholder); font-weight: 600; }
/* 需重点关注的待办 */
.todo-item.is-alert { border-color: rgba(229, 72, 77, .38); }
.todo-item.is-alert .ti-count { color: var(--td-error-color); }
.todo-empty { display: flex; align-items: center; gap: 10px; padding: 18px 6px; color: var(--td-success-color); font-size: 13.5px; }
.todo-empty svg { width: 20px; height: 20px; flex: 0 0 20px; }
.todo-empty .te-desc { color: var(--td-text-color-placeholder); }

/* ============ 快捷操作图标 ============ */
.quick-actions .qa-ic svg { width: 16px; height: 16px; }

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c9cedb; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aab2c5; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 描述列表（详情弹窗） ============ */
.dl { display: grid; grid-template-columns: 132px 1fr; margin: 0; }
.dl > dt { color: var(--td-text-color-secondary); font-size: 13px; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--td-border-level-1-color); }
.dl > dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--td-border-level-1-color); font-size: 13px; word-break: break-all; }
.dl > dd.mono { font-family: var(--td-font-family-mono, ui-monospace, Menlo, Consolas, monospace); }
.dl > dt:last-of-type, .dl > dd:last-of-type { border-bottom: none; }

/* ============ 表格内操作按钮（轻量链接风） ============ */
.grid td .btn-sm { height: auto; padding: 4px 8px; background: transparent; border: 1px solid transparent; color: var(--td-brand-color); font-weight: 500; }
.grid td .btn-sm:hover { background: var(--td-brand-color-focus); border-radius: 4px; }
.grid td .btn-sm.btn-danger { color: var(--td-error-color); }
.grid td .btn-sm.btn-danger:hover { background: var(--td-error-color-light); }
.grid td .btn-sm + .btn-sm { margin-left: 2px; }
.grid td .btn-sm.btn-primary { background: var(--td-brand-color); color: #fff; border-color: var(--td-brand-color); }
.grid td .btn-sm.btn-primary:hover { filter: brightness(.94); }

/* ============ 空态插画（全局共用） ============ */
:root {
  --empty-art: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 84 62'%3E%3Crect x='12' y='22' width='60' height='30' rx='7' fill='%23f4f6fa'/%3E%3Crect x='12' y='22' width='60' height='30' rx='7' fill='none' stroke='%23d5dae5' stroke-width='2'/%3E%3Cpath d='M12 38h15l3 5h24l3-5h15' fill='none' stroke='%23c3cad8' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M30 29h24' stroke='%23dde2ec' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='30' cy='13' r='3' fill='%23e2e6ef'/%3E%3Ccircle cx='57' cy='9' r='2' fill='%23e8ecf3'/%3E%3C/svg%3E");
}
.empty::before,
.empty-block::before {
  content: ''; display: block; margin: 0 auto 12px;
  background: var(--empty-art) no-repeat center / contain;
}
.empty::before { width: 64px; height: 47px; }
.empty-block::before { width: 84px; height: 62px; }

/* ============ 骨架屏 ============ */
.skeleton { position: relative; overflow: hidden; background: #eef0f5; border-radius: 6px; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.7) 50%, rgba(255,255,255,0) 100%); animation: sk-shimmer 1.25s infinite; }
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }
.sk-row td { padding: 16px 12px !important; }
.sk-line { height: 12px; border-radius: 6px; }

/* ============ 表单分区 ============ */
.form-section { margin-bottom: 18px; }
.form-section:last-child { margin-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--td-text-color-primary, #1d2129); margin: 2px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--td-border-level-1-color); }
.form-section-title .dot { width: 3px; height: 14px; border-radius: 2px; background: var(--td-brand-color); }
.form-section-title .sub { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--td-text-color-placeholder, #a8abb2); }

.checkline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--td-text-color-primary, #1d2129); cursor: pointer; user-select: none; }
.checkline input { width: 15px; height: 15px; accent-color: var(--td-brand-color, #2b5cff); cursor: pointer; }
.perm-groups { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 4px; }
.perm-group { border: 1px solid var(--td-border-level-1-color, #e7e9ee); border-radius: var(--td-radius-default, 8px); padding: 10px 14px; min-width: 190px; }
.perm-group-title { font-size: 12px; font-weight: 600; color: var(--td-text-color-secondary, #646a73); margin-bottom: 8px; }
.perm-items { display: flex; flex-direction: column; gap: 8px; }
.field-help { font-size: 12px; color: var(--td-text-color-placeholder, #a8abb2); margin-top: 4px; line-height: 1.5; }

/* ============ 工具条 / 余额面板（资金账户） ============ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
table.grid th.text-right, table.grid td.text-right { text-align: right; }
.balance-result { min-height: 62px; }
.bal-placeholder { display: flex; align-items: center; gap: 8px; padding: 18px 2px; font-size: 13px; color: var(--td-text-color-placeholder); }
.bal-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px;
  padding: 14px 16px; border: 1px solid var(--td-border-level-1-color); border-radius: var(--td-radius-default);
  background: var(--td-bg-color-secondary, #f7f8fa);
}
.bal-metric .bm-label { font-size: 12px; color: var(--td-text-color-placeholder); }
.bal-metric .bm-value { margin-top: 4px; font-size: 22px; font-weight: 700; letter-spacing: -.5px; font-family: var(--td-font-mono); }
.bal-metric .bm-value.bm-sm { font-size: 14px; font-weight: 600; font-family: inherit; }

/* ============ 响应式 ============ */
@media (max-width: 1100px) { .login-aside { display: none; } }
@media (max-width: 768px) {
  #menuToggle { display: inline-flex !important; }
  .header .user > span:not(.avatar) { display: none; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ 通知铃铛 ============ */
.notif-bell { position: relative; margin-right: 6px; }
.notif-bell .nb-trigger {
  position: relative; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--td-text-color-secondary); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; transition: all .15s;
}
.notif-bell .nb-trigger:hover { background: var(--td-bg-color-container-hover); color: var(--td-text-color-primary); }
.notif-bell .nb-trigger svg { width: 20px; height: 20px; }
.notif-bell .nb-badge {
  position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--td-error-color); color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-weight: 600;
  box-shadow: 0 0 0 2px #fff;
}
.notif-panel {
  position: absolute; top: 46px; right: 0; width: 340px; background: #fff; border: 1px solid var(--td-border-level-1-color);
  border-radius: var(--td-radius-default); box-shadow: var(--td-shadow-3); z-index: 60; display: none; overflow: hidden;
  animation: pop2 .14s ease-out;
}
.notif-panel.show { display: block; }
.np-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--td-border-level-1-color); font-weight: 600; }
.np-head .np-all { font-size: 12px; color: var(--td-brand-color); font-weight: 500; }
.np-list { max-height: 360px; overflow-y: auto; }
.np-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--td-border-level-1-color); cursor: pointer; transition: background .12s; }
.np-item:hover { background: var(--td-brand-color-light); }
.np-item .np-ic { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 8px; background: var(--td-brand-color-light); color: var(--td-brand-color); display: inline-flex; align-items: center; justify-content: center; }
.np-item .np-ic svg { width: 16px; height: 16px; }
.np-item .np-body { flex: 1; min-width: 0; }
.np-item .np-t { font-size: 13px; font-weight: 600; color: var(--td-text-color-primary); }
.np-item .np-c { font-size: 12px; color: var(--td-text-color-secondary); margin-top: 2px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.np-item .np-time { font-size: 11px; color: var(--td-text-color-placeholder); margin-top: 4px; }
.np-item.unread .np-t::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--td-error-color); margin-left: 6px; vertical-align: middle; }
.np-foot { padding: 10px 14px; text-align: right; border-top: 1px solid var(--td-border-level-1-color); }
.np-empty { padding: 30px 20px; text-align: center; color: var(--td-text-color-placeholder); font-size: 13px;
  background: var(--td-bg-color-secondary, #f7f8fa); border: 1px dashed var(--td-border-level-2-color); border-radius: var(--td-radius-default, 10px); }
.np-empty::before { content: ''; display: block; width: 52px; height: 38px; margin: 0 auto 10px; background: var(--empty-art) no-repeat center / contain; }
.np-empty.np-loading::before {
  width: 20px; height: 20px; border-radius: 50%; background: none;
  border: 2px solid var(--td-border-level-2-color); border-top-color: var(--td-brand-color);
  animation: spin .7s linear infinite;
}
.np-empty.np-error { color: var(--td-error-color); }
.np-empty.np-error::before { background: none; }
@keyframes pop2 { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ============ 站内信整页 ============ */
.nf-list { display: flex; flex-direction: column; }
.nf-item { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--td-border-level-1-color); border-radius: var(--td-radius-default); margin-bottom: 12px; transition: border-color .15s, box-shadow .15s; }
.nf-item:hover { border-color: var(--td-brand-color); box-shadow: var(--td-shadow-1); }
.nf-item.unread { background: var(--td-brand-color-light); }
.nf-item .nf-ic { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 10px; background: var(--td-brand-color-light); color: var(--td-brand-color); display: inline-flex; align-items: center; justify-content: center; }
.nf-item .nf-ic svg { width: 20px; height: 20px; }
.nf-item .nf-main { flex: 1; min-width: 0; }
.nf-item .nf-top { display: flex; align-items: center; gap: 10px; }
.nf-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--td-error-color); flex: 0 0 8px; }
.nf-item .nf-title { font-weight: 600; font-size: 14px; }
.nf-item .nf-time { font-size: 12px; color: var(--td-text-color-placeholder); margin-left: auto; }
.nf-item .nf-content { color: var(--td-text-color-secondary); font-size: 13px; margin-top: 6px; line-height: 1.6; }
.nf-item .nf-ops { display: flex; flex-direction: column; gap: 6px; justify-content: center; }

/* 分段控件 */
.seg { display: inline-flex; background: var(--td-bg-color-component); border-radius: var(--td-radius-small); padding: 2px; }
.seg-btn { border: none; background: transparent; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--td-text-color-secondary); transition: all .15s; }
.seg-btn.active { background: #fff; color: var(--td-brand-color); font-weight: 600; box-shadow: var(--td-shadow-1); }

/* ============ 抽屉式详情 ============ */
.dialog.drawer {
  top: 0; left: auto; right: 0; bottom: 0; transform: translateX(100%);
  width: 460px; max-width: 92vw; max-height: 100vh; height: 100vh; border-radius: 14px 0 0 14px;
  animation: drawerIn .24s cubic-bezier(.22, 1, .36, 1);
}
.dialog.drawer.show { transform: translateX(0); }
.dialog.drawer .dialog-body { max-height: calc(100vh - 120px); }
@keyframes drawerIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* ============ 敏感信息脱敏展示 ============ */
.secret {
  cursor: pointer; user-select: none; border-bottom: 1px dotted var(--td-border-level-2-color);
  color: var(--td-text-color); transition: color .12s;
}
.secret:hover { color: var(--td-brand-color); border-bottom-color: var(--td-brand-color); }
.secret:focus { outline: 2px solid var(--td-brand-color-focus); border-radius: 3px; }
.secret.revealed { color: var(--td-error-color); border-bottom-color: var(--td-error-color-light); }
.secret.empty { cursor: default; border-bottom: none; color: var(--td-text-color-placeholder); }
@media (max-width: 768px) { .dialog.drawer { width: 100vw; max-width: 100vw; border-radius: 0; } }

/* ============ 列宽拖拽 ============ */
table.grid th .col-resizer { position: absolute; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; user-select: none; z-index: 2; }
table.grid th .col-resizer::after { content: ''; position: absolute; right: 3px; top: 25%; height: 50%; width: 2px; background: var(--td-border-level-2-color); border-radius: 2px; opacity: 0; transition: opacity .15s; }
table.grid th:hover .col-resizer::after { opacity: 1; }
.col-resizing, .col-resizing * { cursor: col-resize !important; user-select: none !important; }

/* ============ 简易柱状图 ============ */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { width: 70px; flex: 0 0 70px; text-align: right; color: var(--td-text-color-secondary); }
.bar-track { flex: 1; height: 10px; background: var(--td-bg-color-component); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--td-brand-gradient); border-radius: 6px; transition: width .3s; }
.bar-val { width: 56px; flex: 0 0 56px; text-align: right; color: var(--td-text-color-secondary); font-variant-numeric: tabular-nums; }

/* ============ 仪表盘布局 ============ */
.dashboard-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.dist-flex { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ============ 微信扫码登录 ============ */
.login-divider { display: flex; align-items: center; margin: 14px 0 10px; color: var(--td-text-color-placeholder); font-size: 13px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--td-component-stroke, #e7e7e7); }
.login-divider span { padding: 0 12px; }
.wechat-login-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; border: none; border-radius: var(--td-radius-default, 8px);
  background: #07c160; color: #fff; font-size: 14px; cursor: pointer;
  transition: background .15s, transform .05s;
}
.wechat-login-btn:hover { background: #06ad56; }
.wechat-login-btn:active { transform: translateY(1px); }
.wechat-login-btn .wx-logo { flex: none; }
