/* ==========================================================================
   独立站数据集合平台 — 管理后台样式（零构建，纯 CSS）
   视觉基调对齐参考图：深色侧边栏 + 浅色内容区 + 卡片 + 数据表格
   ========================================================================== */

:root {
  --sidebar-bg: #1b2735;
  --sidebar-bg-2: #16202c;
  --sidebar-fg: #b7c2d0;
  --sidebar-fg-active: #ffffff;
  --sidebar-active: #1677ff;

  --brand: #1677ff;
  --brand-dark: #0958d9;
  --brand-soft: #e8f1ff;

  --bg: #f0f2f5;
  --card: #ffffff;
  --border: #e6e9ef;
  --border-strong: #d4d9e2;

  --text: #1f2937;
  --text-2: #5b6674;
  --text-3: #8b95a3;

  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #e5484d;
  --info: #0ea5e9;
  --purple: #7c3aed;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 32px rgba(16, 24, 40, .16);
  --sidebar-w: 216px;
  --sidebar-w-collapsed: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ========================= 登录 ========================= */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1b2735 0%, #2c3e50 55%, #1b2735 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 12px;
  padding: 32px 30px 26px; box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.login-brand h1 { font-size: 17px; line-height: 1.3; }
.login-brand p { margin: 4px 0 0; font-size: 12px; color: var(--text-3); }
.brand-mark-img { width: 48px; height: 48px; flex: none; border-radius: 11px; object-fit: contain; }
.brand-mark {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #40a9ff);
  color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
}
.brand-mark.sm { width: 32px; height: 32px; font-size: 13px; border-radius: 8px; }
.login-error {
  background: #fff1f0; border: 1px solid #ffccc7; color: #cf1322;
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 14px;
}
.login-hint { font-size: 11.5px; color: var(--text-3); margin: 16px 0 0; line-height: 1.6; }

/* ========================= 布局 ========================= */
.layout { display: flex; min-height: 100vh; }

/* ========================= 侧边栏 ========================= */
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--sidebar-bg);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  transition: width .16s ease;
}
.sidebar-brand {
  display: flex; gap: 10px; align-items: center; padding: 14px 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07); position: relative;
}
.sidebar-logo {
  width: 30px; height: 30px; flex: none; border-radius: 7px; object-fit: contain;
  background: rgba(255,255,255,.06); padding: 2px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; min-width: 0; }
.brand-text strong { color: #fff; font-size: 13.5px; white-space: nowrap; }
.brand-text span { color: #6b7c92; font-size: 9.5px; letter-spacing: .2px; white-space: nowrap; }

/* 折叠/展开按钮：贴在侧边栏右缘中上部，图标态下仍然可见 */
.sidebar-toggle {
  position: absolute; right: -11px; top: 22px; z-index: 5;
  width: 22px; height: 22px; border-radius: 50%;
  background: #26374a; border: 1px solid rgba(255,255,255,.16);
  color: #b7c2d0; cursor: pointer; font-size: 11px; line-height: 1;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.sidebar-toggle:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

.nav { flex: 1; padding: 10px 8px; overflow-y: auto; overflow-x: hidden; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; margin-bottom: 2px;
  color: var(--sidebar-fg); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; user-select: none; transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 500; }
.nav-item .ico { width: 16px; text-align: center; opacity: .85; font-size: 13px; flex: none; }
.nav-item .txt { overflow: hidden; text-overflow: ellipsis; }
.nav-item .badge {
  margin-left: auto; background: var(--danger); color: #fff; font-style: normal;
  font-size: 10.5px; padding: 1px 6px; border-radius: 9px; min-width: 18px; text-align: center;
  flex: none;
}
.sidebar-foot { padding: 8px; border-top: 1px solid rgba(255,255,255,.07); }

/* ---- 折叠为「仅图标」模式 ---- */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item .txt { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 14px 6px 16px; }
.sidebar.collapsed .nav { padding: 10px 6px; }
.sidebar.collapsed .nav-item {
  justify-content: center; padding: 10px 0; gap: 0; position: relative;
}
.sidebar.collapsed .nav-item .ico { font-size: 15px; }
/* 折叠态下用 CSS 提示代替 title，避免依赖原生 tooltip 的延迟 */
.sidebar.collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: #1f2937; color: #fff; font-size: 12px; padding: 4px 9px; border-radius: 5px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s;
  z-index: 40; box-shadow: 0 4px 14px rgba(0,0,0,.28);
}
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }
.sidebar.collapsed .nav-item .badge {
  position: absolute; top: 4px; right: 8px; margin: 0; padding: 0 4px;
  font-size: 9.5px; min-width: 14px;
}
.sidebar.collapsed .sidebar-toggle { right: -11px; }

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

.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar-left h2 { font-size: 16px; }
.crumb { color: var(--text-3); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px;
  padding: 4px 10px; border-radius: 20px; background: #f6f7f9;
  border: 1px solid var(--border); color: var(--text-2); white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.pill.ok .dot { background: var(--ok); }
.pill.warn .dot { background: var(--warn); }
.pill.bad .dot { background: var(--danger); }
.pill.ok { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.pill.warn { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.pill.bad { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

.user-chip { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-chip b { font-size: 12.5px; }
.user-chip small { color: var(--text-3); font-size: 10.5px; }

.content { flex: 1; padding: 18px 22px 40px; min-width: 0; }

/* ========================= 通用组件 ========================= */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.card-head h3 { font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }
.card-body.pad-sm { padding: 12px 16px; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1180px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px) {
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  font-size: 12.5px; cursor: pointer; white-space: nowrap; font-family: inherit;
  transition: all .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { height: 25px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; height: 38px; font-size: 14px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f4f6f8; color: var(--brand); }
.icon-btn {
  width: 26px; height: 26px; border-radius: var(--radius-sm); border: none;
  background: transparent; color: var(--text-3); cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: #f1f3f6; color: var(--text); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 11px; color: var(--text-3); font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=email], input[type=datetime-local], select, textarea {
  height: 30px; padding: 0 9px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 12.5px; font-family: inherit;
  background: #fff; color: var(--text); width: 100%; outline: none;
}
textarea { height: auto; min-height: 76px; padding: 7px 9px; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(22,119,255,.12); }
input[readonly] { background: #f7f8fa; color: var(--text-2); }

/* ========================= 筛选栏 ========================= */
/*
 * 默认「单行不换行」：筛选条件一多就换成两三行，会把统计卡和列表整体推下首屏，
 * 每次改条件页面还会上下跳动。所以宁可横向滚动，也不要纵向堆叠。
 * 窄屏（< 1180px）才恢复换行 —— 那时候横向滚动已经比换行更难用了。
 */
.filters {
  display: flex; flex-wrap: nowrap; gap: 8px 10px; align-items: flex-end;
  padding: 10px 14px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow);
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.filters::-webkit-scrollbar { height: 5px; }
.filters::-webkit-scrollbar-thumb { background: #d4d9e2; border-radius: 3px; }
.filters::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1180px) {
  .filters { flex-wrap: wrap; overflow-x: visible; }
}

.filters .f { display: flex; flex-direction: column; gap: 3px; flex: none; }
.filters .f > label {
  font-size: 11px; color: var(--text-3); white-space: nowrap;
  line-height: 1.3;
}
.filters .f select, .filters .f input {
  height: 27px; font-size: 12px; padding: 0 7px; border-radius: 5px;
}
.filters .spacer { flex: 1 0 8px; min-width: 8px; }
.filters .actions { display: flex; gap: 6px; flex: none; align-items: center; }
.filters .actions .btn { height: 27px; padding: 0 11px; font-size: 12px; }
.filters .f select[multiple] { height: auto; }

/* ========================= 指标卡 ========================= */
/*
 * 指标卡固定**一行**展示（参考图1 的观感）。
 * 用 grid-auto-flow: column 让 N 个卡片横向排成 N 列，永远不换行；
 * 屏幕装不下时整个容器横向滚动，而不是把卡片挤成两行 ——
 * 两行指标卡会把下方趋势图挤出首屏，反而更难用。
 */
.stat-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(138px, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 3px;      /* 给滚动条留位置，避免贴住卡片 */
  scrollbar-width: thin;
}
.stat-row::-webkit-scrollbar { height: 6px; }
.stat-row::-webkit-scrollbar-thumb { background: #d4d9e2; border-radius: 3px; }
.stat-row::-webkit-scrollbar-track { background: transparent; }

.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  min-width: 0;                 /* 关键：让 grid 列能真正收缩，否则长数字会把列撑破 */
}
.stat-card .label {
  font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 5px;
  margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-card .label .src-tag { flex: none; }
.stat-card .value {
  font-size: 24px; font-weight: 650; line-height: 1.15; letter-spacing: -.4px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.stat-card .value .unit { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 4px; }
.stat-card .foot {
  margin-top: 7px; font-size: 11.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-card .foot > span { overflow: hidden; text-overflow: ellipsis; }

/* 卡片较多时自动收窄字号，保证一行的信息密度仍然可读 */
.stat-row.dense .stat-card { padding: 11px 12px; }
.stat-row.dense .stat-card .value { font-size: 21px; }
.stat-row.dense .stat-card .label { font-size: 11.5px; margin-bottom: 6px; }
.stat-row.dense .stat-card .foot { font-size: 11px; margin-top: 5px; }

.stat-row.denser .stat-card { padding: 10px 11px; }
.stat-row.denser .stat-card .value { font-size: 19px; letter-spacing: -.6px; }
.stat-row.denser .stat-card .label { font-size: 11px; margin-bottom: 5px; }
.stat-row.denser .stat-card .foot { font-size: 10.5px; margin-top: 4px; }
.stat-row.denser .stat-card .value .unit { font-size: 11px; }

/* 紧凑档：询盘管理这类「一屏要放 8 张卡 + 表格」的页面用 */
.stat-row.sm { gap: 10px; }
.stat-row.sm .stat-card { padding: 9px 11px; border-radius: 7px; }
.stat-row.sm .stat-card .value { font-size: 18px; letter-spacing: -.5px; }
.stat-row.sm .stat-card .label { font-size: 10.5px; margin-bottom: 4px; gap: 4px; }
.stat-row.sm .stat-card .foot { font-size: 10px; margin-top: 3px; }
.stat-row.sm .stat-card .src-tag { font-size: 9px; padding: 0 4px; }

/* 可点击筛选的卡片：给出明确的交互暗示，否则用户不会想到能点 */
.stat-card.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.stat-card.clickable:hover {
  border-color: var(--brand); box-shadow: 0 2px 10px rgba(22,119,255,.16); transform: translateY(-1px);
}
.stat-card.clickable::after {
  content: '筛选'; position: absolute; right: 9px; bottom: 8px;
  font-size: 9.5px; color: var(--brand); opacity: 0; transition: opacity .15s;
}
.stat-card.clickable:hover::after { opacity: .9; }
/* 当前生效的筛选卡片高亮，避免用户不知道自己在看过滤后的数据 */
.stat-card.active-filter { border-color: var(--brand); background: #f7fbff; }
.stat-card.active-filter::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand);
  border-radius: var(--radius) 0 0 var(--radius);
}

/* 卡片上的一键移除按钮：hover 才出现，避免平时干扰读数 */
.stat-card .card-remove {
  position: absolute; top: 5px; right: 5px; width: 18px; height: 18px;
  border: none; background: transparent; color: var(--text-3); cursor: pointer;
  border-radius: 4px; font-size: 12px; line-height: 1; opacity: 0;
  transition: opacity .15s, background .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.stat-card:hover .card-remove { opacity: 1; }
.stat-card .card-remove:hover { background: #fee2e2; color: var(--danger); }

/* 指标卡设置弹窗里的候选项 */
.card-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 620px) { .card-picker { grid-template-columns: 1fr; } }
.card-picker-item {
  display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.card-picker-item:hover { border-color: var(--brand); background: #fafcff; }
.card-picker-item.on { border-color: var(--brand); background: var(--brand-soft); }
.card-picker-item input { width: auto; height: auto; margin-top: 3px; flex: none; }
.card-picker-item .cp-t { font-size: 12.5px; font-weight: 500; }
.card-picker-item .cp-d { font-size: 11px; color: var(--text-3); line-height: 1.5; margin-top: 2px; }
.card-picker-item.disabled { opacity: .45; cursor: not-allowed; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-3); }
.src-tag {
  font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #f1f3f6;
  color: var(--text-3); border: 1px solid var(--border);
}

/* ========================= 表格 ========================= */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--text-2); font-size: 11.5px;
  padding: 9px 12px; background: #fafbfc; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable:hover { color: var(--brand); }
table.tbl td {
  padding: 9px 12px; border-bottom: 1px solid #f1f3f6; vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fafcff; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr.row-spam { background: #fffbfb; color: var(--text-3); }
table.tbl tbody tr.row-new td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .muted { color: var(--text-3); }

/* ---- 紧凑表格：列表页用它，同样高度能多看 2~3 行 ---- */
table.tbl.compact { font-size: 12px; }
table.tbl.compact th { padding: 7px 9px; font-size: 11px; }
table.tbl.compact td { padding: 6px 9px; line-height: 1.45; }
table.tbl.compact tbody tr { height: 42px; }

/* 单元格内的两行结构（主值 + 次要说明），用于把信息压进一行高度 */
.cell-2l { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-2l .p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-2l .s { font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 国旗 —— 比写"美国""德国"更省宽度，也更容易扫读 */
.flag { font-size: 14px; line-height: 1; margin-right: 4px; vertical-align: -1px; }
.flag-none {
  display: inline-block; width: 16px; height: 11px; margin-right: 4px;
  border-radius: 2px; background: #eef1f5; vertical-align: -1px;
}

/* 表格里的图标按钮：常态低调，hover 才亮起，避免列表像一排按钮墙 */
.icon-act {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px; border: none; background: transparent;
  color: var(--text-3); cursor: pointer; font-size: 12px; line-height: 1; padding: 0;
  flex: none;
}
.icon-act:hover { background: #eef4ff; color: var(--brand); }
.icon-act.on { color: var(--brand); }
.icon-row { display: inline-flex; gap: 2px; align-items: center; }

/* 状态点：比整块色标签更轻，但仍能一眼分辨 */
.st-dot {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  white-space: nowrap;
}
.st-dot::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none;
}
.st-new { color: #1677ff; }
.st-following { color: #0e7490; }
.st-quoted { color: #c2410c; }
.st-won { color: #15803d; }
.st-lost { color: #8b95a3; }
.st-invalid { color: #b91c1c; }

/* 微标签：用于"重复""垃圾""未分配"这类角标 */
.mini {
  display: inline-block; font-size: 10px; line-height: 1.5; padding: 0 4px;
  border-radius: 3px; border: 1px solid transparent; white-space: nowrap;
  vertical-align: 1px;
}
.mini-red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.mini-orange { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.mini-blue { background: #e8f1ff; color: #0958d9; border-color: #cfe2ff; }
.mini-gray { background: #f2f4f7; color: #5b6674; border-color: #e4e7ec; }

.empty { padding: 46px 20px; text-align: center; color: var(--text-3); font-size: 12.5px; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 11px;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.7;
}
.tag-gray   { background: #f2f4f7; color: #5b6674; border-color: #e4e7ec; }
.tag-blue   { background: #e8f1ff; color: #0958d9; border-color: #cfe2ff; }
.tag-green  { background: #ecfdf3; color: #15803d; border-color: #bbf7d0; }
.tag-orange { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.tag-red    { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tag-purple { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.tag-cyan   { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.tag-dot::before {
  content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; margin-right: 5px; vertical-align: middle;
}

.chart { width: 100%; height: 380px; }
.chart.sm { height: 280px; }

.legend-bar { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 4px 16px 14px; }
.legend-bar .lg { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.legend-bar .lg i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.legend-bar .lg b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ========================= 列表底部条（数据区 + 翻页区） ========================= */
.list-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; border-top: 1px solid var(--border);
  background: #fcfdfe; font-size: 12.5px; color: var(--text-2);
  border-radius: 0 0 var(--radius) var(--radius);
}
.lb-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-spacer { flex: 1 1 12px; min-width: 12px; }
.lb-right { display: flex; align-items: center; gap: 8px; flex: none; }
.lb-size { width: auto; height: 26px; font-size: 12px; padding: 0 6px; }
.lb-nav { width: 26px; height: 26px; border: 1px solid var(--border-strong); background: #fff; font-size: 15px; }
.lb-nav:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); background: #fff; }
.lb-nav:disabled { opacity: .4; cursor: not-allowed; }
.lb-page { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.lb-page .sep { color: var(--text-3); }
.lb-page-input {
  width: 46px; height: 26px; text-align: center; padding: 0 4px;
  font-variant-numeric: tabular-nums;
}
.bulk { display: flex; align-items: center; gap: 8px; }
.bulk b { color: var(--brand); }

/* ========================= 表头排序 ========================= */
.th-inner { display: inline-flex; align-items: center; gap: 4px; }
.sort-ico { display: inline-flex; flex-direction: column; line-height: .6; font-size: 7px; opacity: .35; }
.sort-ico i { font-style: normal; }
.sort-ico i.on { opacity: 1; color: var(--brand); }
th.sortable.sorted { color: var(--brand); }
th.sortable:hover .sort-ico { opacity: .7; }

/* ========================= 表格多选 ========================= */
table.tbl .col-sel { width: 34px; padding-left: 10px; padding-right: 0; text-align: center; }
table.tbl .col-sel input[type=checkbox],
.row-check {
  width: 14px; height: 14px; cursor: pointer; accent-color: var(--brand);
  vertical-align: middle; margin: 0;
}
table.tbl tbody tr.row-selected { background: #f2f7ff; }
table.tbl tbody tr.row-selected:hover { background: #eaf2ff; }

/* ========================= 下拉菜单 ========================= */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); z-index: 80;
  min-width: 132px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 4px; display: flex; flex-direction: column;
}
.dropdown-menu.right { right: 0; }
.dropdown-menu.left { left: 0; }
.dropdown-menu[hidden] { display: none; }
.dd-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 10px; border: none; background: transparent; text-align: left;
  font-size: 12.5px; color: var(--text); cursor: pointer; border-radius: 4px;
  font-family: inherit; white-space: nowrap;
}
.dd-item:hover:not(:disabled) { background: #f2f6ff; color: var(--brand); }
.dd-item.danger { color: var(--danger); }
.dd-item.danger:hover:not(:disabled) { background: #fef2f2; color: var(--danger); }
.dd-item:disabled { opacity: .45; cursor: not-allowed; }
.dd-item .dd-ico { width: 15px; text-align: center; flex: none; font-size: 12px; opacity: .85; }
.dd-divider { height: 1px; background: var(--border); margin: 4px 6px; }
.row-menu-trigger { font-size: 15px; letter-spacing: 0; }

/* ========================= 空态 ========================= */
.empty { padding: 46px 20px; text-align: center; color: var(--text-3); font-size: 12.5px; }

.loading-block { padding: 60px; text-align: center; color: var(--text-3); }
.spinner {
  display: inline-block; width: 14px; height: 14px; margin-right: 8px;
  border: 2px solid var(--border-strong); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================= 抽屉 ========================= */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 60;
  animation: fade .15s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(720px, 94vw);
  background: #fff; z-index: 61; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(28px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head, .modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); flex: none;
}
.drawer-head h3, .modal-head h3 { font-size: 14.5px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.drawer-foot {
  flex: none; padding: 11px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; background: #fafbfc;
}

/* ========================= 弹窗 ========================= */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .15s ease;
}
.modal {
  background: #fff; border-radius: 10px; width: min(560px, 100%);
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.modal.wide { width: min(860px, 100%); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  padding: 11px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; background: #fafbfc;
  border-radius: 0 0 10px 10px;
}

/* ========================= Toast ========================= */
.toast-box { position: fixed; top: 18px; right: 18px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12.5px;
  box-shadow: var(--shadow-lg); min-width: 240px; max-width: 400px;
  animation: toastIn .18s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.err { border-left-color: var(--danger); }
@keyframes toastIn { from { transform: translateX(16px); opacity: 0; } }

/* ========================= 详情区块 ========================= */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0; }
.detail-grid .di { padding: 9px 14px; border-bottom: 1px solid #f1f3f6; min-width: 0; }
.detail-grid .di .k { font-size: 11px; color: var(--text-3); margin-bottom: 2px; }
.detail-grid .di .v { font-size: 12.5px; word-break: break-word; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }

.sec-title {
  font-size: 12px; font-weight: 600; color: var(--text-2); margin: 20px 0 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 7px;
}
.sec-title:first-child { margin-top: 0; }

.timeline { border-left: 2px solid var(--border); margin-left: 6px; padding-left: 16px; }
.timeline .ti { position: relative; padding-bottom: 14px; }
.timeline .ti::before {
  content: ''; position: absolute; left: -22px; top: 5px; width: 8px; height: 8px;
  border-radius: 50%; background: #fff; border: 2px solid var(--brand);
}
.timeline .ti .meta { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.timeline .ti .txt { font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }

pre.code {
  background: #1b2735; color: #d6deeb; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.65; overflow-x: auto; margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre; position: relative;
}
pre.code.wrap { white-space: pre-wrap; word-break: break-all; }
.code-block { position: relative; margin-bottom: 12px; }
.code-block .copy-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(255,255,255,.12); color: #cbd5e1; border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px; font-size: 11px; padding: 2px 8px; cursor: pointer;
}
.code-block .copy-btn:hover { background: rgba(255,255,255,.22); color: #fff; }

.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff;
}
.check-item.ok { background: #f6fef9; border-color: #d1fadf; }
.check-item.bad { background: #fffbfa; border-color: #fecdca; }
.check-item .ci-ico { font-size: 13px; line-height: 1.5; flex: none; width: 15px; }
.check-item.ok .ci-ico { color: var(--ok); }
.check-item.bad .ci-ico { color: var(--danger); }
.check-item .ci-t { font-size: 12.5px; font-weight: 500; }
.check-item .ci-d { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.check-item .ci-f { font-size: 11.5px; color: var(--warn); margin-top: 3px; }

.note {
  background: var(--brand-soft); border: 1px solid #cfe2ff; color: #0958d9;
  padding: 9px 13px; border-radius: var(--radius-sm); font-size: 12px; margin-bottom: 14px;
  line-height: 1.65;
}
.note.warn { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.note.danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

.kv-inline { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--text-2); }
.kv-inline b { color: var(--text); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs .tab {
  padding: 7px 14px; font-size: 12.5px; cursor: pointer; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--brand); }
.tabs .tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }

.site-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  background: #fff; box-shadow: var(--shadow);
}
.site-card .sc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.site-card .sc-domain { font-size: 11.5px; color: var(--text-3); }
.site-card .sc-name { font-size: 13.5px; font-weight: 600; }
.site-card .sc-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.bar-track { height: 6px; background: #f1f3f6; border-radius: 3px; overflow: hidden; min-width: 50px; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 3px; }

@media (max-width: 860px) {
  :root { --sidebar-w: 62px; }
  .brand-text, .nav-item span:not(.ico), .sidebar-foot .nav-item span { display: none; }
  .nav-item { justify-content: center; }
  .nav-item .badge { position: absolute; margin: 0; }
  .content { padding: 12px; }
  .topbar { padding: 0 12px; }
  .crumb { display: none; }
}
